📄 orbmath.h
字号:
@param row the row
@param col the column
@return The reference to the sub value of the matrix.
*/
float& operator()(int row, int col);
//! Operator()
/*!
This is a const version of the operator().
@see float& operator()(int row, int col)
*/
const float& operator()(int row, int col) const;
//! Operator+=
/*!
This function add another matrix to itself.
@param other another matrix
@return the the const reference of *this
*/
const MATRIX33& operator+=(const MATRIX33& other);
//! Operator[]
/*!
This function return the reference to the sub value of the matrix,
which locate at [nIndex].
@param nIndex the nIndex
@return The reference to the sub value of the matrix.
*/
float& operator[](int nIndex);
//! Operator[]
/*!
This is a const version of the operator().
@see float& operator[](int nIndex);
*/
const float& operator[](int nIndex) const;
//! Operator-=
/*!
This function subtract another matrix from itself.
@param other another matrix
@return the the const reference of *this
*/
const MATRIX33& operator-=(const MATRIX33& other);
//! Operator*=
/*!
This function multiply another matrix to itself.
@param other another matrix
@return the the const reference of *this
*/
const MATRIX33& operator*=(const MATRIX33& other);
//! Operator==
/*! @return if the vector is equal to parameter @b other, the function
returns @b true, otherwise, it returns @b false.
*/
bool operator==(const MATRIX33& other) const;
//! Operator!=
/*! @return if the vector is not equal to parameter @b other, the function
returns @b true, otherwise, it returns @b false.
*/
bool operator!=(const MATRIX33& other) const;
//! SetIdentity
/*!
This function initialize the matrix with identity value.
@return the const reference of the matrix.
*/
const MATRIX33& SetIdentity();
//! IsIdentity
/*!
@return If the matrix is a identity one, this function returns @b true.
Otherwise, it returns @b false.
*/
bool isIdentity() const;
//! Transpose
/*!
Transpose the matrix.
@return the const reference of the matrix.
*/
const MATRIX33& Transpose();
//! GetTranspose
/*!
Get the Transpose of the matrix.
@return the tranpose of the matrix.
*/
MATRIX33 GetTranspose() const;
//! Invert
/*!
Inverse the matrix.
@return the const reference of the matrix
*/
const MATRIX33& Invert();
//! GetInverse
/*!
Get the inverse of the matrix.
@return the inverse of the matrix
*/
MATRIX33 GetInverse() const;
//! Determinant
/*!
@return the Determinant of this matrix
*/
float Determinant() const;
//! GetRow
/*!
Get a row of the matrix
@return the specified row vector.
*/
VECTOR3 GetRow(int row) const;
//! GetLine
/*!
Get a Line of the matrix
@return the specified line vector.
*/
VECTOR3 GetLine(int line) const;
//! SetLine
/*!
Set a Line of the matrix
@return no return.
*/
void SetLine(int line, const VECTOR3& v);
//! SetRow
/*!
Set a row of the matrix
@return no return.
*/
void SetRow(int row, const VECTOR3& v);
private:
union
{
float m[9]; /*!< matrix member int float[16] format */
struct
{
float m11, /*!< matrix member [1,1]*/
m12, /*!< matrix member [1,2]*/
m13, /*!< matrix member [1,3]*/
m21, /*!< matrix member [2,1]*/
m22, /*!< matrix member [2,2]*/
m23, /*!< matrix member [2,3]*/
m31, /*!< matrix member [3,1]*/
m32, /*!< matrix member [3,2]*/
m33; /*!< matrix member [3,3]*/
};
};
};
//! Orb 4x4 Matrix
/*!
This struct implemented a 4x4 matrix, with some member fucntions to
simplize matrix operation.
@warning This struct does not have a virtual destructor, so don't derive from this struct
unless you know exactly what you are doing.
@date 05/12/2003
@version 1.0
@author Dan Tong
@author mail: Lythm@citiz.net
*/
struct ORB_EXPORT MATRIX44
{
//! Default Constructor
/*!
This function set all the member value to default value 0.0f.
@return no return.
*/
MATRIX44();
//! Constructor
/*!
This function construct the matrix with a 3x3 matrix.
@return no return.
*/
MATRIX44(const MATRIX33& other);
//! Constructor
/*!
This function construct the matrix with a float[16] array.
@return no return.
*/
explicit MATRIX44(float _m[16]);
//! Constructor
/*!
This function construct the matrix with 16 float parameters
@return no return.
*/
MATRIX44( float _m11, float _m12, float _m13, float _m14,
float _m21, float _m22, float _m23, float _m24,
float _m31, float _m32, float _m33, float _m34,
float _m41, float _m42, float _m43, float _m44);
//! Constructor
/*!
This function construct the matrix with quaternion.
@param quat the unit quaternion to construct the matrix
@return no return.
@warning the quaternion must be a unit one
*/
explicit MATRIX44(const QUATERNION& quat);
//! float* extractor
/*!
This function turn the matrix to a quaternion.
@return the quaternion value of this matrix.
*/
operator float*() const;
//! Operator()
/*!
This function return the reference to the sub value of the matrix,
which locate at [row, col].
@param row the row
@param col the column
@return The reference to the sub value of the matrix.
*/
float& operator()(int row, int col);
//! Operator()
/*!
This is a const version of the operator().
@see float& operator()(int row, int col)
*/
const float& operator()(int row, int col) const;
//! Operator+=
/*!
This function add another matrix to itself.
@param other another matrix
@return the the const reference of *this
*/
const MATRIX44& operator+=(const MATRIX44& other);
//! Operator[]
/*!
This function return the reference to the sub value of the matrix,
which locate at [nIndex].
@param nIndex the nIndex
@return The reference to the sub value of the matrix.
*/
float& operator[](int nIndex);
//! Operator[]
/*!
This is a const version of the operator().
@see float& operator[](int nIndex);
*/
const float& operator[](int nIndex) const;
//! Operator-=
/*!
This function subtract another matrix from itself.
@param other another matrix
@return the the const reference of *this
*/
const MATRIX44& operator-=(const MATRIX44& other);
//! Operator*=
/*!
This function multiply another matrix to itself.
@param other another matrix
@return the the const reference of *this
*/
const MATRIX44& operator*=(const MATRIX44& other);
//! Operator==
/*! @return if the vector is equal to parameter @b other, the function
returns @b true, otherwise, it returns @b false.
*/
bool operator==(const MATRIX44& other) const;
//! Operator!=
/*! @return if the vector is not equal to parameter @b other, the function
returns @b true, otherwise, it returns @b false.
*/
bool operator!=(const MATRIX44& other) const;
//! SetIdentity
/*!
This function initialize the matrix with identity value.
@return the const reference of the matrix.
*/
const MATRIX44& SetIdentity();
//! IsIdentity
/*!
@return If the matrix is a identity one, this function returns @b true.
Otherwise, it returns @b false.
*/
bool isIdentity() const;
//! Transpose
/*!
Transpose the matrix.
@return the const reference of the matrix.
*/
const MATRIX44& Transpose();
//! GetTranspose
/*!
Get the Transpose of the matrix.
@return the tranpose of the matrix.
*/
MATRIX44 GetTranspose() const;
//! Invert
/*!
Inverse the matrix.
@return the const reference of the matrix
*/
const MATRIX44& Invert();
//! GetInverse
/*!
Get the inverse of the matrix.
@return the inverse of the matrix
*/
MATRIX44 GetInverse() const;
//! Determinant
/*!
@return the Determinant of this matrix
*/
float Determinant() const;
//! GetRow
/*!
Get a row of the matrix
@return the specified row vector
*/
VECTOR4 GetRow(int row) const;
//! GetLine
/*!
Get a line of the matrix
@return the specified line vector
*/
VECTOR4 GetLine(int line) const;
//! SetLine
/*!
Set a line of the matrix
@return no return
*/
void SetLine(int line, const VECTOR4& v);
//! SetRow
/*!
Set a row of the matrix
@return no return
*/
void SetRow(int row, const VECTOR4& v);
private:
union
{
float m[16]; /*!< matrix member int float[16] format */
struct
{
float m11, /*!< matrix member [1,1]*/
m12, /*!< matrix member [1,2]*/
m13, /*!< matrix member [1,3]*/
m14, /*!< matrix member [1,4]*/
m21, /*!< matrix member [2,1]*/
m22, /*!< matrix member [2,2]*/
m23, /*!< matrix member [2,3]*/
m24, /*!< matrix member [2,4]*/
m31, /*!< matrix member [3,1]*/
m32, /*!< matrix member [3,2]*/
m33, /*!< matrix member [3,3]*/
m34, /*!< matrix member [3,4]*/
m41, /*!< matrix member [4,1]*/
m42, /*!< matrix member [4,2]*/
m43, /*!< matrix member [4,3]*/
m44; /*!< matrix member [4,4]*/
};
};
};
//! Orb PLANE
/*!
This struct implemented a Plane.
@warning This struct does not have a virtual destructor, so don't derive from this struct
unless you know exactly what you are doing.
@date 05/28/2003
@version 1.0
@author Dan Tong
@author mail: Lythm@citiz.net
*/
struct ORB_EXPORT PLANE
{
//! Default Constructor
/*!
This function set all the member value to default value 0.0f.
@return no return.
*/
PLANE();
//! Copy Constructor
PLANE(const PLANE& other);
//! Constructor
/*!
Construct the plane with four coefficient.
AX + BY + CZ + D = 0
@return no return.
*/
PLANE(float A, float B, float C, float D);
//! Constructor
/*!
Construct the plane from three points
@return no return.
*/
PLANE(const VECTOR3& p1, const VECTOR3& p2, const VECTOR3& p3);
//! Constructor
/*!
Construct the plane from a normal and a point
@return no return.
*/
PLANE(const VECTOR3& n, const VECTOR3& p);
//! Normalize
/*!
Normalize the plane.
@return const refernce of *this
*/
const PLANE& Normalize();
//! GetNormalized
/*!
@return the normalized plane of this plane
*/
PLANE GetNormalized() const;
//! PointDistance
/*!
Calculate the distance between the given point and this plane
@return distance
*/
float PointDistance(const VECTOR3& point) const;
//! Operator ==
/*! @return if the plane is equal to parameter @b other, the function
returns @b true, otherwise, it returns @b false.
*/
bool operator==(const PLANE& other) const;
//! Operator !=
/*! @return if the plane is not equal to parameter @b other, the function
returns @b true, otherwise, it returns @b false.
*/
bool operator!=(const PLANE& other) const;
//! Operator float*
operator float* ();
union
{
struct
{
float a, b, c, d; /*!< plane formular coefficient---- AX + BY +CZ +D = 0*/
};
struct
{
VECTOR3 normal; /*!< plane face normal*/
float d; /*!< value of any a point in the plane dot normal*/
};
float v[4];
};
};
//! planeDotVec
/*!
Calculate a vector4 and a plane's dot production
@return the dot production
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -