当前位置: 首页>>代码示例>>C++>>正文


C++ Joint::getDOF方法代码示例

本文整理汇总了C++中Joint::getDOF方法的典型用法代码示例。如果您正苦于以下问题:C++ Joint::getDOF方法的具体用法?C++ Joint::getDOF怎么用?C++ Joint::getDOF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Joint的用法示例。


在下文中一共展示了Joint::getDOF方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: incorporateDamping

double PoseIK::incorporateDamping( const math::vectorN& d, math::vectorN& dp )
{
	double dist = 0.0f;
	double c1, c2;

	unsigned int jj = 0;

	for( unsigned int j=0; j < NUM_JOINTS_IN_HUMAN; j++ )
	{
		Joint* joint = skeleton->getHumanJoint( j );

		if( joint )
		{
			c1 = PoseIK::DampingCoeff[ j ];
			c2 = 2.0 * c1;

			unsigned int dof = joint->getDOF();

			switch( dof ) {
			case 6 :
			{
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;

				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;

				break;
			}
			case 3 :
			{
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;

				break;
			}
			case 1 :
			{
				dist += c1*d[jj]*d[jj]; dp[jj] -= c2*d[jj]; jj++;

				break;
			}

			default :
				break;
			}
		}
	}

	return dist;
}
开发者ID:lumigraph,项目名称:MotionOrbits,代码行数:54,代码来源:PoseIK.cpp

示例2: calcDOF

unsigned int Skeleton::calcDOF()
{
	unsigned int total_dof = 0;

	std::vector< Joint* >::iterator itor_j = joint_list.begin();
	while( itor_j != joint_list.end() )
	{
		Joint* j = ( *itor_j ++ );
		total_dof += j->getDOF();
	}
	return total_dof;
}
开发者ID:lumigraph,项目名称:MotionOrbits,代码行数:12,代码来源:Skeleton.cpp

示例3: scalingCoefficients

void PoseIK::scalingCoefficients( math::vectorN& x )
{
	double c = 0.0f;

	unsigned int jj = 0;

	for( unsigned int j=0; j < NUM_JOINTS_IN_HUMAN; j++ )
	{
		Joint* joint = skeleton->getHumanJoint( j );

		if( joint )
		{
			unsigned int dof = joint->getDOF();

			switch( dof ) {
			case 6 :
			{
				c = PoseIK::RigidityCoeff[ j ];
				x[jj++] *= c;
				x[jj++] *= c;
				x[jj++] *= c;

				c = PoseIK::RigidityCoeff[ j ];
				x[jj++] *= c;
				x[jj++] *= c;
				x[jj++] *= c;

				break;
			}
			case 3 :
			{
				c = PoseIK::RigidityCoeff[ j ];
				x[jj++] *= c;
				x[jj++] *= c;
				x[jj++] *= c;

				break;
			}
			case 1 :
			{
				c = PoseIK::RigidityCoeff[ j ];
				x[jj++] *= c;

				break;
			}
			default :
				break;
			}
		}
	}
}
开发者ID:lumigraph,项目名称:MotionOrbits,代码行数:51,代码来源:PoseIK.cpp

示例4: energyFunc

double PoseIK::energyFunc( const math::vectorN& d )
{
	target_pose->copy( source_pose );
	target_pose->addDisplacement( skeleton, d );

	//
	double dist = 0.0f;

	vector	dv, dq, dc;
	quater	q;

	JointConstraint* joint_constraint = 0;

	for( unsigned int i=0; i < NUM_JOINTS_IN_HUMAN; i++ )
	{
		Joint* joint = skeleton->getHumanJoint( i );
		if( !joint )	continue;

		bool is_constrained = pose_constraint->getConstraint( i, &joint_constraint );
		if( !is_constrained )	continue;

		unsigned int joint_index = joint->getIndex();
		unsigned int joint_dof = joint->getDOF();

		math::transq jT = target_pose->getGlobalTransform( skeleton, joint_index );
		math::transq cT = joint_constraint->getTransform();

		switch( joint_constraint->getType() ) {
			case JointConstraint::Type::POSITION :
			{
				dv = jT.translation - cT.translation;
				dist += dv % dv;
			}
			break;

			case JointConstraint::Type::ORIENTATION :
			{
				dv = difference( jT.rotation, cT.rotation );
				dist += dv % dv;
			}
			break;

			case JointConstraint::Type::TRANSQ :
			{
				dv = jT.translation - cT.translation;
				dist += dv % dv;

				dv = difference( jT.rotation, cT.rotation );
				dist += dv % dv;
			}
			break;

			default :
			{
				assert( false );
			}
			break;
		}
	}

	if( IsDampingEnabled )
	{
		unsigned int jj=0;

		for( unsigned int j=0; j < NUM_JOINTS_IN_HUMAN; j++ )
		{
			Joint* joint = skeleton->getHumanJoint( j );
			if( joint )
			{
				double c = DampingCoeff[ j+1 ];
				unsigned int joint_dof = joint->getDOF();

				switch( joint_dof ) {
				case 6 :
					{
						dist += c*d[jj]*d[jj];	jj++;
						dist += c*d[jj]*d[jj];	jj++;
						dist += c*d[jj]*d[jj];	jj++;

						dist += c*d[jj]*d[jj];	jj++;
						dist += c*d[jj]*d[jj];	jj++;
						dist += c*d[jj]*d[jj];	jj++;
					}
					break;
				case 3 :
					{
						dist += c*d[jj]*d[jj];	jj++;
						dist += c*d[jj]*d[jj];	jj++;
						dist += c*d[jj]*d[jj];	jj++;
					}
					break;
				case 1 :
					{
						dist += c*d[jj]*d[jj];	jj++;
					}
					break;
				default :
					break;
				}
			}
//.........这里部分代码省略.........
开发者ID:lumigraph,项目名称:MotionOrbits,代码行数:101,代码来源:PoseIK.cpp


注:本文中的Joint::getDOF方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。