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

📄 orbmath.h

📁 应用方便的OrbMath数学运算库
💻 H
📖 第 1 页 / 共 3 页
字号:
	ORB_EXPORT float planeDotVec(const PLANE& plane, const VECTOR4& v);

	//!  planeDotVec
	/*!
		 Calculate a vector3 and a plane's dot production, which assume the w of 
		 the vector is 1
		 @return the dot production
	*/
	ORB_EXPORT float planeDotVec(const PLANE& plane, const VECTOR3& v);

	//!  planeDotNormal
	/*!
		 Calculate a vector3 and a plane's dot production, which assume the w of 
		 the vector is 0
		 @return the dot production
	*/
	ORB_EXPORT float planeDotNormal(const PLANE& plane, const VECTOR3& v);

	//!  planeTransform
	/*!
		 Transform the plane by a matrix
		 @return the const reference of the parameter 1
	*/
	ORB_EXPORT const PLANE& planeTransform(PLANE& plane, const MATRIX44& m);
	
	//!  planeLineIntersection
	/*!
		 Calculate the intersection of a plane and a line
		 @return the intersection
	*/
	ORB_EXPORT VECTOR3 planeLineIntersection(const PLANE& plane, const VECTOR3& start, const VECTOR3& end);

	//!  matBuildLookAtLH
	/*!
		 Build a 4x4 view matrix in the left-handed system
		 @param eye the eye pos
		 @param at  the at pos
		 @param up  the up direction
		 @return the view matrix
	*/
	ORB_EXPORT MATRIX44 matBuildLookAtLH(const VECTOR3& eye, const VECTOR3& at, const VECTOR3& up);

	//!  matBuildLookAtRH
	/*!
		 Build a 4x4 view matrix in the right-handed system
		 @param eye the eye pos
		 @param at  the at pos
		 @param up  the up direction
		 @return the view matrix
	*/
	ORB_EXPORT MATRIX44 matBuildLookAtRH(const VECTOR3& eye, const VECTOR3& at, const VECTOR3& up);

	//!  matBuildPerspectiveLH
	/*!
		 Build a 4x4 perspective matrix for left-handed coord system
		 @param nvp the z of the near view-plane
		 @param fvp the z of the far view-plane
		 @param fov field of view, in radians.
		 @param aspect Aspect ratio.
		 @return the perspective matrix
	*/
	ORB_EXPORT MATRIX44 matBuildPerspectiveLH(float nvp, float fvp, float fov, float aspect);

	//!  matBuildPerspectiveRH
	/*!
		 Build a 4x4 perspective matrix for right-handed coord system
		 @param nvp the z of the near view-plane
		 @param fvp the z of the far view-plane
		 @param fov field of view, in radians.
		 @param aspect Aspect ratio.
		 @return the perspective matrix
	*/
	ORB_EXPORT MATRIX44 matBuildPerspectiveRH(float nvp, float fvp, float fov, float aspect);


	//!  matBuildRotationAxis
	/*!
		 Build a 3x3 matrix from rotation against a specified axis(a vector3).
		 @param	axis a vector3 specified the axis that the rotation against. 
			The axis vector must be normalized before passed in.
		 @param radian the angle to rotate in radian
		 @return the rotation matrix
	*/
	ORB_EXPORT MATRIX33 matBuildRotationAxis(const VECTOR3& axis, float radian);
	

	//!  matBuildRotationX
	/*!
		 Build a 3x3 matrix from rotation against X axis.
		 @param radian the angle to rotate in radian
		 @return the rotation matrix
	*/
	ORB_EXPORT MATRIX33 matBuildRotationX(float radian);

	//!  matBuildRotationY
	/*!
		 Build a 3x3 matrix from rotation against Y axis.
		 @param radian the angle to rotate in radian
		 @return the rotation matrix
	*/
	ORB_EXPORT	MATRIX33 matBuildRotationY(float radian);

	//!  matBuildRotationZ
	/*!
		 Build a 3x3 matrix from rotation against Z axis.
		 @param radian the angle to rotate in radian
		 @return the rotation matrix
	*/
	ORB_EXPORT MATRIX33 matBuildRotationZ(float radian);

	//!  matBuildScale
	/*!
		 Build a 4x4 scaling matrix.
		 @param sx scale of the x axis
		 @param sy scale of the y axis
		 @param sz scale of the z axis
		 @return the scaling matrix
	*/
	ORB_EXPORT MATRIX44 matBuildScale(float sx, float sy, float sz);

	//!  matBuildTranslation
	/*!
		 Build a 4x4 translation matrix.
		 @param x offset of the x axis
		 @param y offset of the y axis
		 @param z offset of the z axis
		 @return the translation matrix
	*/
	ORB_EXPORT MATRIX44 matBuildTranslation(float x, float y, float z);

	//!  vector2 operator+
	/*!
		 Add two vector2 and return the result.
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of the addition
	*/
	ORB_EXPORT VECTOR2 operator+(const VECTOR2& v1, const VECTOR2& v2);

	//!  vector3 operator+
	/*!
		 Add two vector3 and return the result.
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of the addition
	*/
	ORB_EXPORT VECTOR3 operator+(const VECTOR3& v1, const VECTOR3& v2);

	//!  vector4 operator+
	/*!
		 Add two vector4 and return the result.
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of the addition
	*/
	ORB_EXPORT VECTOR4 operator+(const VECTOR4& v1, const VECTOR4& v2);

	//!  quaternion operator+
	/*!
		 Add two quaternion and return the result.
		 @param q1 a quaternion
		 @param q2 a quaternion
		 @return the result of the addition
	*/
	ORB_EXPORT QUATERNION operator+(const QUATERNION& q1, const QUATERNION& q2);

	//!  vector2 operator-
	/*!
		 Subtract two vector2 and return the result.
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of the subtraction
	*/
	ORB_EXPORT VECTOR2 operator-(const VECTOR2& v1, const VECTOR2& v2);

	//!  vector3 operator-
	/*!
		 Subtract two vector3 and return the result.
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of the subtraction
	*/
	ORB_EXPORT VECTOR3 operator-(const VECTOR3& v1, const VECTOR3& v2);

	//!  vector4 operator-
	/*!
		 Subtract two vector4 and return the result.
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of the subtraction
	*/
	ORB_EXPORT VECTOR4 operator-(const VECTOR4& v1, const VECTOR4& v2);

	//!  quaternion operator-
	/*!
		 Subtract two quaternion and return the result.
		 @param q1 a quaternion
		 @param q2 a quaternion
		 @return the result of the subtraction
	*/
	ORB_EXPORT QUATERNION operator-(const QUATERNION& q1, const QUATERNION& q2);

	//!  vector2 operator*
	/*!
		 Multiply a vector2 with a float
		 @param v a vector
		 @param s a float
		 @return the result of the multiplication
	*/
	ORB_EXPORT VECTOR2 operator*(const VECTOR2& v, float s);

	//!  vector2 operator*
	/*!
		 Multiply a float with a vector2.
		 @param s a float
		 @param v a vector
		 @return the result of the multiplication
	*/
	ORB_EXPORT VECTOR2 operator*(float s, const VECTOR2& v);
	
	//!  vector3 operator*
	/*!
		 Multiply a vector3 with a float
		 @param v a vector
		 @param s a float
		 @return the result of the multiplication
	*/
	ORB_EXPORT VECTOR3 operator*(const VECTOR3& v, float s);

	//!  vector3 operator*
	/*!
		 Multiply a float with a vector3.
		 @param s a float
		 @param v a vector
		 @return the result of the multiplication
	*/
	ORB_EXPORT VECTOR3 operator*(float s, const VECTOR3& v);

	//!  vector4 operator*
	/*!
		 Multiply a vector4 with a float
		 @param v a vector
		 @param s a float
		 @return the result of the multiplication
	*/
	ORB_EXPORT VECTOR4 operator*(const VECTOR4& v, float s);

	//!  vector4 operator*
	/*!
		 Multiply a float with a vector4.
		 @param s a float
		 @param v a vector
		 @return the result of the multiplication
	*/
	ORB_EXPORT VECTOR4 operator*(float s, const VECTOR4& v);

	//!  quaternion operator*
	/*!
		 Multiply a quaternion with a float
		 @param q a quaternion to multiply
		 @param s a float to multiply
		 @return the result of the multiplication
	*/
	ORB_EXPORT QUATERNION operator*(const QUATERNION& q, float s);

	//!  quaternion operator*
	/*!
		 Multiply a float with a quaternion.
		 @param s a float to multiply
		 @param q a quaternion to multiply
		 @return the result of the multiplication
	*/
	ORB_EXPORT QUATERNION operator*(float s, const QUATERNION& q);

	//!  matrix operator*
	/*!
		 Multiply a matrix with a float.
		 @param mat a matrix to multiply
		 @param s a float to multiply
		 @return the result of the multiplication
	*/
	ORB_EXPORT MATRIX44 operator*(const MATRIX44& mat, float s);

	//!  matrix operator*
	/*!
		 Multiply a matrix with a float.
		 @param mat a matrix to multiply
		 @param s a float to multiply
		 @return the result of the multiplication
	*/
	ORB_EXPORT MATRIX33 operator*(const MATRIX33& mat, float s);

	//!  matrix operator*
	/*!
		 Multiply a float with a matrix.
		 @param s a float to multiply
		 @param mat a matrix to multiply
		 @return the result of the multiplication
	*/
	ORB_EXPORT MATRIX44 operator*(float s, const MATRIX44& mat);

	//!  matrix operator*
	/*!
		 Multiply a float with a matrix.
		 @param s a float to multiply
		 @param mat a matrix to multiply
		 @return the result of the multiplication
	*/
	ORB_EXPORT MATRIX33 operator*(float s, const MATRIX33& mat);
	
	//!  vector2 dot production
	/*!
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of dot production
	*/
	ORB_EXPORT float vecDot(const VECTOR2& v1, const VECTOR2& v2);

	//!  vector3 dot production
	/*!
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of dot production
	*/
	ORB_EXPORT float vecDot(const VECTOR3& v1, const VECTOR3& v2);

	//!  vector4 dot production
	/*!
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of dot production
	*/
	ORB_EXPORT float vecDot(const VECTOR4& v1, const VECTOR4& v2);

	//!  quaternion dot production
	/*!
		 @param v1 a quaternion
		 @param v2 a quaternion
		 @return the result of dot production
	*/
	ORB_EXPORT float quatDot(const QUATERNION& q1, const QUATERNION& q2);

	//!  vector3 cross production
	/*!
		 @param v1 a vector
		 @param v2 a vector
		 @return the result of cross production
	*/
	ORB_EXPORT VECTOR3 vecCross(const VECTOR3& v1, const VECTOR3& v2);

