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


C++ Matrix3::GetTrans方法代码示例

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


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

示例1: CalcScale

static float CalcScale(INode *bone, NiNodeRef node, vector<NiNodeRef>& children)
{
   int n = bone->NumberOfChildren();
   if (n > 0) 
   {
      float len1 = 0.0f;
      float len2 = 0.0f;
      Matrix3 m = bone->GetNodeTM(0);
      Matrix3 m2 = TOMATRIX3(node->GetWorldTransform());
      for (int i = 0; i<n; i++)
      {
         INode *child = bone->GetChildNode(i);
         LPCTSTR name = child->GetName();
         if (HasBipedPosDOF(name))
            continue;

         Matrix3 cm = child->GetObjectTM(0);
         len1 += Length(m.GetTrans()-cm.GetTrans());

         if (NiNodeRef child2 = FindNodeByName(children, string(child->GetName()))){
            Matrix3 cm2 = TOMATRIX3(child2->GetWorldTransform());
            len2 += Length(m2.GetTrans()-cm2.GetTrans());
         }
      }
      return (len2 != 0.0f && len1 != 0.0f) ? (len2/len1) : 1.0f;
   }
   return 1.0f;
}
开发者ID:CruxAnsata,项目名称:max_nif_plugin,代码行数:28,代码来源:ImportSkeleton.cpp

示例2: GetWorldBoundBox

