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


C++ C7Vector类代码示例

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


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

示例1: tr

void CQDlgTranslations::_setCoord_userUnit(float newValueInUserUnit,bool orientation,int index)
{
	int editMode=App::ct->objCont->getEditModeType();
	C3DObject* object=App::ct->objCont->getLastSelection();
	if ( (editMode==NO_EDIT_MODE)&&(object!=NULL) )
	{
		C7Vector tr;
		if (coordMode==0)
			tr=object->getCumulativeTransformationPart1();
		else
			tr=object->getLocalTransformationPart1();
		tr=_getNewTransf(tr,newValueInUserUnit,orientation,index);
		if (coordMode==0)
			object->setLocalTransformation(object->getParentCumulativeTransformation().getInverse()*tr);
		else
			object->setLocalTransformation(tr);
	}
	if ( (editMode&PATH_EDIT_MODE)&&(App::ct->objCont->editModeBuffer.size()!=0)&&(App::ct->objCont->_editionPath!=NULL) )
	{
		CPathCont* pathCont=App::ct->objCont->_editionPath;
		int ind=App::ct->objCont->editModeBuffer[App::ct->objCont->editModeBuffer.size()-1];
		CSimplePathPoint* pp=pathCont->getSimplePathPoint(ind);
		CPath* path=App::ct->objCont->getPath(App::ct->objCont->getEditModeObjectID());
		if ( (pp!=NULL)&&(path!=NULL) )
		{
			C7Vector tr(pp->getTransformation());
			if (coordMode==0)
				tr=path->getCumulativeTransformationPart1()*tr;
			tr=_getNewTransf(tr,newValueInUserUnit,orientation,index);
			if (coordMode==0)
				pp->setTransformation(path->getCumulativeTransformation().getInverse()*tr,pathCont->getAttributes());
			else
				pp->setTransformation(tr,pathCont->getAttributes());
			pathCont->actualizePath();
		}
	}
	if ( (editMode&VERTEX_EDIT_MODE)&&(App::ct->objCont->editModeBuffer.size()!=0) )
	{
		int ind=App::ct->objCont->editModeBuffer[App::ct->objCont->editModeBuffer.size()-1];
		C3Vector v(App::ct->objCont->_editionVertices[3*ind+0],App::ct->objCont->_editionVertices[3*ind+1],App::ct->objCont->_editionVertices[3*ind+2]);
		CShape* shape=App::ct->objCont->getShape(App::ct->objCont->getEditModeObjectID());
		if (shape!=NULL)
		{
			C7Vector tr;
			tr.setIdentity();
			tr.X=v;
			if (coordMode==0)
				tr=shape->getCumulativeTransformationPart1()*tr;
			tr=_getNewTransf(tr,newValueInUserUnit,orientation,index);
			if (coordMode==0)
				tr=shape->getCumulativeTransformation().getInverse()*tr;
			App::ct->objCont->_editionVertices[3*ind+0]=tr.X(0);
			App::ct->objCont->_editionVertices[3*ind+1]=tr.X(1);
			App::ct->objCont->_editionVertices[3*ind+2]=tr.X(2);
		}
	}
}
开发者ID:dtbinh,项目名称:vrep_altair,代码行数:57,代码来源:qdlgtranslations.cpp

示例2: getDownToTopTransformation

C7Vector CIKGraphJoint::getDownToTopTransformation()
{
	C7Vector retVal;
	retVal.setIdentity();
	if (jointType==IK_GRAPH_SPHERICAL_JOINT_TYPE)
		retVal.Q=sphericalTransformation;
	else if (jointType==IK_GRAPH_REVOLUTE_JOINT_TYPE)
		retVal.Q.setAngleAndAxis(parameter,C3Vector(0.0f,0.0f,1.0f));
	else if (jointType==IK_GRAPH_PRISMATIC_JOINT_TYPE)
		retVal.X(2)=parameter;
	return(retVal);
}
开发者ID:dtbinh,项目名称:vrep_altair,代码行数:12,代码来源:IKGraphJoint.cpp

示例3: simEmbSetObjectTransformation

