Exemplo n.º 1
0
	void Orientation::RollGlobal(float p_angle)
	{
		if(p_angle == 0.0f)
			return;
		quat rotation(cos(radians(p_angle)/2), 0, 0, sin(radians(p_angle)/2));
		RotateGlobal(rotation);
	}
Exemplo n.º 2
0
	void Orientation::RotateGlobal(float p_angle, vec3 p_axis)
	{
		if(p_angle == 0)
			return;
		p_axis = normalize(p_axis);
		float tmp = sin(radians(p_angle)/2);
		quat rotation(cos(radians(p_angle) / 2), p_axis.x * tmp, p_axis.y * tmp, p_axis.z * tmp);
		RotateGlobal(rotation);
	}
Exemplo n.º 3
0
// Constructor
Matrix::Matrix (Quaternion& quat, bool rightHanded)
{
	this->SetToIdentity();

	// extract the angle: 
	//		w coordinate = cos (angle/2), in radians
	float fHalfAngle = acosf (quat.w);
	float fAngle = 2 * fHalfAngle * MATH_TRIG_RADIANS_TO_DEGREES;
	if (!rightHanded)
		fAngle *= -1;

	// rotate
	RotateGlobal (Vector (quat.x, quat.y, quat.z).Normalize(), fAngle);
}
Exemplo n.º 4
0
	void Orientation::SetOrientation(float p_angle, vec3 p_axis)
	{
		m_orientation = quat(1.0f, 0.0f, 0.0f, 0.0f);
		RotateGlobal(p_angle, p_axis);
	}
Exemplo n.º 5
0
	void Orientation::SetOrientation(float p_rotationX, float p_rotationY, float p_rotationZ)
	{
		m_orientation = quat(1.0f, 0.0f, 0.0f, 0.0f);
		RotateGlobal(p_rotationX, p_rotationY, p_rotationZ);
	}