void PointHelpObject::GetWorldBoundBox(
		TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
	{

	if ( ! vpt || ! vpt->IsAlive() )
	{
		box.Init();
		return;
	}

	Matrix3 tm;
	tm = inode->GetObjectTM(t);
	Box3 lbox;

	GetLocalBoundBox(t, inode, vpt, lbox);
	box = Box3(tm.GetTrans(), tm.GetTrans());
	for (int i=0; i<8; i++) {
		box += lbox * tm;
		}
	/*
	if(!(extDispFlags & EXT_DISP_ZOOM_EXT) && showAxis)
		box = GetAxisBox(vpt,tm,showAxis?axisLength:0.0f, FALSE);
	else
		box = Box3(tm.GetTrans(), tm.GetTrans());
		*/
	}
开发者ID:mathieumg,项目名称:inf4715,代码行数:26,代码来源:pthelp.cpp

示例3: CalcLength

static float CalcLength(INode *bone)
{
   int n = bone->NumberOfChildren();
   float len = 0.0f;
   if (n > 0) 
   {
      Matrix3 m = bone->GetNodeTM(0);
      Point3 p = m.GetTrans();
      for (int i = 0; i<n; i++)
      {
         INode *child = bone->GetChildNode(i);
         Matrix3 cm = child->GetObjectTM(0);
         Point3 cp = cm.GetTrans();

         float clen = Length(p-cp);
         len += clen;
      }
      len /= float(n);
   }
   else
   {
      len = Length(GetLocalTM(bone).GetTrans());
   }
   return len;
}
开发者ID:CruxAnsata,项目名称:max_nif_plugin,代码行数:25,代码来源:ImportSkeleton.cpp

示例4: GetLocalBoundBox

void TapeHelpObject::GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
{
    if ( ! vpt || ! vpt->IsAlive() )
    {
        box.Init();
        return;
    }

    Matrix3 m = inode->GetObjectTM(t);
    Point3 pt;
    Point3 q[4];
    float scaleFactor = vpt->NonScalingObjectSize()*vpt->GetVPWorldWidth(m.GetTrans())/(float)360.0;
    box = mesh.getBoundingBox();
    box.Scale(scaleFactor);

    float d;
    if (GetTargetPoint(t,inode,pt)) {
        d = Length(m.GetTrans()-pt)/Length(inode->GetObjectTM(t).GetRow(2));
        box += Point3(float(0),float(0),-d);
    }
    if(GetSpecLen()) {
        GetLinePoints(t, q, GetLength(t) );
        box += q[0];
        box += q[1];
    }
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:26,代码来源:tapehelp.cpp

示例5: GetTargetPoint

void
SpotLightAttenuationManipulator::UpdateShapes(TimeValue t, TSTR& toolTip)
{
    GenLight* pLight = (GenLight*) mhTarget;

    Matrix3 tm;
    tm = mpINode->GetObjectTM(t);

    Point3 pt;
    b = GetTargetPoint(t, pt);

    if (!b)
        return;

    float dist = pLight->GetAtten(t, mAttenuationType);

    TSTR nodeName;
    nodeName = mpINode->GetName();

    float den = FLength(tm.GetRow(2));
    float targetDist = (den!=0) ? FLength(tm.GetTrans()-pt) / den : 0.0f;

    toolTip.printf("%s: %5.2f", mAttenName.data(), (double) dist);

    SetGizmoScale(targetDist / 40.0);

    ConeDistanceManipulator::UpdateShapes(Point3(0,0,0),
                                          Point3(0,0,-1),
                                          dist,
                                          pLight->GetFallsize(t),
                                          false);
}
开发者ID:2asoft,项目名称:xray,代码行数:32,代码来源:coneanglemanip.cpp

示例6: GetWorldBoundBox

//Get a bounding box.  This is used for when we display the formation continously.
void FormationBhvr::GetWorldBoundBox(TimeValue t, ViewExp *vpt, Box3& box)
{
	if ( ! vpt || ! vpt->IsAlive() )
	{
		box.Init();
		return;
	}

	//make sure we have everything we need...
	if(DisplayFormation(t)==FALSE) return;
	if(GetFollowerCount(t)<=0) return;
	if(GetFollowerMatrixCount(t)<=0) return; //possible to not have this set when the follower is set..

	INode *leaderNode;
	leaderNode = GetLeader(t);
	if(leaderNode==NULL) return;



	//for each follower we need to increase the bounding box by it's
	//world position location...
	for(int i =0;i<GetFollowerCount(t);i++)
	{
		if(GetFollower(t,i)) //if we have a a node...
		{
			Matrix3 worldSpace = GetFollowerMatrix(t,i)*GetCurrentMatrix(leaderNode,t);
			Point3 trans(worldSpace.GetTrans());
			//expand the box by the worldposition...
			box += trans;
		}
	}
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:33,代码来源:formation.cpp

示例7: Display

int SymmetryMod::Display (TimeValue t, INode* inode, ViewExp *vpt, int flagst, ModContext *mc) {

	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}


	GraphicsWindow *gw = vpt->getGW();
	Point3 pt[4];
	Matrix3 tm = CompMatrix(t,inode,mc);
	int savedLimits;

	gw->setRndLimits((savedLimits = gw->getRndLimits()) & ~GW_ILLUM);
	gw->setTransform(tm);
	if (mp_ip && mp_ip->GetSubObjectLevel() == 1) {
		gw->setColor(LINE_COLOR,GetUIColor(COLOR_SEL_GIZMOS));
	} else {
		gw->setColor(LINE_COLOR,GetUIColor(COLOR_GIZMOS));
	}
	
	DrawLineProc lp(gw);
	DrawGizmo (vpt->GetScreenScaleFactor(tm.GetTrans())*SCREEN_SCALE,lp);

	gw->setRndLimits(savedLimits);
	return 0;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:29,代码来源:Symmetry.cpp

示例8: DrawLine

// From BaseObject
int TapeHelpObject::DrawLine(TimeValue t, INode* inode, GraphicsWindow *gw, int drawing )
{
    Matrix3 tm = inode->GetObjectTM(t);
    gw->setTransform(tm);
    gw->clearHitCode();
    Point3 pt,v[3];
    if (GetTargetPoint(t,inode,pt)) {
        float den = Length(tm.GetRow(2));
        float dist = (den!=0)?Length(tm.GetTrans()-pt)/den : 0.0f;
        if(!inode->IsFrozen() && !inode->Dependent() && drawing)
            gw->setColor( LINE_COLOR, GetUIColor(COLOR_TAPE_OBJ));
        if (drawing) {
            if(specLenState) {
                GetLinePoints(t, v, GetLength(t) );
                if(drawing == -1)
                    v[1] = 0.9f * v[1];
            }
            else {
                v[0] = Point3(0,0,0);
                if(drawing == -1) // hit-testing!  Shorten the line so target can be picked
                    v[1] = Point3(0.0f, 0.0f, -0.9f * dist);
                else
                    v[1] = Point3(0.0f, 0.0f, -dist);
            }
            gw->polyline( 2, v, NULL, NULL, FALSE, NULL );
        }
    }
    return gw->checkHitCode();
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:30,代码来源:tapehelp.cpp

示例9: Force

Point3 PBombField::Force(TimeValue t,const Point3 &pos, const Point3 &vel,int index)
{	float d,chaos,dv;
	Point3 dlta,xb,yb,zb,center,expv;
	int decaytype,symm;
	Point3 zero=Zero;
		fValid = FOREVER;		
		if (!tmValid.InInterval(t)) 
		{	tmValid = FOREVER;
			tm = node->GetObjectTM(t,&tmValid);
			invtm = Inverse(tm);
		}
		xb=tm.GetRow(0);
		yb=tm.GetRow(1);
		zb=tm.GetRow(2);
		center=tm.GetTrans();
		fValid &= tmValid;
		TimeValue t0,t2,lastsfor;
		obj->pblock->GetValue(PB_STARTTIME,t,t0,fValid);
		obj->pblock->GetValue(PB_LASTSFOR,t,lastsfor,fValid);
		t2=t0+lastsfor;
		dlta=Zero;
		if ((t>=t0)&&(t<=t2))
		{ float L=Length(dlta=pos-center);
		  obj->pblock->GetValue(PB_DECAY,t,d,fValid);
		  obj->pblock->GetValue(PB_DECAYTYPE,t,decaytype,fValid);
		  if ((decaytype==0)||(L<=d))
		  { obj->pblock->GetValue(PB_DELTA_V,t,dv,fValid);
		    obj->pblock->GetValue(PB_CHAOS,t,chaos,fValid);
		    obj->pblock->GetValue(PB_SYMMETRY,t,symm,fValid);
		    Point3 r;
		    if (symm==SPHERE)
		      expv=(r=dlta/L);
	        else if (symm==PLANAR)
		    { L=DotProd(dlta,zb);
			  expv=(L<0.0f?L=-L,-zb:zb);
		    }
		    else
		    { Point3 E;
		      E=DotProd(dlta,xb)*xb+DotProd(dlta,yb)*yb;
		      L=Length(E);
		      expv=E/L;
		    }
		    dlta=(dv*expv)/(float)dtsq;
			if (decaytype==1)
			 dlta*=(d-L)/d;
			else if (decaytype==2)
			 dlta*=(1/(float)exp(L/d));
			if ((!FloatEQ0(chaos))&&(lastsfor==0.0f))
			{ float theta;
			  theta=HalfPI*chaos*RND01();
			  // Martell 4/14/01: Fix for order of ops bug.
			  float ztmp=RND11(); float ytmp=RND11(); float xtmp=RND11();
			  Point3 d=Point3(xtmp,ytmp,ztmp);
			  Point3 c=Normalize(dlta^d);
			  RotateOnePoint(&dlta.x,&zero.x,&c.x,theta);
			}
		  }	else dlta=Zero; 
		}
	return dlta;
	}
开发者ID:DimondTheCat,项目名称:xray,代码行数:60,代码来源:pbomb.cpp

示例10: GetSubObjectCenters

void MirrorMod::GetSubObjectCenters(
		SubObjAxisCallback *cb,TimeValue t,
		INode *node,ModContext *mc)
	{
	Matrix3 tm = CompMatrix(t,node,mc);	
	cb->Center(tm.GetTrans(),0);
	}
开发者ID:2asoft,项目名称:xray,代码行数:7,代码来源:mirror.cpp

示例11: Display

int MirrorMod::Display(
		TimeValue t, INode* inode, ViewExp *vpt, 
		int flagst, ModContext *mc)
	{
	GraphicsWindow *gw = vpt->getGW();
	Point3 pt[4];
	Matrix3 tm = CompMatrix(t,inode,mc);
	int savedLimits;

	gw->setRndLimits((savedLimits = gw->getRndLimits()) & ~GW_ILLUM);
	gw->setTransform(tm);
	if (ip && ip->GetSubObjectLevel() == 1) {
		//gw->setColor(LINE_COLOR, (float)1.0, (float)1.0, (float)0.0);
		gw->setColor(LINE_COLOR,GetUIColor(COLOR_SEL_GIZMOS));
	} else {
		//gw->setColor(LINE_COLOR, (float).85, (float).5, (float)0.0);
		gw->setColor(LINE_COLOR,GetUIColor(COLOR_GIZMOS));
		}
	
	DrawLineProc lp(gw);
	DrawGizmo(
		vpt->GetScreenScaleFactor(tm.GetTrans())*SCREEN_SCALE,lp);
	
	gw->setRndLimits(savedLimits);
	return 0;
	}
开发者ID:2asoft,项目名称:xray,代码行数:26,代码来源:mirror.cpp

示例12: ImportBase

bool CollisionImport::ImportBase(bhkRigidBodyRef body, bhkShapeRef shape, INode* parent, INode *shapeNode, Matrix3& tm)
{
	// Now do common post processing for the node
	if (shapeNode != NULL)
	{
		shapeNode->SetName( TSTR(shape->GetType().GetTypeName().c_str()) );

		if (!tm.IsIdentity())
		{
			Point3 pos = tm.GetTrans();
			Quat rot(tm);
			PosRotScaleNode(shapeNode, pos, rot, 1.0, prsDefault);
		}

		// Wireframe Red color
		StdMat2 *collMat = NewDefaultStdMat();
		collMat->SetDiffuse(Color(1.0f, 0.0f, 0.0f), 0);
		collMat->SetWire(TRUE);
		collMat->SetFaceted(TRUE);
		ni.gi->GetMaterialLibrary().Add(collMat);
		shapeNode->SetMtl(collMat);

		shapeNode->SetPrimaryVisibility(FALSE);
		shapeNode->SetSecondaryVisibility(FALSE);
		shapeNode->BoneAsLine(TRUE);
		shapeNode->SetRenderable(FALSE);
		//shapeNode->XRayMtl(TRUE);
		shapeNode->SetWireColor( RGB(255,0,0) );
		if (parent)
			parent->AttachChild(shapeNode);
		return true;
	}
	return false;
}
开发者ID:ElliotWood,项目名称:max_nif_plugin,代码行数:34,代码来源:ImportCollision.cpp

示例13: AxisViewportRect

void AxisViewportRect(ViewExp *vpt, const Matrix3 &tm, float length, Rect *rect)
	{
	Matrix3 tmn = tm;
	float zoom;
	IPoint3 wpt;
	Point3 pt;
	GraphicsWindow *gw = vpt->getGW();

	// Get width of viewport in world units:  --DS
	zoom = vpt->GetScreenScaleFactor(tmn.GetTrans())*ZFACT;
	
	tmn.Scale( Point3(zoom,zoom,zoom) );
	gw->setTransform( tmn );	
	pt = Point3(0.0f, 0.0f, 0.0f);
	gw->wTransPoint( &pt, &wpt );
	rect->left = rect->right  = wpt.x;
	rect->top  = rect->bottom = wpt.y;

	AxisRect( gw, Point3(length,0.0f,0.0f),rect );	
	AxisRect( gw, Point3(0.0f,length,0.0f),rect );	
	AxisRect( gw, Point3(0.0f,0.0f,length),rect );	

	rect->right  += 2;
	rect->bottom += 2;
	rect->left   -= 2;
	rect->top    -= 2;
	}
开发者ID:mathieumg,项目名称:inf4715,代码行数:27,代码来源:pthelp.cpp

示例14: RotQuat

void     makBoneTrans2(INode* pNode , sBoneTrans_t& boneTrans , Matrix3& mat)
{
	Point3   Trans = mat.GetTrans();
	Matrix3  RotMat = mat;
	Matrix3  ScaleMat = mat;

    RotMat.NoScale();
    ScaleMat = mat * Inverse(RotMat);
    //算出Scale Matrix;

	RotMat.NoTrans();	
	Quat RotQuat(RotMat);

	//ScaleMat.NoRot();
	//ScaleMat.NoTrans();

	boneTrans.m_Rotate    = conv_type<sQuat_t , Quat>(RotQuat);
	boneTrans.m_Trans     = conv_type<sVector_t   ,Point3 >(Trans);
	boneTrans.m_Scale.x   = ScaleMat.GetRow(0).x;
	boneTrans.m_Scale.y   = ScaleMat.GetRow(1).y;
	boneTrans.m_Scale.z   = ScaleMat.GetRow(2).z;
	if( abs(boneTrans.m_Scale.x - boneTrans.m_Scale.y) > 0.000001 ||
		abs(boneTrans.m_Scale.y - boneTrans.m_Scale.z) > 0.000001 ||
		abs(boneTrans.m_Scale.z - boneTrans.m_Scale.x) > 0.000001 )
	{
            std::wstring _NodeName = INodeName(pNode);
            XEVOL_LOG(eXL_DEBUG_HIGH , L"   {警告} :  骨头[ %s ] 的上有NonUniformScale\r\n", _NodeName.c_str() );
	}
}
开发者ID:YOlodfssdf,项目名称:evolution3d,代码行数:29,代码来源:ActionExporter.cpp

示例15: HitTest

int SymmetryMod::HitTest (TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc) {

	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}


	GraphicsWindow *gw = vpt->getGW();
	Point3 pt;
	HitRegion hr;
	int savedLimits, res = 0;
	Matrix3 tm = CompMatrix(t,inode,mc);

	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);	
	gw->setTransform(tm);
	gw->clearHitCode();
	DrawLineProc lp(gw);
	DrawGizmo(
		vpt->GetScreenScaleFactor(tm.GetTrans())*SCREEN_SCALE,lp);
	gw->setRndLimits(savedLimits);
	if (gw->checkHitCode()) {
		vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
		return 1;
		}
	return 0;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:31,代码来源:Symmetry.cpp


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