int simEmbSetObjectTransformation(int objectHandle,int relativeToObjectHandle,const float* position,const float* quaternion)
{
	if (!hasLaunched())
		return(-1);
	// V-REP quaternion, internally: w x y z
	// V-REP quaternion, at interfaces: x y z w (like ROS)
	C3DObject* it=ct::objCont->getObject(objectHandle);
	if (it==NULL)
		return(-1);
	if (relativeToObjectHandle==sim_handle_parent)
	{
		relativeToObjectHandle=-1;
		C3DObject* parent=it->getParent();
		if (parent!=NULL)
			relativeToObjectHandle=parent->getID();
	}
	C3DObject* relObj=ct::objCont->getObject(relativeToObjectHandle);
	if (relativeToObjectHandle!=-1)
	{
		if (relObj==NULL)
			return(-1);
	}
	if (relativeToObjectHandle==-1)
	{
		C7Vector tr;
		tr.Q(0)=quaternion[3];
		tr.Q(1)=quaternion[0];
		tr.Q(2)=quaternion[1];
		tr.Q(3)=quaternion[2];
		tr.X(0)=position[0];
		tr.X(1)=position[1];
		tr.X(2)=position[2];
		ct::objCont->setAbsoluteConfiguration(it->getID(),tr,false);
	}
	else
	{
		C7Vector absTr(it->getCumulativeTransformationPart1());
		C7Vector relTr(relObj->getCumulativeTransformationPart1()); // added ..Part1 on 2010/06/14
		C7Vector x(relTr.getInverse()*absTr);
		x.Q(0)=quaternion[3];
		x.Q(1)=quaternion[0];
		x.Q(2)=quaternion[1];
		x.Q(3)=quaternion[2];
		x.X(0)=position[0];
		x.X(1)=position[1];
		x.X(2)=position[2];
		absTr=relTr*x;
		ct::objCont->setAbsoluteConfiguration(it->getID(),absTr,false);
	}
	return(1);
}
开发者ID:dtbinh,项目名称:summer_school_jul14,代码行数:51,代码来源:extIk.cpp

示例4: angle

C7Vector::C7Vector(float angle,const C3Vector& pos,const C3Vector& dir)
{ // Builds a rotation around dir at position pos of angle angle (in radians)
	C7Vector shift1;
	shift1.setIdentity();
	shift1.X(0)=-pos(0);
	shift1.X(1)=-pos(1);
	shift1.X(2)=-pos(2);
	C7Vector shift2;
	shift2.setIdentity();
	shift2.X=pos;
	C7Vector rot;
	rot.setIdentity();
	rot.Q.setAngleAndAxis(angle,dir);
	(*this)=shift2*rot*shift1;
}
开发者ID:ehsan1384,项目名称:Vrep,代码行数:15,代码来源:7Vector.cpp

示例5: targetM

void CikEl::checkIfWithinTolerance(bool& position,bool& orientation,bool useTempValues)
{
	position=true;
	orientation=true;
	CDummy* targetObj=Ct::ct->objCont->getDummy(getTarget());
	if (targetObj==NULL)
		return; // The tooltip is not constrained!
	CDummy* tooltipObj=Ct::ct->objCont->getDummy(tooltip);
	C7Vector targetM(targetObj->getCumulativeTransformationPart1(useTempValues));
	C7Vector tooltipM(tooltipObj->getCumulativeTransformationPart1(useTempValues));
 
	// Since everything is relative to the base
	C7Vector baseM;
	baseM.setIdentity();
	CDummy* baseObj=Ct::ct->objCont->getDummy(base);
	if (baseObj!=NULL)
		baseM=baseObj->getCumulativeTransformationPart1(useTempValues).getInverse();

	baseObj=Ct::ct->objCont->getDummy(alternativeBaseForConstraints);
	if (baseObj!=NULL)
		baseM=baseObj->getCumulativeTransformationPart1(useTempValues).getInverse();

	targetM=baseM*targetM;
	tooltipM=baseM*tooltipM;

	extIkReal err[2];
	getError(targetM.getMatrix(),tooltipM.getMatrix(),err,(constraints&sim_ik_x_constraint)!=0,
		(constraints&sim_ik_y_constraint)!=0,(constraints&sim_ik_z_constraint)!=0,
		(constraints&sim_ik_alpha_beta_constraint)!=0,(constraints&sim_ik_gamma_constraint)!=0);
	if (constraints&(sim_ik_x_constraint|sim_ik_y_constraint|sim_ik_z_constraint))
	{
		if (minLinearPrecision<err[0])
			position=false;
	}
	if (constraints&(sim_ik_alpha_beta_constraint|sim_ik_gamma_constraint))
	{
		if (minAngularPrecision<err[1])
			orientation=false;
	}
}
开发者ID:ClementLeBihan,项目名称:CelluleFlexible,代码行数:40,代码来源:ikEl.cpp

示例6: simEmbGetObjectTransformation

int simEmbGetObjectTransformation(int objectHandle,int relativeToObjectHandle,float* position,float* quaternion)
{
	if (!hasLaunched())
		return(-1);
	// V-REP quaternion, internally: w x y z
	// V-REP quaternion, at interfaces: x y z w (like ROS)
	C3DObject* it=ct::objCont->getObject(objectHandle);
	if (it==NULL)
		return(-1);
	if (relativeToObjectHandle==sim_handle_parent)
	{
		relativeToObjectHandle=-1;
		C3DObject* parent=it->getParent();
		if (parent!=NULL)
			relativeToObjectHandle=parent->getID();
	}
	C3DObject* relObj=ct::objCont->getObject(relativeToObjectHandle);
	if (relativeToObjectHandle!=-1)
	{
		if (relObj==NULL)
			return(-1);
	}
	C7Vector tr;
	if (relativeToObjectHandle==-1)
		tr=it->getCumulativeTransformationPart1();
	else
	{
		C7Vector relTr(relObj->getCumulativeTransformationPart1()); // added ..Part1 on 2010/06/14
		tr=relTr.getInverse()*it->getCumulativeTransformationPart1(); // Corrected bug on 2011/01/22: was getLocalTransformationPart1 before!!!
	}
	quaternion[0]=tr.Q(1);
	quaternion[1]=tr.Q(2);
	quaternion[2]=tr.Q(3);
	quaternion[3]=tr.Q(0);
	position[0]=tr.X(0);
	position[1]=tr.X(1);
	position[2]=tr.X(2);
	return(1);
}
开发者ID:dtbinh,项目名称:summer_school_jul14,代码行数:39,代码来源:extIk.cpp

示例7: simEmbRotateAroundAxis

int simEmbRotateAroundAxis(const float* positionIn,const float* quaternionIn,const float* axisVector,const float* axisPosition,float angle,float* positionOut,float* quaternionOut)
{
	if (!hasLaunched())
		return(-1);
	// V-REP quaternion, internally: w x y z
	// V-REP quaternion, at interfaces: x y z w (like ROS)
	C7Vector m;
	m.Q(0)=quaternionIn[3];
	m.Q(1)=quaternionIn[0];
	m.Q(2)=quaternionIn[1];
	m.Q(3)=quaternionIn[2];
	m.X(0)=positionIn[0];
	m.X(1)=positionIn[1];
	m.X(2)=positionIn[2];

	C3Vector ax(axisVector);
	C3Vector pos(axisPosition);

	float alpha=-atan2(ax(1),ax(0));
	float beta=atan2(-sqrt(ax(0)*ax(0)+ax(1)*ax(1)),ax(2));
	m.X-=pos;
	C7Vector r;
	r.X.clear();
	r.Q.setEulerAngles(0.0f,0.0f,alpha);
	m=r*m;
	r.Q.setEulerAngles(0.0f,beta,0.0f);
	m=r*m;
	r.Q.setEulerAngles(0.0f,0.0f,angle);
	m=r*m;
	r.Q.setEulerAngles(0.0f,-beta,0.0f);
	m=r*m;
	r.Q.setEulerAngles(0.0f,0.0f,-alpha);
	m=r*m;
	m.X+=pos;

	quaternionOut[0]=m.Q(1);
	quaternionOut[1]=m.Q(2);
	quaternionOut[2]=m.Q(3);
	quaternionOut[3]=m.Q(0);
	positionOut[0]=m.X(0);
	positionOut[1]=m.X(1);
	positionOut[2]=m.X(2);
	return(1);
}
开发者ID:dtbinh,项目名称:summer_school_jul14,代码行数:44,代码来源:extIk.cpp

示例8: simEmbInvertTransformation

