@@ -9,15 +9,12 @@
namespace crown
{
+/// @addtogroup Math
+/// @{
/// Holds RGBA color as four floats.
-///
-/// @ingroup Math
typedef Vector4 Color4;
-/// Functions to mamipulate Color4
Color4 from_rgb(int r, int g, int b);
Color4 from_rgba(int r, int g, int b, int a);
Color4 from_rgba(uint32_t rgba);
@@ -263,4 +260,5 @@ inline uint32_t to_abgr(const Color4& c)
return abgr;
}
+/// @}
} // namespace crown
@@ -12,6 +12,8 @@
const float PI = 3.1415926535897932f;
const float TWO_PI = PI * 2.0f;
const float HALF_PI = PI * 0.5f;
@@ -203,4 +205,6 @@ inline T catmull_rom(const T& p0, const T& p1, const T& p2, const T& p3, float t
return tmp * 0.5;
+
@@ -11,11 +11,10 @@
-/// Functions to manipulate Matrix3x3
-const Matrix3x3 IDENTITY = { {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f} };
+const Matrix3x3 MATRIX3X3_IDENTITY = { {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f} };
inline Matrix3x3 matrix3x3(const Vector3& x, const Vector3& y, const Vector3& z)
@@ -108,7 +107,7 @@ inline Matrix3x3 operator*(Matrix3x3 a, float k)
return a;
-/// @copydoc operator*(Matrix3x3, float)
+/// Multiplies the matrix @a a by the scalar @a k and returns the result.
inline Matrix3x3 operator*(float k, Matrix3x3 a)
a *= k;
@@ -326,4 +325,5 @@ inline const float* to_float_ptr(const Matrix3x3& m)
return &m.x.x;
@@ -12,10 +12,9 @@
-/// Functions to manipulate Matrix4x4.
const Matrix4x4 MATRIX4X4_IDENTITY = { {1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, { 0.0f, 0.0f, 1.0f, 0.0f}, { 0.0f, 0.0f, 0.0f, 1.0f} };
inline Matrix4x4 matrix4x4(float r1c1, float r2c1, float r3c1, float r4c1,
@@ -187,7 +186,7 @@ inline Matrix4x4 operator*(Matrix4x4 a, float k)
-/// @copydoc operator*(Matrix4x4, float)
inline Matrix4x4 operator*(float k, Matrix4x4 a)
@@ -564,4 +563,5 @@ inline const float* to_float_ptr(const Matrix4x4& m)
return to_float_ptr(m.x);
@@ -11,10 +11,9 @@
-/// Functions to manipulate Quaternion.
const Quaternion QUATERNION_IDENTITY = { 0.0f, 0.0f, 0.0f, 1.0f };
inline Quaternion quaternion(float x, float y, float z, float w)
@@ -123,4 +122,5 @@ inline Quaternion power(const Quaternion& q, float exp)
return q;
+// @}
-/// Functions to manipulate Vector2.
const Vector2 VECTOR2_ZERO = { 0.0f, 0.0f };
inline Vector2 vector2(float x, float y)
@@ -82,7 +81,7 @@ inline Vector2 operator*(Vector2 a, float k)
-/// @copydoc operator*(Vector2, float)
+/// Multiplies the vector @a a by the scalar @a k and returns the result.
inline Vector2 operator*(float k, Vector2 a)
@@ -156,10 +155,11 @@ inline float* to_float_ptr(Vector2& a)
return &a.x;
-/// @copydoc to_float_ptr(Vector2&)
+/// Returns the pointer to the data of @a a.
inline const float* to_float_ptr(const Vector2& a)
-/// Functions to manipulate Vector3.
const Vector3 VECTOR3_ZERO = { 0.0f, 0.0f, 0.0f };
const Vector3 VECTOR3_XAXIS = { 1.0f, 0.0f, 0.0f };
const Vector3 VECTOR3_YAXIS = { 0.0f, 1.0f, 0.0f };
@@ -97,7 +96,7 @@ inline Vector3 operator*(Vector3 a, float k)
-/// @copydoc operator*(Vector3, float)
inline Vector3 operator*(float k, Vector3 a)
@@ -179,7 +178,7 @@ inline float* to_float_ptr(Vector3& a)
-/// @copydoc to_float_ptr(Vector3&)
inline const float* to_float_ptr(const Vector3& a)
@@ -191,4 +190,5 @@ inline Vector2 to_vector2(const Vector3& a)
return vector2(a.x, a.y);
-/// Functions to manipulate Vector4.
const Vector4 VECTOR4_ZERO = { 0.0f, 0.0f, 0.0f, 0.0f };
const Vector4 VECTOR4_XAXIS = { 1.0f, 0.0f, 0.0f, 0.0f };
const Vector4 VECTOR4_YAXIS = { 0.0f, 1.0f, 0.0f, 0.0f };
@@ -110,7 +109,7 @@ inline Vector4 operator*(Vector4 a, float k)
-/// @copydoc operator*(Vector4, float)
inline Vector4 operator*(float k, Vector4 a)
@@ -188,7 +187,7 @@ inline float* to_float_ptr(Vector4& a)
-/// @copydoc to_float_ptr(Vector4&)
inline const float* to_float_ptr(const Vector4& a)
@@ -199,4 +198,5 @@ inline Vector3 to_vector3(const Vector4& a)
return vector3(a.x, a.y, a.z);