131 11, 12, -1, 13, -1, 14, 15,
132 17, 18, -1, 19, -1, 20, 21,
133 23, 24, 25, 26, 27, -1,
134 28, 29, 30, 31, 32, -1
391 if (motion_data==NULL || datanum<=0)
return NULL;
395 unsigned int k = datanum - 1;
398 for (
unsigned int i=0; i<k; i++) {
399 if (motion_data[i].frm_num>motion_data[i+1].frm_num) {
400 swap_motion = motion_data[i];
401 motion_data[i] = motion_data[i+1];
402 motion_data[i+1] = swap_motion;
410 unsigned int uniq_frame = 1;
412 unsigned int frm_num = motion_data[0].
frm_num;
413 for (
unsigned int i=1; i<datanum; i++) {
414 if (frm_num!=motion_data[i].frm_num) {
416 frm_num = motion_data[i].
frm_num;
421 if (ni_joints==NULL)
return NULL;
422 framenum = uniq_frame;
425 unsigned int datacnt = 0;
426 for (
unsigned int i=0; i<uniq_frame; i++) {
427 frm_num = motion_data[datacnt].
frm_num;
428 ni_joints[i].
frmn = frm_num;
429 ni_joints[i].
msec = (int)(frm_num*33.3333333333333);
431 while (frm_num==motion_data[datacnt].frm_num) {
432 int joint =
VMDJointNum(motion_data[datacnt].name);
440 jdat->
quat.x = motion_data[datacnt].
qutz;
441 jdat->
quat.y = -motion_data[datacnt].
qutx;
442 jdat->
quat.z = -motion_data[datacnt].
quty;
443 jdat->
quat.s = motion_data[datacnt].
qutw;
445 jdat->
quat.normalize();
448 if (jdat->
vect.x!=0.0 || jdat->
vect.y!=0.0 || jdat->
vect.z!=0.0) {
451 if (jdat->
quat.x!=0.0 || jdat->
quat.y!=0.0 || jdat->
quat.z!=0.0 || jdat->
quat.s!=0.0) {
457 if (datacnt==datanum)
break;
565 Vector<double> vect_Y(0.0, 1.0, 0.0, 1.0);
566 Vector<double> vect_Z(0.0, 0.0,-1.0, 1.0);
575 Vector<double> l_ank_vect = vect_Y*0.10 + vect_Z*0.83;
576 Vector<double> r_ank_vect = -vect_Y*0.10 + vect_Z*0.83;
579 Vector<double> l_end_vect = cnt_vect_Y*0.10 + l_leg_vect*0.83;
580 Vector<double> r_end_vect = -cnt_vect_Y*0.10 + r_leg_vect*0.83;
591 Vector<double> l_vect[3], r_vect[3];
592 Quaternion<double> l_quat[3], r_quat[3];
595 l_vect[0].set(0.0, 0.0, 0.0);
596 r_vect[0].set(0.0, 0.0, 0.0);
598 l_vect[1] = -l_leg_vect*0.58;
599 r_vect[1] = -r_leg_vect*0.58;
600 l_vect[2] = -l_leg_vect*1.18;
601 r_vect[2] = -r_leg_vect*1.18;
659 Vector<double> vect_Y(0.0, 1.0, 0.0, 1.0);
660 Vector<double> effect, target;
661 Quaternion<double> rot;
663 for (
int j=0; j<3; j++) quat[j].init();
665 for (
int i=0; i<rpmax; i++) {
668 for (
int j=1; j<3; j++) {
671 rot.setRotation((
double)PI_DIV2, vect_Y);
674 effect = vect[0] - vect[j];
675 target = ik_vect - vect[j];
676 rot = V2VQuaternion(effect, target);
682 if (rot.s<1.00-Zero_Eps) {
684 quat[j] = quat[j]*rot;
685 for (
int k=0; k<j; k++) {
686 vect[k] = VectorRotation(vect[k]-vect[j], rot) + vect[j];