int simEmbInvertTransformation(float* position,float* quaternion)
{
	if (!hasLaunched())
		return(-1);
	// V-REP quaternion, internally: w x y z
	// V-REP quaternion, at interfaces: x y z w (like ROS)
	C7Vector tr;
	tr.Q(0)=quaternion[3];
	tr.Q(1)=quaternion[0];
	tr.Q(2)=quaternion[1];
	tr.Q(3)=quaternion[2];
	tr.X(0)=position[0];
	tr.X(1)=position[1];
	tr.X(2)=position[2];
	tr.inverse();
	quaternion[0]=tr.Q(1);
	quaternion[1]=tr.Q(2);
	quaternion[2]=tr.Q(3);
	quaternion[3]=tr.Q(0);
	position[0]=tr.X(0);
	position[1]=tr.X(1);
	position[2]=tr.X(2);
	return(1);
}
开发者ID:dtbinh,项目名称:summer_school_jul14,代码行数:24,代码来源:extIk.cpp

示例9: simEmbMultTransformationWithVector

int simEmbMultTransformationWithVector(const float* position,const float* quaternion,float* vect)
{
	if (!hasLaunched())
		return(-1);
	// V-REP quaternion, internally: w x y z
	// V-REP quaternion, at interfaces: x y z w (like ROS)
	C7Vector tr;
	tr.Q(0)=quaternion[3];
	tr.Q(1)=quaternion[0];
	tr.Q(2)=quaternion[1];
	tr.Q(3)=quaternion[2];
	tr.X(0)=position[0];
	tr.X(1)=position[1];
	tr.X(2)=position[2];

	C3Vector v1(vect);

	C3Vector v2(tr*v1);

	vect[0]=v2(0);
	vect[1]=v2(1);
	vect[2]=v2(2);
	return(1);
}
开发者ID:dtbinh,项目名称:summer_school_jul14,代码行数:24,代码来源:extIk.cpp

示例10: _copyTransf

void CQDlgTranslations::_copyTransf(const C7Vector& tr,C7Vector& trIt,bool orientation,int mask)
{
	if (orientation)
		trIt.Q=tr.Q;
	else
	{
		if (mask&1)
			trIt.X(0)=tr.X(0);
		if (mask&2)
			trIt.X(1)=tr.X(1);
		if (mask&4)
			trIt.X(2)=tr.X(2);
	}
}
开发者ID:dtbinh,项目名称:vrep_altair,代码行数:14,代码来源:qdlgtranslations.cpp

示例11: _transform

void CQDlgTranslations::_transform(C7Vector& tr,int t,bool self)
{ // t==0: rotation, t==1: translation, t==2: scaling
	if (t==2)
	{
		tr.X(0)=tr.X(0)*scalingValues[0];
		tr.X(1)=tr.X(1)*scalingValues[1];
		tr.X(2)=tr.X(2)*scalingValues[2];
	}
	else
	{
		C7Vector m;
		m.setIdentity();
		if (t==0)
			m.Q.setEulerAngles(rotAngles[0],rotAngles[1],rotAngles[2]);
		if (t==1)
			m.X.set(translationValues);
		if (self)
			tr=tr*m;
		else
			tr=m*tr;
	}
}
开发者ID:dtbinh,项目名称:vrep_altair,代码行数:22,代码来源:qdlgtranslations.cpp

示例12: simEmbInterpolateTransformations

int simEmbInterpolateTransformations(const float* position1,const float* quaternion1,const float* position2,const float* quaternion2,float interpolFactor,float* positionOut,float* quaternionOut)
{
	if (!hasLaunched())
		return(-1);
	// V-REP quaternion, internally: w x y z
	// V-REP quaternion, at interfaces: x y z w (like ROS)
	C7Vector tr1;
	tr1.Q(0)=quaternion1[3];
	tr1.Q(1)=quaternion1[0];
	tr1.Q(2)=quaternion1[1];
	tr1.Q(3)=quaternion1[2];
	tr1.X(0)=position1[0];
	tr1.X(1)=position1[1];
	tr1.X(2)=position1[2];

	C7Vector tr2;
	tr2.Q(0)=quaternion2[3];
	tr2.Q(1)=quaternion2[0];
	tr2.Q(2)=quaternion2[1];
	tr2.Q(3)=quaternion2[2];
	tr2.X(0)=position2[0];
	tr2.X(1)=position2[1];
	tr2.X(2)=position2[2];

	C7Vector trOut;
	trOut.buildInterpolation(tr1,tr2,interpolFactor);

	quaternionOut[0]=trOut.Q(1);
	quaternionOut[1]=trOut.Q(2);
	quaternionOut[2]=trOut.Q(3);
	quaternionOut[3]=trOut.Q(0);
	positionOut[0]=trOut.X(0);
	positionOut[1]=trOut.X(1);
	positionOut[2]=trOut.X(2);
	return(1);
}
开发者ID:dtbinh,项目名称:summer_school_jul14,代码行数:36,代码来源:extIk.cpp

