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


C++ Matrix3x3::getColumn方法代码示例

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


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

示例1: setRotation

void Node::setRotation( const Matrix3x3& rotation )
{
	assert( rotation.getColumn(0).finite() );
	assert( rotation.getColumn(1).finite() );
	assert( rotation.getColumn(2).finite() );
	assert( ( rotation.getColumn(0).cross(rotation.getColumn(1)) ).dot( rotation.getColumn(2) ) > 0.f ); // Left handed coordinate system?

	m_localTransform.setRotation( rotation );
	m_flags |= NODE_WORLDTMDIRTY;
}
开发者ID:TheRyaz,项目名称:c_reading,代码行数:10,代码来源:Node.cpp

示例2: getSquaredScale

/** Returns maximum column length squared. */
static Vector3 getSquaredScale( const Matrix3x3& m )
{
	Vector3 scalev;
	for ( int i = 0 ; i < 3 ; ++i )
	{
		float lensqr = m.getColumn(i).lengthSquared();
		scalev[i] = lensqr;
	}
	return scalev;
}
开发者ID:TheRyaz,项目名称:c_reading,代码行数:11,代码来源:AnimExportUtil.cpp

示例3: resampleRotationKeys

/** 
 * Resamples animation until maximum error is smaller than specified angle (radians). 
 * @param maxErr Maximum absolute error (radians).
 */
static void resampleRotationKeys( KeyFrameContainer& anim, Interval range, float maxErr, const Vector<Matrix4x4>& tm )
{
	TimeValue dticks = SGEXPORT_TICKS_PER_SAMPLE;
	int frame = range.Start() / dticks;
	require( frame >= 0 && frame < tm.size() );
	TimeValue rangeLen = (range.Duration()/SGEXPORT_TICKS_PER_SAMPLE)*SGEXPORT_TICKS_PER_SAMPLE;

	for ( TimeValue ticks = range.Start() ; ticks < range.End() ; ticks += dticks )
	{
		if ( ticks > range.End() )
			ticks = range.End();

		// find out error (distance) between real and sampled animation
		require( frame >= 0 && frame < tm.size() );
		const Matrix4x4& m = tm[frame++];
		Matrix3x3 ref = m.rotation().orthonormalize();
		float q[4];
		anim.getValue( TicksToSec(ticks), q, 4 );
		Matrix3x3 cmp( Quaternion(q[0],q[1],q[2],q[3]) );
		float xang = Math::abs( Math::acos( clamp(cmp.getColumn(0).dot(ref.getColumn(0)), -1.f, 1.f) ) );
		float yang = Math::abs( Math::acos( clamp(cmp.getColumn(1).dot(ref.getColumn(1)), -1.f, 1.f) ) );
		float zang = Math::abs( Math::acos( clamp(cmp.getColumn(2).dot(ref.getColumn(2)), -1.f, 1.f) ) );
		float err = xang;
		if ( yang > err )
			err = yang;
		if ( zang > err )
			err = zang;

		// sample more accurately if needed
		if ( err > maxErr && rangeLen > dticks )
		{
			TimeValue halfRange = alignTicks( (range.End() + range.Start())/2 );
			AnimExportUtil::addRotationKey( anim, tm[halfRange/dticks], TicksToSec(halfRange) );
			if ( ticks <= halfRange )
				resampleRotationKeys( anim, Interval(range.Start(),halfRange), maxErr, tm );
			else
				resampleRotationKeys( anim, Interval(halfRange,range.End()), maxErr, tm );
		}

		if ( ticks == range.End() )
			break;
	}
}
开发者ID:TheRyaz,项目名称:c_reading,代码行数:47,代码来源:AnimExportUtil.cpp

示例4: Render


//.........这里部分代码省略.........
		}

		Matrix3x3 colABCs = ssii*tcols;
		colABCs = colABCs.transpose();

		//Z buffer interpolation
		Vector3D tzs = Vector3D(projVerts[vinds[0]][2], projVerts[vinds[1]][2], projVerts[vinds[2]][2]);
		Vector3D zABC = ssii * tzs;

		//Normal interpolation
		
		Matrix3x3 tnormals = Matrix3x3();
		Matrix3x3 normalABCs = Matrix3x3();
		if(normals != NULL){
			tnormals[0] = normals[vinds[0]];
			tnormals[1] = normals[vinds[1]];
			tnormals[2] = normals[vinds[2]];
			normalABCs = ssii*tnormals;
			normalABCs = normalABCs.transpose();
		}

		//Model Space Interpolation
		Matrix3x3 camM;
		camM.setColumn(0,ppc->a);
		camM.setColumn(1,ppc->b);
		camM.setColumn(2,ppc->c);
		Matrix3x3 triM;
		triM.setColumn(0, verts[vinds[0]] - ppc->C);
		triM.setColumn(1, verts[vinds[1]] - ppc->C);
		triM.setColumn(2, verts[vinds[2]] - ppc->C);
		Matrix3x3 Q = triM.inverse() * camM;
		Vector3D DEF = Q[0] + Q[1] + Q[2];
		Vector3D ABCr = Vector3D(
			tcols.getColumn(0) * Q.getColumn(0), 
			tcols.getColumn(0) * Q.getColumn(1), 
			tcols.getColumn(0) * Q.getColumn(2));
		Vector3D ABCg = Vector3D(
			tcols.getColumn(1) * Q.getColumn(0), 
			tcols.getColumn(1) * Q.getColumn(1), 
			tcols.getColumn(1) * Q.getColumn(2)); 
		Vector3D ABCb = Vector3D(
			tcols.getColumn(2) * Q.getColumn(0), 
			tcols.getColumn(2) * Q.getColumn(1), 
			tcols.getColumn(2) * Q.getColumn(2));
		Vector3D ABCk = Vector3D(Q[1]);
		Vector3D ABCl = Vector3D(Q[2]);

		Matrix3x3 tst = Matrix3x3();
		Vector3D ABCs, ABCt;

		if(textured){
			tst[0] = st[vinds[0]];
			tst[1] = st[vinds[1]];
			tst[2] = st[vinds[2]];
			ABCs = Vector3D(
				tst.getColumn(0) * Q.getColumn(0), 
				tst.getColumn(0) * Q.getColumn(1), 
				tst.getColumn(0) * Q.getColumn(2));
			ABCt = Vector3D(
				tst.getColumn(1) * Q.getColumn(0), 
				tst.getColumn(1) * Q.getColumn(1), 
				tst.getColumn(1) * Q.getColumn(2));
		}


		//Rasterization
开发者ID:ehissey,项目名称:CS434-1,代码行数:67,代码来源:tmesh.cpp


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