Exemplo n.º 1
0
void Quat4d::setAxisAngle( double radians, const Vector3d& axis )
{
	m_elements[ 0 ] = cos( radians / 2 );

	double sinHalfTheta = sin( radians / 2 );
	double vectorNorm = axis.abs();
	double reciprocalVectorNorm = 1.0 / vectorNorm;

	m_elements[ 1 ] = axis.x * sinHalfTheta * reciprocalVectorNorm;
	m_elements[ 2 ] = axis.y * sinHalfTheta * reciprocalVectorNorm;
	m_elements[ 3 ] = axis.z * sinHalfTheta * reciprocalVectorNorm;
}
Exemplo n.º 2
0
NIBBLETYPE GetLogMetaFromDirection(NIBBLETYPE a_BlockMeta, Vector3d a_Direction)
{
	a_Direction.abs();

	if ((a_Direction.y > a_Direction.x) && (a_Direction.y > a_Direction.z))
	{
		return a_BlockMeta;
	}
	else if (a_Direction.x > a_Direction.z)
	{
		return a_BlockMeta + 4;
	}
	else
	{
		return a_BlockMeta + 8;
	}
}