示例13: oldMatrInv

void CikEl::prepareIkEquations(extIkReal interpolFact)
{	// Before calling this function, make sure that joint's temp. param. are initialized!
	// Make also sure the tooltip is built on a joint before 'base' and that base
	// is parent of 'tooltip'.
	// interpolFact is the interpolation factor we use to compute the target pose:
	// interpolPose=tooltipPose*(1-interpolFact)+targetPose*interpolFact

	// We first take care of dummies linked to path objects in a "sliding" manner (not fixed but assigned to the path):
	// Case 1. Target is the free sliding dummy:
	CDummy* dummyObj=Ct::ct->objCont->getDummy(getTarget());
	CDummy* tipObj=Ct::ct->objCont->getDummy(tooltip);

	// We get the jacobian and the rowJointIDs:
	rowJointIDs=new std::vector<int>;
	rowJointStages=new std::vector<int>;
	C4X4Matrix oldMatr;
	CMatrix* Ja=CIkRoutine::getJacobian(this,oldMatr,rowJointIDs,rowJointStages);

	// oldMatr now contains the cumulative transf. matr. of tooltip relative to base
	C4X4Matrix oldMatrInv(oldMatr.getInverse());
	int doF=Ja->cols;
	int equationNumber=0;

	C4X4Matrix dummyCumul;
	C4X4Matrix m;
	if (dummyObj!=NULL)
	{
		C3DObject* baseObj=Ct::ct->objCont->getObject(base);
		C4X4Matrix baseCumul;
		baseCumul.setIdentity();
		if (baseObj!=NULL)
			baseCumul=baseObj->getCumulativeTransformation(true).getMatrix();

		baseObj=Ct::ct->objCont->getObject(alternativeBaseForConstraints);
		if (baseObj!=NULL)
			baseCumul=baseObj->getCumulativeTransformation(true).getMatrix();

		baseCumul.inverse();

		dummyCumul=dummyObj->getCumulativeTransformationPart1(true).getMatrix();
		dummyCumul=baseCumul*dummyCumul; // target is relative to the base (or the alternative base)!
		C7Vector tr;
		tr.buildInterpolation(oldMatr.getTransformation(),dummyCumul.getTransformation(),interpolFact);
		m=tr;

		// We prepare matrix and errorVector and their respective sizes:
		if (constraints&sim_ik_x_constraint)
			equationNumber++;
		if (constraints&sim_ik_y_constraint)
			equationNumber++;
		if (constraints&sim_ik_z_constraint)
			equationNumber++;
		if (constraints&sim_ik_alpha_beta_constraint)
			equationNumber+=2;
		if (constraints&sim_ik_gamma_constraint)
			equationNumber++;
	}

	matrix=new CMatrix(equationNumber,doF);
	matrix_correctJacobian=new CMatrix(equationNumber,doF);
	errorVector=new CMatrix(equationNumber,1);
	if (dummyObj!=NULL)
	{
		// We set up the position/orientation errorVector and the matrix:
		int pos=0;
		if (constraints&sim_ik_x_constraint)
		{
			for (int i=0;i<doF;i++)
			{
				(*matrix)(pos,i)=(*Ja)(0,i);
				(*matrix_correctJacobian)(pos,i)=(*Ja)(0,i);
			}
			(*errorVector)(pos,0)=(m.X(0)-oldMatr.X(0))*positionWeight;
			pos++;
		}
		if (constraints&sim_ik_y_constraint)
		{
			for (int i=0;i<doF;i++)
			{
				(*matrix)(pos,i)=(*Ja)(1,i);
				(*matrix_correctJacobian)(pos,i)=(*Ja)(1,i);
			}
			(*errorVector)(pos,0)=(m.X(1)-oldMatr.X(1))*positionWeight;
			pos++;
		}
		if (constraints&sim_ik_z_constraint)
		{
			for (int i=0;i<doF;i++)
			{
				(*matrix)(pos,i)=(*Ja)(2,i);
				(*matrix_correctJacobian)(pos,i)=(*Ja)(2,i);
			}
			(*errorVector)(pos,0)=(m.X(2)-oldMatr.X(2))*positionWeight;
			pos++;
		}
		if ( (constraints&sim_ik_alpha_beta_constraint)&&(constraints&sim_ik_gamma_constraint) )
		{
			for (int i=0;i<doF;i++)
			{
				(*matrix)(pos,i)=(*Ja)(3,i);
//.........这里部分代码省略.........
开发者ID:ClementLeBihan,项目名称:CelluleFlexible,代码行数:101,代码来源:ikEl.cpp

示例14: return

CMatrix* CIkRoutine::getJacobian(CikEl* ikElement,C4X4Matrix& tooltipTransf,std::vector<int>* rowJointIDs,std::vector<int>* rowJointStages)
{	// rowJointIDs is NULL by default. If not null, it will contain the ids of the joints
	// corresponding to the rows of the jacobian.
	// Return value NULL means that is ikElement is either inactive, either invalid
	// tooltipTransf is the cumulative transformation matrix of the tooltip,
	// computed relative to the base!
	// The temporary joint parameters need to be initialized before calling this function!
	// We check if the ikElement's base is in the chain and that tooltip is valid!
	CDummy* tooltip=ct::objCont->getDummy(ikElement->getTooltip());
	if (tooltip==NULL)
	{ // Should normally never happen!
		ikElement->setActive(false);
		return(NULL);
	}
	C3DObject* base=ct::objCont->getObject(ikElement->getBase());
	if ( (base!=NULL)&&(!tooltip->isObjectParentedWith(base)) )
	{ // This case can happen (when the base's parenting was changed for instance)
		ikElement->setBase(-1);
		ikElement->setActive(false);
		return(NULL);
	}

	// We check the number of degrees of freedom and prepare the rowJointIDs vector:
	C3DObject* iterat=tooltip;
	int doF=0;
	while (iterat!=base)
	{
		iterat=iterat->getParent();
		if ( (iterat!=NULL)&&(iterat!=base) )
		{
			if (iterat->getObjectType()==sim_object_joint_type)
			{
				if ( (((CJoint*)iterat)->getJointMode()==sim_jointmode_ik)||(((CJoint*)iterat)->getJointMode()==sim_jointmode_ikdependent) )
				{
					int d=((CJoint*)iterat)->getDoFs();
					for (int i=d-1;i>=0;i--)
					{
						if (rowJointIDs!=NULL)
						{
							rowJointIDs->push_back(iterat->getID());
							rowJointStages->push_back(i);
						}
					}
					doF+=d;
				}
			}
		}
	}
	CMatrix* J=new CMatrix(6,(unsigned char)doF);
	std::vector<C4X4FullMatrix*> jMatrices;
	for (int i=0;i<(doF+1);i++)
	{
		C4X4FullMatrix* matr=new C4X4FullMatrix();
		if (i==0)
			(*matr).setIdentity();
		else
			(*matr).clear();
		jMatrices.push_back(matr);
	}

	// Now we go from tip to base:
	iterat=tooltip;
	C4X4FullMatrix buff;
	buff.setIdentity();
	int positionCounter=0;
	C4X4FullMatrix d0;
	C4X4FullMatrix dp;
	C4X4FullMatrix paramPart;
	CJoint* lastJoint=NULL;
	int indexCnt=-1;
	int indexCntLast=-1;
	while (iterat!=base)
	{
		C3DObject* nextIterat=iterat->getParent();
		C7Vector local;
		if (iterat->getObjectType()==sim_object_joint_type)
		{
			if ( (((CJoint*)iterat)->getJointMode()!=sim_jointmode_ik)&&(((CJoint*)iterat)->getJointMode()!=sim_jointmode_ikdependent) )
				local=iterat->getLocalTransformation(true);
			else
			{
				CJoint* it=(CJoint*)iterat;
				if (it->getJointType()==sim_joint_spherical_subtype)
				{
					if (indexCnt==-1)
						indexCnt=it->getDoFs()-1;
					it->getLocalTransformationExPart1(local,indexCnt--,true);
					if (indexCnt!=-1)
						nextIterat=iterat; // We keep the same object! (but indexCnt has decreased)
				}
				else
					local=iterat->getLocalTransformationPart1(true);
			}
		}
		else
			local=iterat->getLocalTransformation(true); 

		buff=C4X4FullMatrix(local.getMatrix())*buff;
		iterat=nextIterat;
		bool activeJoint=false;
//.........这里部分代码省略.........
开发者ID:dtbinh,项目名称:summer_school_jul14,代码行数:101,代码来源:ikRoutine.cpp

示例15: while

void CQDlgTranslations::_applyTransformation(int t)
{ // t==0: rotation, t==1: translation, t==2: scaling
	int editMode=App::ct->objCont->getEditModeType();
	int objSelSize=App::ct->objCont->getSelSize();
	int editObjSelSize=App::ct->objCont->editModeBuffer.size();
	if ( (editMode==NO_EDIT_MODE)&&(objSelSize>0) )
	{
		for (int i=0;i<objSelSize;i++)
		{
			C3DObject* object=App::ct->objCont->getObject(App::ct->objCont->getSelID(i));
			bool hasParentPresent=false;
			if ((transfMode==0)&&(t!=2)) // scaling is different!
			{ // We do a transformation relative to the world. If this object has a parent that also is selected, we don't process this object!
				C3DObject* p=object->getParent();
				while (p!=NULL)
				{
					for (int j=0;j<objSelSize;j++)
					{
						if (App::ct->objCont->getSelID(j)==p->getID())
						{
							hasParentPresent=true;
							break;
						}
					}
					if (hasParentPresent)
						break;
					p=p->getParent();
				}
			}
			if (!hasParentPresent)
			{
				C7Vector tr;
				if (transfMode==0)
					tr=object->getCumulativeTransformationPart1();
				else
					tr=object->getLocalTransformationPart1();
				_transform(tr,t,transfMode==2);
				if (transfMode==0)
					tr=object->getParentCumulativeTransformation().getInverse()*tr;
				object->setLocalTransformation(tr);
			}
		}
	}
	if ( (editMode&PATH_EDIT_MODE)&&(editObjSelSize>0)&&(App::ct->objCont->_editionPath!=NULL) )
	{
		CPathCont* pathCont=App::ct->objCont->_editionPath;
		CPath* path=App::ct->objCont->getPath(App::ct->objCont->getEditModeObjectID());
		for (int i=0;i<editObjSelSize;i++)
		{
			CSimplePathPoint* pp=pathCont->getSimplePathPoint(App::ct->objCont->editModeBuffer[i]);
			if ( (pp!=NULL)&&(path!=NULL) )
			{
				C7Vector tr(pp->getTransformation());
				if (transfMode==0)
					tr=path->getCumulativeTransformationPart1()*tr;
				_transform(tr,t,transfMode==2);
				if (transfMode==0)
					tr=path->getCumulativeTransformationPart1().getInverse()*tr;
				pp->setTransformation(tr,pathCont->getAttributes());
			}
		}
		pathCont->actualizePath();
	}
	if ( (editMode&VERTEX_EDIT_MODE)&&(editObjSelSize>0) )
	{
		CShape* shape=App::ct->objCont->getShape(App::ct->objCont->getEditModeObjectID());
		if (shape!=NULL)
		{
			for (int i=0;i<editObjSelSize;i++)
			{
				C7Vector tr;
				tr.setIdentity();
				int ind=App::ct->objCont->editModeBuffer[i];
				tr.X.set(&App::ct->objCont->_editionVertices[3*ind+0]);
				if (transfMode==0)
					tr=shape->getCumulativeTransformationPart1()*tr;
				_transform(tr,t,transfMode==2);
				if (transfMode==0)
					tr=shape->getCumulativeTransformationPart1().getInverse()*tr;
				App::ct->objCont->_editionVertices[3*ind+0]=tr.X(0);
				App::ct->objCont->_editionVertices[3*ind+1]=tr.X(1);
				App::ct->objCont->_editionVertices[3*ind+2]=tr.X(2);
			}
		}
	}
}
开发者ID:dtbinh,项目名称:vrep_altair,代码行数:86,代码来源:qdlgtranslations.cpp


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