//	VECTOR4 vecCross(const VECTOR4& v1, const VECTOR4& v2, const VECTOR4& v3);

	//!  quaternion operator*
	/*!
		 Multiply two quaternion and return the result.
		 @param q1 the quaternion to multiply
		 @param q2 the quaternion to multiply
		 @return the result of the multiplication
	*/
	ORB_EXPORT QUATERNION operator * ( const QUATERNION& q1 , const QUATERNION& q2);

	//!  quatSlerp
	/*!
		 Calculate the slerp between the two quaternion, and return the result.
		 @param qs start quaternion
		 @param qf end quaternion
		 @param s  Slerp scale
		 @return the slerp result quaternion between the two quaternion
	*/
	ORB_EXPORT QUATERNION quatSlerp(const QUATERNION& qs , const QUATERNION& qf, float s);

	//!  quatBuildRotationAxis
	/*!
		 Build a quaternion from rotation against a specified axis(a vector3).
		 @param	axis a vector3 specified the axis that the rotation against.
		 @param radian the angle to rotate in radian
		 @return the rotation quaternion
	*/
	ORB_EXPORT QUATERNION quatBuildRotationAxis(const VECTOR3& axis, float radian);
		
	//!  matrix operator+
	/*!
		 Add two matrix and return the result.
		 @param m1 the matrix to add
		 @param m2 the matrix to add
		 @return the result matrix of the addition
	*/
	ORB_EXPORT MATRIX44 operator+(const MATRIX44& m1, const MATRIX44& m2);

	//!  matrix operator+
	/*!
		 Add two matrix and return the result.
		 @param m1 the matrix to add
		 @param m2 the matrix to add
		 @return the result matrix of the addition
	*/
	ORB_EXPORT MATRIX33 operator+(const MATRIX33& m1, const MATRIX33& m2);
	
	//!  matrix operator-
	/*!
		 Subtract two matrix and return the result.
		 @param m1 the matrix to subtract from
		 @param m2 the matrix to subtract
		 @return the result matrix of the subtraction
	*/
	ORB_EXPORT MATRIX44 operator-(const MATRIX44& m1, const MATRIX44& m2);

	//!  matrix operator-
	/*!
		 Subtract two matrix and return the result.
		 @param m1 the matrix to subtract from
		 @param m2 the matrix to subtract
		 @return the result matrix of the subtraction
	*/
	ORB_EXPORT MATRIX33 operator-(const MATRIX33& m1, const MATRIX33& m2);
	
	//!  matrix operator*
	/*!
		 Multiply two matrix and return the result.
		 @param m1 the matrix to multiply
		 @param m2 the matrix to multiply
		 @return the result matrix of the multiplication
	*/
	ORB_EXPORT MATRIX44 operator*(const MATRIX44& m1, const MATRIX44& m2);

	//!  matrix operator*
	/*!
		 Multiply two matrix and return the result.
		 @param m1 the matrix to multiply
		 @param m2 the matrix to multiply
		 @return the result matrix of the multiplication
	*/
	ORB_EXPORT MATRIX33 operator*(const MATRIX33& m1, const MATRIX33& m2);

	//!  vecTransform
	/*!
		 Transform a vector 2 by a matrix
		 @return the const reference of the vector
	*/
	ORB_EXPORT const VECTOR2& vecTransform(VECTOR2& v, const MATRIX44& m);

	//!  vecTransform
	/*!
		 Transform a vector 2 by a matrix
		 @return the const reference of the vector
	*/
	ORB_EXPORT const VECTOR2& vecTransform(VECTOR2& v, const MATRIX33& m);

	//!  vecTransform
	/*!
		 Transform a vector 3 by a matrix
		 @return the const reference of the vector
	*/
	ORB_EXPORT const VECTOR3& vecTransform(VECTOR3& v, const MATRIX44& m);

	//!  vecTransform
	/*!
		 Transform a vector 3 by a matrix
		 @return the const reference of the vector
	*/
	ORB_EXPORT const VECTOR3& vecTransform(VECTOR3& v, const MATRIX33& m);

	//!  vecTransform
	/*!
		 Transform a vector 4 by a matrix
		 @return the const reference of the vector
	*/
	ORB_EXPORT const VECTOR4& vecTransform(VECTOR4& v, const MATRIX44& m);

	//!  output to stream
	ORB_EXPORT std::ostream& operator<<(std::ostream& o, const MATRIX44& m);

	//!  output to stream
	ORB_EXPORT std::ostream& operator<<(std::ostream& o, const MATRIX33& m);
	
	//!  output to stream
	ORB_EXPORT std::ostream& operator<<(std::ostream& o, const VECTOR2& v);

	//!  output to stream
	ORB_EXPORT std::ostream& operator<<(std::ostream& o, const VECTOR3& v);

	//!  output to stream
	ORB_EXPORT std::ostream& operator<<(std::ostream& o, const VECTOR4& v);

	//!  output to stream
	ORB_EXPORT std::ostream& operator<<(std::ostream& o, const QUATERNION& q);

	//!  output to stream
	ORB_EXPORT std::ostream& operator<<(std::ostream& o, const PLANE& p);

#include <OrbMath.inl>
}
#endif

⌨️ 快捷键说明

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