소스 검색

Fix more docs in math

Daniele Bartolini 12 년 전
부모
커밋
3778c15a8a
12개의 변경된 파일353개의 추가작업 그리고 211개의 파일을 삭제
  1. 0 5
      src/core/math/Mat3.cpp
  2. 0 5
      src/core/math/Mat4.cpp
  3. 0 1
      src/core/math/Mat4.h
  4. 73 30
      src/core/math/MathUtils.h
  5. 0 5
      src/core/math/Plane.cpp
  6. 13 7
      src/core/math/Plane.h
  7. 0 5
      src/core/math/Quat.cpp
  8. 26 11
      src/core/math/Quat.h
  9. 2 0
      src/core/math/Ray.h
  10. 75 44
      src/core/math/Vec2.h
  11. 86 51
      src/core/math/Vec3.h
  12. 78 47
      src/core/math/Vec4.h

+ 0 - 5
src/core/math/Mat3.cpp

@@ -84,11 +84,6 @@ Mat3::Mat3(const Mat3& a)
 	m[8] = a.m[8];
 	m[8] = a.m[8];
 }
 }
 
 
-//-----------------------------------------------------------------------------
-Mat3::~Mat3()
-{
-}
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 Mat3& Mat3::operator=(const Mat3& a)
 Mat3& Mat3::operator=(const Mat3& a)
 {
 {

+ 0 - 5
src/core/math/Mat4.cpp

@@ -106,11 +106,6 @@ Mat4::Mat4(const Mat4& a)
 	m[15] = a.m[15];
 	m[15] = a.m[15];
 }
 }
 
 
-//-----------------------------------------------------------------------------
-Mat4::~Mat4()
-{
-}
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 Mat4& Mat4::operator=(const Mat4& a)
 Mat4& Mat4::operator=(const Mat4& a)
 {
 {

+ 0 - 1
src/core/math/Mat4.h

@@ -73,7 +73,6 @@ public:
 	/// Contructs from the @v array
 	/// Contructs from the @v array
 						Mat4(const real v[16]);						
 						Mat4(const real v[16]);						
 						Mat4(const Mat4& a);					
 						Mat4(const Mat4& a);					
-						~Mat4();				
 
 
 	/// Assignment operator (copies the data)
 	/// Assignment operator (copies the data)
 	Mat4&				operator=(const Mat4& a);					
 	Mat4&				operator=(const Mat4& a);					

+ 73 - 30
src/core/math/MathUtils.h

@@ -60,36 +60,79 @@ const double	DOUBLE_PRECISION			= (real)1.0e-9;
 bool			equals(float a, float b, float precision = FLOAT_PRECISION);
 bool			equals(float a, float b, float precision = FLOAT_PRECISION);
 bool			equals(double a, double b, double precision = DOUBLE_PRECISION);
 bool			equals(double a, double b, double precision = DOUBLE_PRECISION);
 
 
-bool			test_bitmask(int32_t value, int32_t bitmask);	//!< Tests agains a specified bitmask and returns true only if all bits are satisfied
-int32_t			set_bitmask(int32_t value, int32_t bitmask);	//!< Sets the specified bitmask
-int32_t			unset_bitmask(int32_t value, int32_t bitmask);	//!< Removes the specified bitmask
-
-
-template <typename T> T		min(const T& a, const T& b);	//!< Returns minimum between two values
-template <typename T> T		max(const T& a, const T& b);	//!< Returns maximum between two values
-template <typename T> T		avg(const T& a, const T& b);	//!< Returns the arithmetic mean of a and b
-template <typename T> T		clamp_to_range(const T& min, const T& max, const T& value);	//!< Clamps a value to a specific range (min < max)
-template <typename T> void	swap(T& a, T& b);				//!< Swaps @a and @b
-
-real			deg_to_rad(real deg);			//!< Returns "deg" in radians
-real			rad_to_deg(real rad);			//!< Returns "rad" in degrees
-uint32_t		next_pow_2(uint32_t x);			//!< Returns the nearest power of two to @x
-bool			is_pow_2(uint32_t x);			//!< Returns whether @x is power of two
-real			ceil(real x);					//!< Returns the smallest int32_tegral value that is not less than x
-real			floor(real x);					//!< Returns the largest int32_tegral value that is not greater than x
-real			sqrt(real x);					//!< Returns the square root of @x
-real			inv_sqrt(real x);				//!< Returns the inverse square root of @x
-real			sin(real x);					//!< Returns the sine of @x
-real			cos(real x);					//!< Returns the cosine of @x
-real			asin(real x);					//!< Returns the arc sine of @x
-real			acos(real x);					//!< Returns the arc cosine of @x
-real			tan(real x);					//!< Returns the tangent of @x
-real			atan2(real y, real x);			//!< Returns the arc tangent of @y/@x
-real			abs(real x);					//!< Returns the absolute value of @x
-real			fmod(real n, real d);			//!< Returns the realing-point remainder of numerator/denominator
-
-
-				//! Returns true if there are solutions and puts them in 'x1' and 'x2' (x1 <= x2)
+/// Tests agains the specified @bitmask and returns true only if all bits are satisfied
+bool			test_bitmask(int32_t value, int32_t bitmask);
+
+/// Sets the specified @bitmask	
+int32_t			set_bitmask(int32_t value, int32_t bitmask);
+
+/// Removes the specified @bitmask	
+int32_t			unset_bitmask(int32_t value, int32_t bitmask);	
+
+/// Returns minimum between @a and @b
+template <typename T> T		min(const T& a, const T& b);
+
+/// Returns maximum between @a and @b
+template <typename T> T		max(const T& a, const T& b);
+
+/// Returns the arithmetic mean of @a and @b	
+template <typename T> T		avg(const T& a, const T& b);
+
+/// Clamps a value to a specific range (min < max)	
+template <typename T> T		clamp_to_range(const T& min, const T& max, const T& value);	
+
+/// Swaps @a and @b
+template <typename T> void	swap(T& a, T& b);				
+
+/// Returns @deg in radians
+real			deg_to_rad(real deg);
+
+/// Returns @rad in degrees
+real			rad_to_deg(real rad);
+
+/// Returns the nearest power of two to @x
+uint32_t		next_pow_2(uint32_t x);
+
+/// Returns whether @x is a power of two			
+bool			is_pow_2(uint32_t x);	
+
+/// Returns the smallest integral value that is not less than @x
+real			ceil(real x);		
+
+/// Returns the largest integral value that is not greater than @x			
+real			floor(real x);	
+
+/// Returns the square root of @x				
+real			sqrt(real x);	
+
+/// Returns the inverse square root of @x				
+real			inv_sqrt(real x);
+
+/// Returns the sine of @x				
+real			sin(real x);	
+
+/// Returns the cosine of @x				
+real			cos(real x);
+
+/// Returns the arc sine of @x					
+real			asin(real x);	
+
+/// Returns the arc cosine of @x				
+real			acos(real x);	
+
+/// Returns the tangent of @x				
+real			tan(real x);		
+
+/// Returns the arc tangent of @y/@x			
+real			atan2(real y, real x);	
+
+/// Returns the absolute value of @x		
+real			abs(real x);			
+
+/// Returns the realing-point remainder of numerator/denominator		
+real			fmod(real n, real d);			
+
+/// Returns true if there are solutions and puts them in 'x1' and 'x2' (x1 <= x2)
 bool			solve_quadratic_equation(real a, real b, real c, real& x1, real& x2);
 bool			solve_quadratic_equation(real a, real b, real c, real& x1, real& x2);
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------

+ 0 - 5
src/core/math/Plane.cpp

@@ -50,11 +50,6 @@ Plane::Plane(const Vec3& normal, real dist) : n(normal), d(dist)
 {
 {
 }
 }
 
 
-//-----------------------------------------------------------------------------
-Plane::~Plane()
-{
-}
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 Plane& Plane::normalize()
 Plane& Plane::normalize()
 {
 {

+ 13 - 7
src/core/math/Plane.h

@@ -45,15 +45,21 @@ public:
 
 
 public:
 public:
 
 
-						Plane();									//!< Constructor, does nothing for efficiency
-						Plane(const Plane& p);						//!< Copy constructor
-						Plane(const Vec3& normal, real dist);		//!< Constructs from a normal and distance factor
-						~Plane();									//!< Destructor
+	/// Does nothing for efficiency.
+						Plane();						
+						Plane(const Plane& p);
 
 
-	Plane&				normalize();								//!< Normalizes the plane
+	/// Constructs from a normal and distance factor						
+						Plane(const Vec3& normal, real dist);		
 
 
-	real				distance_to_point(const Vec3& p) const;		//!< Returns the signed distance between point @p and the plane
-	bool				contains_point(const Vec3& p) const;		//!< Returns whether the plane contains the point
+	/// Normalizes the plane
+	Plane&				normalize();							
+
+	/// Returns the signed distance between point @p and the plane
+	real				distance_to_point(const Vec3& p) const;	
+
+	/// Returns whether the plane contains the point @p	
+	bool				contains_point(const Vec3& p) const;		
 
 
 	static const Plane	ZERO;
 	static const Plane	ZERO;
 	static const Plane	XAXIS;
 	static const Plane	XAXIS;

+ 0 - 5
src/core/math/Quat.cpp

@@ -45,11 +45,6 @@ Quat::Quat(real angle, const Vec3& v)
 	this->v = v * math::sin((real)(angle * 0.5));
 	this->v = v * math::sin((real)(angle * 0.5));
 }
 }
 
 
-//-----------------------------------------------------------------------------
-Quat::~Quat()
-{
-}
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void Quat::negate()
 void Quat::negate()
 {
 {

+ 26 - 11
src/core/math/Quat.h

@@ -54,22 +54,37 @@ public:
 
 
 public:
 public:
 
 
-				Quat();								//!< Constructor
-				Quat(real angle, const Vec3& v);	//!< Builds the quaternion from an angle and a vector
-				~Quat();							//!< Destructor
+				Quat();
 
 
-	void		negate();							//!< Negates the quaternion
-	void		load_identity();					//!< Builds the identity quaternion
-	real		length() const;						//!< Returns the quaternion's length
-	void		conjugate();						//!< Conjugates the quaternion
-	Quat		get_conjugate() const;				//!< Returns the quaternion's conjugate
-	Quat		get_inverse() const;				//!< Quaternion's inverse
+	/// Builds the quaternion from an angle and a vector								
+				Quat(real angle, const Vec3& v);	
+
+	/// Negates the quaternion
+	void		negate();
+
+	/// Builds the identity quaternion							
+	void		load_identity();
+
+	/// Returns the quaternion's length					
+	real		length() const;		
+
+	/// Conjugates the quaternion				
+	void		conjugate();
+
+	/// Returns the quaternion's conjugate						
+	Quat		get_conjugate() const;
+
+	/// Quaternion's inverse				
+	Quat		get_inverse() const;				
 
 
 	Mat3		to_mat3() const;
 	Mat3		to_mat3() const;
 	Mat4		to_mat4() const;
 	Mat4		to_mat4() const;
 
 
-	Quat		operator*(const Quat& b) const;		//!< Cross product
-	Quat		operator*(const real& k) const;		//!< Multiplication by a scalar
+	/// Cross product
+	Quat		operator*(const Quat& b) const;
+
+	/// Multiplication by a scalar		
+	Quat		operator*(const real& k) const;		
 
 
 	Quat		power(real exp);
 	Quat		power(real exp);
 };
 };

+ 2 - 0
src/core/math/Ray.h

@@ -40,6 +40,8 @@ public:
 
 
 	/// Does nothing for efficiency.
 	/// Does nothing for efficiency.
 					Ray();
 					Ray();
+
+	/// Constructs from @origin and @direction
 					Ray(const Vec3& origin, const Vec3& direction);
 					Ray(const Vec3& origin, const Vec3& direction);
 					Ray(const Ray& ray);
 					Ray(const Ray& ray);
 
 

+ 75 - 44
src/core/math/Vec2.h

@@ -39,50 +39,86 @@ public:
 
 
 	real				x, y;
 	real				x, y;
 
 
-						Vec2();									//!< Constructor, does nothing for efficiency
-						Vec2(real val);							//!< Initializes all the components to val
-						Vec2(real nx, real ny);					//!< Constructs from two components
-						Vec2(const real v[2]);					//!< Constructs from array
-						Vec2(const Vec2& a);					//!< Copy constructor
-						~Vec2();								//!< Destructor
-
-	real				operator[](uint32_t i) const;			//!< Random access by index
-	real&				operator[](uint32_t i);					//!< Random access by index
-
-	Vec2				operator+(const Vec2& a) const;			//!< Addition
-	Vec2&				operator+=(const Vec2& a);				//!< Addition
-	Vec2 				operator-(const Vec2& a) const;			//!< Subtraction
-	Vec2&				operator-=(const Vec2& a);				//!< Subtraction
-	Vec2				operator*(real k) const;				//!< Multiplication by scalar
-	Vec2&				operator*=(real k);						//!< Multiplication by scalar
-	Vec2				operator/(real k) const;				//!< Division by scalar
-	Vec2&				operator/=(real k);						//!< Division by scalar
-	real				dot(const Vec2& a) const;				//!< Dot product
-
-	friend Vec2			operator*(real k, const Vec2& a);		//!< For simmetry
-
-	bool				operator==(const Vec2& other) const;	//!< Equality operator
-	bool				operator!=(const Vec2& other) const;	//!< Disequality operator
-	bool				operator<(const Vec2& other) const;		//!< Returns whether all the components of this vector are smaller than all of the "other" vector
-	bool				operator>(const Vec2& other) const;		//!< Returns whether all the components of this vector are greater than all of the "other" vector
-
-	real				length() const;							//!< Returns the vector's length
-	real				squared_length() const;					//!< Returns the vector's squared length
-	void				set_length(real len);					//!< Sets the vector's length
+	/// Does nothing for efficiency.
+						Vec2();		
+
+	/// Initializes all the components to val							
+						Vec2(real val);	
+
+	/// Constructs from two components						
+						Vec2(real nx, real ny);
+
+	/// Constructs from array
+						Vec2(const real v[2]);
+						Vec2(const Vec2& a);					
+
+	/// Random access by index
+	real				operator[](uint32_t i) const;
+
+	/// Random access by index			
+	real&				operator[](uint32_t i);					
+
+	Vec2				operator+(const Vec2& a) const;			
+	Vec2&				operator+=(const Vec2& a);				
+	Vec2 				operator-(const Vec2& a) const;			
+	Vec2&				operator-=(const Vec2& a);				
+	Vec2				operator*(real k) const;				
+	Vec2&				operator*=(real k);						
+	Vec2				operator/(real k) const;				
+	Vec2&				operator/=(real k);
+
+	/// Dot product						
+	real				dot(const Vec2& a) const;				
+
+	/// For simmetry
+	friend Vec2			operator*(real k, const Vec2& a);		
+
+	bool				operator==(const Vec2& other) const;	
+	bool				operator!=(const Vec2& other) const;
+
+	/// Returns whether all the components of this vector are smaller than all of the @other vector	
+	bool				operator<(const Vec2& other) const;		
+
+	/// Returns whether all the components of this vector are greater than all of the @other vector
+	bool				operator>(const Vec2& other) const;		
+
+	/// Returns the vector's length
+	real				length() const;
+
+	/// Returns the vector's squared length							
+	real				squared_length() const;
+
+	/// Sets the vector's length					
+	void				set_length(real len);					
 	real				get_angle() const;
 	real				get_angle() const;
 	real				get_angle_2d() const;
 	real				get_angle_2d() const;
-	Vec2&				normalize();							//!< Normalizes the vector
-	Vec2				get_normalized() const;					//!< Returns the normalized vector
-	Vec2&				negate();								//!< Negates the vector (i.e. builds the inverse)
-	Vec2				operator-() const;						//!< Negates the vector (i.e. builds the inverse)
 
 
-	real				get_distance_to(const Vec2& a) const;	//!< Returns the distance
-	real				get_angle_between(const Vec2& a) const;	//!< Returns the angle in radians
+	/// Normalizes the vector
+	Vec2&				normalize();
+
+	/// Returns the normalized vector							
+	Vec2				get_normalized() const;
+
+	/// Negates the vector (i.e. builds the inverse)					
+	Vec2&				negate();
+
+	/// Negates the vector (i.e. builds the inverse)								
+	Vec2				operator-() const;						
+
+	/// Returns the distance
+	real				get_distance_to(const Vec2& a) const;
 
 
-	void				zero();									//!< Builds the zero vector
+	/// Returns the angle in radian	
+	real				get_angle_between(const Vec2& a) const;
 
 
-	real*				to_float_ptr();							//!< Returns the point32_ter to the vector's data
-	const real*			to_float_ptr() const;					//!< Returns the point32_ter to the vector's data
+	/// Sets all components to zero
+	void				zero();
+
+	/// Returns the pointer to the vector's data
+	real*				to_float_ptr();	
+
+	/// Returns the pointer to the vector's data						
+	const real*			to_float_ptr() const;					
 
 
 	static const Vec2	ZERO;
 	static const Vec2	ZERO;
 	static const Vec2	ONE;
 	static const Vec2	ONE;
@@ -115,11 +151,6 @@ inline Vec2::Vec2(const Vec2& a) : x(a.x), y(a.y)
 {
 {
 }
 }
 
 
-//-----------------------------------------------------------------------------
-inline Vec2::~Vec2()
-{
-}
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 inline real Vec2::operator[](uint32_t i) const
 inline real Vec2::operator[](uint32_t i) const
 {
 {

+ 86 - 51
src/core/math/Vec3.h

@@ -40,50 +40,90 @@ public:
 
 
 	real				x, y, z;
 	real				x, y, z;
 
 
-						Vec3();									//!< Constructor, does nothing for efficiency
-						Vec3(real val);							//!< Initializes all the components to val
-						Vec3(real nx, real ny, real nz);		//!< Constructs from three components
-						Vec3(const real v[3]);					//!< Constructs from array
-						Vec3(const Vec3& a);					//!< Copy constructor
-						~Vec3();								//!< Destructor
-
-	real				operator[](uint32_t i) const;			//!< Random access by index
-	real&				operator[](uint32_t i);					//!< Random access by index
-
-	Vec3				operator+(const Vec3& a) const;			//!< Addition
-	Vec3&				operator+=(const Vec3& a);				//!< Addition
-	Vec3 				operator-(const Vec3& a) const;			//!< Subtraction
-	Vec3&				operator-=(const Vec3& a);				//!< Subtraction
-	Vec3				operator*(real k) const;				//!< Multiplication by scalar
-	Vec3&				operator*=(real k);						//!< Multiplication by scalar
-	Vec3				operator/(real k) const;				//!< Division by scalar
-	Vec3&				operator/=(real k);						//!< Division by scalar
-	real				dot(const Vec3& a) const;				//!< Dot product
-	Vec3				cross(const Vec3& a) const;				//!< Cross product
-
-	friend Vec3			operator*(real k, const Vec3& a);		//!< For simmetry
-
-	bool				operator==(const Vec3& other) const;	//!< Equality operator
-	bool				operator!=(const Vec3& other) const;	//!< Disequality operator
-	bool				operator<(const Vec3& other) const;		//!< Returns whether all the components of this vector are smaller than all of the "other" vector
-	bool				operator>(const Vec3& other) const;		//!< Returns whether all the components of this vector are greater than all of the "other" vector
-
-	real				length() const;							//!< Returns the vector's length
-	real				squared_length() const;					//!< Returns the vector's squared length
-	void				set_length(real len);					//!< Sets the vector's length
-	Vec3&				normalize();							//!< Normalizes the vector
-	Vec3				get_normalized() const;					//!< Returns the normalized vector
-	Vec3&				negate();								//!< Negates the vector (i.e. builds the inverse)
-	Vec3				operator-() const;						//!< Negates the vector (i.e. builds the inverse)
-
-	real				get_distance_to(const Vec3& a) const;	//!< Returns the distance
-	real				get_angle_between(const Vec3& a) const;	//!< Returns the angle in radians
-
-	void				zero();									//!< Builds the zero vector
-
-	real*				to_float_ptr();							//!< Returns the point32_ter to the vector's data
-	const real*			to_float_ptr() const;					//!< Returns the point32_ter to the vector's data
-	Vec2				to_vec2() const;						//!< Returns a Vec2 with only x and y coordinates
+	/// Does nothing for efficiency.
+						Vec3();	
+
+	/// Initializes all the components to val								
+						Vec3(real val);	
+
+	/// Constructs from three components						
+						Vec3(real nx, real ny, real nz);
+						
+	/// Constructs from array		
+						Vec3(const real v[3]);					
+						Vec3(const Vec3& a);	
+
+	/// Random access by index
+	real				operator[](uint32_t i) const;
+
+	/// Random access by index			
+	real&				operator[](uint32_t i);					
+
+	Vec3				operator+(const Vec3& a) const;			
+	Vec3&				operator+=(const Vec3& a);				
+	Vec3 				operator-(const Vec3& a) const;			
+	Vec3&				operator-=(const Vec3& a);				
+	Vec3				operator*(real k) const;				
+	Vec3&				operator*=(real k);						
+	Vec3				operator/(real k) const;				
+	Vec3&				operator/=(real k);
+
+	/// Dot product						
+	real				dot(const Vec3& a) const;
+
+	/// Cross product				
+	Vec3				cross(const Vec3& a) const;				
+
+	/// For simmetry
+	friend Vec3			operator*(real k, const Vec3& a);		
+
+	bool				operator==(const Vec3& other) const;	
+	bool				operator!=(const Vec3& other) const;
+
+	/// Returns whether all the components of this vector are smaller than all of the "other" vector	
+	bool				operator<(const Vec3& other) const;
+
+	/// Returns whether all the components of this vector are greater than all of the "other" vector		
+	bool				operator>(const Vec3& other) const;		
+
+	/// Returns the vector's length
+	real				length() const;	
+
+	/// Returns the vector's squared length						
+	real				squared_length() const;
+
+	/// Sets the vector's length					
+	void				set_length(real len);
+
+	/// Normalizes the vector					
+	Vec3&				normalize();
+
+	/// Returns the normalized vector							
+	Vec3				get_normalized() const;		
+
+	/// Negates the vector (i.e. builds the inverse)			
+	Vec3&				negate();
+
+	/// Negates the vector (i.e. builds the inverse)								
+	Vec3				operator-() const;						
+
+	/// Returns the distance
+	real				get_distance_to(const Vec3& a) const;	
+
+	/// Returns the angle in radians
+	real				get_angle_between(const Vec3& a) const;	
+
+	/// Sets all components to zero
+	void				zero();									
+
+	/// Returns the pointer to the vector's data
+	real*				to_float_ptr();	
+
+	/// Returns the pointer to the vector's data						
+	const real*			to_float_ptr() const;
+
+	/// Returns a Vec2 with only x and y coordinates					
+	Vec2				to_vec2() const;						
 
 
 	static const Vec3	ZERO;
 	static const Vec3	ZERO;
 	static const Vec3	ONE;
 	static const Vec3	ONE;
@@ -117,11 +157,6 @@ inline Vec3::Vec3(const Vec3& a) : x(a.x), y(a.y), z(a.z)
 {
 {
 }
 }
 
 
-//-----------------------------------------------------------------------------
-inline Vec3::~Vec3()
-{
-}
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 inline real Vec3::operator[](uint32_t i) const
 inline real Vec3::operator[](uint32_t i) const
 {
 {
@@ -356,7 +391,7 @@ inline Vec2 Vec3::to_vec2() const
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-//!< Returns the parallel portion of "v" projected onto "n"
+/// Returns the parallel portion of "v" projected onto "n"
 inline Vec3 get_projected_parallel(const Vec3& v, const Vec3& n)
 inline Vec3 get_projected_parallel(const Vec3& v, const Vec3& n)
 {
 {
 	real n_len_q;
 	real n_len_q;
@@ -367,7 +402,7 @@ inline Vec3 get_projected_parallel(const Vec3& v, const Vec3& n)
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-//!< Returns the perpendicular portion of "v" projected onto "n"
+/// Returns the perpendicular portion of "v" projected onto "n"
 inline Vec3 get_projected_perpendicular(const Vec3& v, const Vec3& n)
 inline Vec3 get_projected_perpendicular(const Vec3& v, const Vec3& n)
 {
 {
 	return v - get_projected_parallel(v, n);
 	return v - get_projected_parallel(v, n);

+ 78 - 47
src/core/math/Vec4.h

@@ -39,48 +39,84 @@ public:
 
 
 	real				x, y, z, w;
 	real				x, y, z, w;
 
 
-						Vec4();										//!< Constructor, does nothing for efficiency
-						Vec4(real val);								//!< Initializes all the components to val
-						Vec4(real nx, real ny, real nz, real nw);	//!< Constructs from four components
-						Vec4(const real v[4]);						//!< Constructs from array
-						Vec4(const Vec4& a);						//!< Copy constructor
-						~Vec4();									//!< Destructor
-
-	real				operator[](uint32_t i) const;				//!< Random access by index
-	real&				operator[](uint32_t i);						//!< Random access by index
-
-	Vec4				operator+(const Vec4& a) const;				//!< Addition
-	Vec4&				operator+=(const Vec4& a);					//!< Addition
-	Vec4 				operator-(const Vec4& a) const;				//!< Subtraction
-	Vec4&				operator-=(const Vec4& a);					//!< Subtraction
-	Vec4				operator*(real k) const;					//!< Multiplication by scalar
-	Vec4&				operator*=(real k);							//!< Multiplication by scalar
-	Vec4				operator/(real k) const;					//!< Division by scalar
-	Vec4&				operator/=(real k);							//!< Division by scalar
-	real				dot(const Vec4& a) const;					//!< Dot product
-
-	friend Vec4			operator*(real k, const Vec4& a);			//!< For simmetry
-
-	bool				operator==(const Vec4& other) const;		//!< Equality operator
-	bool				operator!=(const Vec4& other) const;		//!< Disequality operator
-	bool				operator<(const Vec4& other) const;			//!< Returns whether all the components of this vector are smaller than all of the "other" vector
-	bool				operator>(const Vec4& other) const;			//!< Returns whether all the components of this vector are greater than all of the "other" vector
-
-	real				length() const;								//!< Returns the vector's length
-	real				squared_length() const;						//!< Returns the vector's squared length
-	void				set_length(real len);						//!< Sets the vector's length
-	Vec4&				normalize();								//!< Normalizes the vector
-	Vec4				get_normalized() const;						//!< Returns the normalized vector
-	Vec4&				negate();									//!< Negates the vector (i.e. builds the inverse)
-	Vec4				operator-() const;							//!< Negates the vector (i.e. builds the inverse)
-
-	real				get_distance_to(const Vec4& a) const;		//!< Returns the distance
-	real				get_angle_between(const Vec4& a) const;		//!< Returns the angle in radians
-
-	void				zero();										//!< Builds the zero vector
-
-	real*				to_float_ptr();								//!< Returns the point32_ter to the vector's data
-	const real*			to_float_ptr() const;						//!< Returns the point32_ter to the vector's data
+	/// Does nothing for efficiency.
+						Vec4();	
+
+	/// Initializes all the components to val						
+						Vec4(real val);
+
+	/// Constructs from four components								
+						Vec4(real nx, real ny, real nz, real nw);
+
+	/// Constructs from array	
+						Vec4(const real v[4]);						
+						Vec4(const Vec4& a);
+
+	/// Random access by index
+	real				operator[](uint32_t i) const;	
+
+	/// Random access by index
+	real&				operator[](uint32_t i);						
+
+	Vec4				operator+(const Vec4& a) const;				
+	Vec4&				operator+=(const Vec4& a);					
+	Vec4 				operator-(const Vec4& a) const;				
+	Vec4&				operator-=(const Vec4& a);					
+	Vec4				operator*(real k) const;					
+	Vec4&				operator*=(real k);							
+	Vec4				operator/(real k) const;					
+	Vec4&				operator/=(real k);
+
+	/// Dot product							
+	real				dot(const Vec4& a) const;					
+
+	/// For simmetry
+	friend Vec4			operator*(real k, const Vec4& a);			
+
+	bool				operator==(const Vec4& other) const;		
+	bool				operator!=(const Vec4& other) const;
+
+	/// Returns whether all the components of this vector are smaller than all of the @other vector	
+	bool				operator<(const Vec4& other) const;	
+
+	/// Returns whether all the components of this vector are greater than all of the @other vector		
+	bool				operator>(const Vec4& other) const;			
+
+	/// Returns the vector's length
+	real				length() const;	
+
+	/// Returns the vector's squared length							
+	real				squared_length() const;
+
+	/// Sets the vector's length						
+	void				set_length(real len);
+
+	/// Normalizes the vector						
+	Vec4&				normalize();
+
+	/// Returns the normalized vector								
+	Vec4				get_normalized() const;
+
+	/// Negates the vector (i.e. builds the inverse)						
+	Vec4&				negate();	
+
+	/// Negates the vector (i.e. builds the inverse)								
+	Vec4				operator-() const;							
+
+	/// Returns the distance
+	real				get_distance_to(const Vec4& a) const;
+
+	/// Returns the angle in radians		
+	real				get_angle_between(const Vec4& a) const;		
+
+	/// Sets all components to zero
+	void				zero();										
+
+	/// Returns the pointer to the vector's data
+	real*				to_float_ptr();	
+
+	/// Returns the pointer to the vector's data							
+	const real*			to_float_ptr() const;						
 
 
 	static const Vec4	ZERO;
 	static const Vec4	ZERO;
 	static const Vec4	ONE;
 	static const Vec4	ONE;
@@ -115,11 +151,6 @@ inline Vec4::Vec4(const Vec4& a) : x(a.x), y(a.y), z(a.z), w(a.w)
 {
 {
 }
 }
 
 
-//-----------------------------------------------------------------------------
-inline Vec4::~Vec4()
-{
-}
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 inline real Vec4::operator[](uint32_t i) const
 inline real Vec4::operator[](uint32_t i) const
 {
 {