資源簡介
人體骨骼運動FORWARD KINEMATICS,利用opengl,c++實現,visual studio 平臺

代碼片段和文件信息
#include?
#include?
#include?
#include?“display.h“
#include?“transform.h“
#include
#include?
using?namespace?std;?
Display::Display()
{
m_Skeleton?=?NULL;
m_Motion?=?NULL;
boneIndex?=?0;
scaleBone?=?0;
}
Display::~Display()
{
???if(m_Skeleton?!=?NULL)?delete?m_Skeleton;
???if(m_Motion?!=?NULL)?delete?m_Motion;
???
}
void?Display::computeLocal2GlobalT()//從根節點層層計算TRANSLATION達到每個點
{
for(int?i=0;i<3;i++)
m_Local2GlobalT[0].l2gt[i]?=?0;//for?root?joint
for(int?i=1;i {
float?vec[3]?=?{000};
//cout< int?self=i;
while(self!=0)
{
int?parent=m_Skeleton->m_pBoneList[self].parent_idx;
v3_add(m_Skeleton->m_pBoneList[parent].tranvecvec);
self?=?parent;
}
v3_assign(vecm_Local2GlobalT[i].l2gt);
//cout<
}
}
void?Display::computeChild2Parent()
{
computeLocal2GlobalT();//??用處
float?idenM[4][4]={{1000}{0100}{0010}{0001}};
matrix_assign(idenMm_Child2Parent[0].c2p);
float?temp1[4][4]temp4[3];
for(int?i=1;i {
int?parent?=?m_Skeleton->m_pBoneList[i].parent_idx;
matrix_mult(m_Skeleton->m_pBoneList[parent].rot_global_localm_Skeleton->m_pBoneList[i].rot_local_globaltemp1);
//v3_minus(m_Local2GlobalT[i].l2gtm_Local2GlobalT[parent].l2gttemp3);
matrix_transform_affine(m_Skeleton->m_pBoneList[parent].rot_global_localm_Skeleton->m_pBoneList[parent].trantemp4);
temp1[0][3]?=?temp4[0];
temp1[1][3]?=?temp4[1];
temp1[2][3]?=?temp4[2];
matrix_assign(temp1m_Child2Parent[i].c2p);
}
}
void?Display::computeLocalRot(Motionframe?*?p_Motion)
{
p_MotionRot?=?new?MotionRot;
for(int?i=0;i<3;i++)
rootPos[i]=p_Motion->frame[i];
float?rxryrz;
int?count?=?3;
for(int?i=0;i {
rx=0;
ry=0;
rz=0;
if(m_Skeleton->m_pBoneList[i].dofx==1)
{
rx?=?p_Motion->frame[count];//frame[62]
count++;
}
if(m_Skeleton->m_pBoneList[i].dofy==1)
{
ry?=?p_Motion->frame[count];
count++;
}
if(m_Skeleton->m_pBoneList[i].dofz==1)
{
rz?=?p_Motion->frame[count];
count++;
}
rotationZYX(p_MotionRot->bRotList[i].bRot?rz?ry?rx);
}
}
void?Display::CGlobalPos(int?numframe)
{
computeChild2Parent();
m_Pos[numframe]?=?new?Pos;
float?glPos[3]temp[3];
computeLocalRot(m_Motion->m_pMotion[numframe]);
for(int?i=0;i<3;i++)
m_Pos[numframe]->globalPos[0][i]?=?rootPos[i];
for(int?i=1;i { ?
int?self?=?i;
v3_assign(m_Skeleton->m_pBoneList[self].loc_posglPos);
while(self!=0)
{
int?parent?=?m_Skeleton->m_pBoneList[self].parent_idx;
//v3_assign(glPostemp);
matrix_transform_affine(p_MotionRot->bRotList[self].bRotglPostemp);
matrix_transform_affine(m_Child2Parent[self].c2ptemp
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????81408??2009-10-26?22:27??Human?Motion_FK\debug\Human?Motion_FK.exe
?????文件?????557972??2009-10-26?22:27??Human?Motion_FK\debug\Human?Motion_FK.ilk
?????文件?????633856??2009-10-26?22:27??Human?Motion_FK\debug\Human?Motion_FK.pdb
?????文件???????7270??2008-01-11?19:49??Human?Motion_FK\debug\male.ASF
?????文件?????163436??2005-01-08?04:26??Human?Motion_FK\debug\male2.running.AMC
?????文件?????515347??2008-01-11?21:35??Human?Motion_FK\debug\male_walk10.AMC
?????文件????????235??2008-11-24?19:03??Human?Motion_FK\Human?Motion_FK\constant.h
?????文件???????6694??2009-10-26?22:27??Human?Motion_FK\Human?Motion_FK\Debug\BuildLog.htm
?????文件??????56575??2009-10-26?20:37??Human?Motion_FK\Human?Motion_FK\Debug\display.obj
?????文件????????621??2009-10-26?22:27??Human?Motion_FK\Human?Motion_FK\Debug\Human?Motion_FK.exe.intermediate.manifest
?????文件??????53475??2009-10-26?22:27??Human?Motion_FK\Human?Motion_FK\Debug\main.obj
?????文件??????47381??2009-10-25?21:03??Human?Motion_FK\Human?Motion_FK\Debug\motion.obj
?????文件?????????67??2009-10-26?22:27??Human?Motion_FK\Human?Motion_FK\Debug\mt.dep
?????文件??????68973??2009-10-25?21:03??Human?Motion_FK\Human?Motion_FK\Debug\skeleton.obj
?????文件??????45323??2009-10-25?21:03??Human?Motion_FK\Human?Motion_FK\Debug\transform.obj
?????文件?????265216??2008-12-04?16:30??Human?Motion_FK\Human?Motion_FK\Debug\vc80.idb
?????文件?????208896??2008-12-04?16:30??Human?Motion_FK\Human?Motion_FK\Debug\vc80.pdb
?????文件?????265216??2009-10-26?22:27??Human?Motion_FK\Human?Motion_FK\Debug\vc90.idb
?????文件?????233472??2009-10-26?22:27??Human?Motion_FK\Human?Motion_FK\Debug\vc90.pdb
?????文件??????10945??2009-10-25?21:24??Human?Motion_FK\Human?Motion_FK\display.cpp
?????文件???????1497??2009-10-25?14:50??Human?Motion_FK\Human?Motion_FK\display.h
?????文件???????1084??2008-04-08?11:34??Human?Motion_FK\Human?Motion_FK\GL\glut.h
?????文件???????4352??2009-10-26?22:23??Human?Motion_FK\Human?Motion_FK\Human?Motion_FK.vcproj
?????文件???????1427??2009-10-26?22:28??Human?Motion_FK\Human?Motion_FK\Human?Motion_FK.vcproj.LENOVO-D01793DE.YveStar.user
?????文件???????8037??2009-10-26?20:45??Human?Motion_FK\Human?Motion_FK\main.cpp
?????文件???????7270??2008-01-11?19:49??Human?Motion_FK\Human?Motion_FK\male.ASF
?????文件?????163436??2005-01-08?04:26??Human?Motion_FK\Human?Motion_FK\male2.running.AMC
?????文件?????515347??2008-01-11?21:35??Human?Motion_FK\Human?Motion_FK\male_walk10.AMC
?????文件???????2440??2008-11-24?11:10??Human?Motion_FK\Human?Motion_FK\motion.cpp
?????文件????????982??2008-11-24?02:29??Human?Motion_FK\Human?Motion_FK\motion.h
............此處省略15個文件信息
評論
共有 條評論