⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eulerangles.h

📁 3D数学基础:图形与游戏开发书籍源码,里面有很多实用的代码,对做3D的同志很有意义
💻 H
字号:
/////////////////////////////////////////////////////////////////////////////
//
// 3D Math Primer for Games and Graphics Development
//
// EulerAngles.h - Declarations for class EulerAngles
//
// Visit gamemath.com for the latest version of this file.
//
// For more details, see EulerAngles.cpp
//
/////////////////////////////////////////////////////////////////////////////

#ifndef __EULERANGLES_H_INCLUDED__
#define __EULERANGLES_H_INCLUDED__

// Forward declarations

class Quaternion;
class Matrix4x3;
class RotationMatrix;

//---------------------------------------------------------------------------
// class EulerAngles
//
// This class represents a heading-pitch-bank Euler angle triple.

class EulerAngles {
public:

// Public data

	// Straightforward representation.  Store the three angles, in
	// radians

	float	heading;
	float	pitch;
	float	bank;

// Public operations

	// Default constructor does nothing

	EulerAngles() {}

	// Construct from three values

	EulerAngles(float h, float p, float b) :
		heading(h), pitch(p), bank(b) {}

	// Set to identity triple (all zeros)

	void	identity() { pitch = bank = heading = 0.0f; }

	// Determine "canonical" Euler angle triple

	void	canonize();

	// Convert the quaternion to Euler angle format.  The input quaternion
	// is assumed to perform the rotation from object-to-inertial
	// or inertial-to-object, as indicated.

	void	fromObjectToInertialQuaternion(const Quaternion &q);
	void	fromInertialToObjectQuaternion(const Quaternion &q);

	// Convert the transform matrix to Euler angle format.  The input
	// matrix is assumed to perform the transformation from
	// object-to-world, or world-to-object, as indicated.  The
	// translation portion of the matrix is ignored.  The
	// matrix is assumed to be orthogonal.

	void	fromObjectToWorldMatrix(const Matrix4x3 &m);
	void	fromWorldToObjectMatrix(const Matrix4x3 &m);

	// Convert a rotation matrix to Euler Angle form.

	void	fromRotationMatrix(const RotationMatrix &m);
};

// A global "identity" Euler angle constant

extern const EulerAngles kEulerAnglesIdentity;

/////////////////////////////////////////////////////////////////////////////
#endif // #ifndef __EULERANGLES_H_INCLUDED__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -