Ejemplo n.º 1
0
cVector3 cQuaternion::Axis()
{
	float om2 = 1.f - ( w * w );
	if ( om2 < 10.f * FLT_EPSILON )
	{
		return cVector3( 0.f, 1.f, 0.f );
	}
	float om = nMath::InverseSqrt( om2 );
	return cVector3( x*om, y*om, z*om );
}
Ejemplo n.º 2
0
cVector3 cQuaternion::GetLocalZAxis() const
{
	return cVector3( 
		2.f*( x*z + y*w ),
		2.f*( y*z - x*w ),
		1.f - 2.f*( x*x + y*y ) );
	/*cQuaternion rq( y, -x, w, z );
	rq = (*this)*rq;
	return cVector3( rq.x, rq.y, rq.z );*/
}
Ejemplo n.º 3
0
cVector3 cQuaternion::GetLocalYAxis() const
{
	return cVector3( 
		2.f*( x*y - z*w ), 
		1.f - 2.f*( x*x + z*z ),
		2.f*( y*z + x*w ) );
	/*cQuaternion rq( -z, w, x, y );
	rq = (*this)*rq;
	return cVector3( rq.x, rq.y, rq.z );*/
}
Ejemplo n.º 4
0
cVector3 cQuaternion::GetLocalXAxis() const
{
	return cVector3( 
		1.f - 2.f*( y*y + z*z ), 
		2.f*( x*y + z*w ), 
		2.f*( x*z - y*w ) );

	/*cQuaternion rq( w, z, -y, x );
	rq = (*this)*rq;
	return cVector3( rq.x, rq.y, rq.z );*/
}
Ejemplo n.º 5
0
cVector3 cQuaternion::AppliedTo( const cVector3& v )
{
	cQuaternion vq, rq;
	vq.x = v.x;
	vq.y = v.y;
	vq.z = v.z;
	vq.w = 0.0f;
	rq = vq*Conjugate();
	rq = *this * rq;

	return cVector3( rq.x, rq.y, rq.z );
}
Ejemplo n.º 6
0
void cTankWars2005::initializeViewpoint(cCritterViewer *pviewer)
{
   /**************Flattens out 3D John P. Harris *************************/
	pviewer->setViewpoint(cVector3(0.0, 0.0, 0.0), _border.center());
}
Ejemplo n.º 7
0
cVector3 cMatrix3x3::GetCol( int j ) const
{
	return cVector3( m[j], m[j+3], m[j+6] );
}
Ejemplo n.º 8
0
cVector3 cMatrix3x3::GetRow( int i ) const
{
	int j = i*3;
	return cVector3( m[j], m[j+1], m[j+2] );
}
Ejemplo n.º 9
0
cVector3 cMatrix3x3::GetDiagonals() const
{
	return cVector3( m00, m11, m22 );
}