#include "Foundation/Math/MathOperations.h"\r
\r
//----------------------------------------------------------------------------------------\r
-struct Vector2\r
+struct Vec2\r
{\r
float x;\r
float y;\r
\r
- slInline explicit Vector2() {}\r
- slInline explicit Vector2(const float xy) {x = xy; y = xy;}\r
- slInline explicit Vector2(const float ix, const float iy) {x = ix; y = iy;}\r
+ slInline explicit Vec2() {}\r
+ slInline explicit Vec2(const float xy) {x = xy; y = xy;}\r
+ slInline explicit Vec2(const float ix, const float iy) {x = ix; y = iy;}\r
\r
- slInline Vector2(const Vector2& v) {x = v.x; y = v.y;} // copy constructor\r
+ slInline Vec2(const Vec2& v) {x = v.x; y = v.y;} // copy constructor\r
\r
slInline float* AsFloatArray() {return &x;}\r
slInline const float* AsFloatArray() const {return &x;}\r
\r
\r
//----------------------------------------------------------------------------------------\r
-struct Vector3\r
+struct Vec3\r
{\r
float x;\r
float y;\r
float z;\r
\r
- slInline explicit Vector3() {}\r
- slInline explicit Vector3(const float xyz) {x = xyz; y = xyz; z = xyz;}\r
- slInline explicit Vector3(const float ix, const float iy, const float iz) {x = ix; y = iy; z = iz;}\r
+ slInline explicit Vec3() {}\r
+ slInline explicit Vec3(const float xyz) {x = xyz; y = xyz; z = xyz;}\r
+ slInline explicit Vec3(const float ix, const float iy, const float iz) {x = ix; y = iy; z = iz;}\r
\r
- slInline explicit Vector3(const Vector2& v, const float iz) {x = v.x; y = v.y; z = iz;}\r
+ slInline explicit Vec3(const Vec2& v, const float iz) {x = v.x; y = v.y; z = iz;}\r
\r
- slInline Vector3(const Vector3& v) {x = v.x; y = v.y; z = v.z;} // copy constructor\r
+ slInline Vec3(const Vec3& v) {x = v.x; y = v.y; z = v.z;} // copy constructor\r
\r
- slInline Vector2 AsVector2() const {return Vector2(x, y);}\r
+ slInline Vec2 AsVec2() const {return Vec2(x, y);}\r
\r
slInline float* AsFloatArray() {return &x;}\r
slInline const float* AsFloatArray() const {return &x;}\r
\r
\r
//----------------------------------------------------------------------------------------\r
-struct Vector4\r
+struct Vec4\r
{\r
float x;\r
float y;\r
float z;\r
float w;\r
\r
- slInline explicit Vector4() {}\r
- slInline explicit Vector4(const float xyzw) {x = xyzw; y = xyzw; z = xyzw; w = xyzw;}\r
- slInline explicit Vector4(const float xyz, const float iw) {x = xyz; y = xyz; z = xyz; w = iw;}\r
- slInline explicit Vector4(const float ix, const float iy, const float iz, const float iw) {x = ix; y = iy; z = iz; w = iw;}\r
+ slInline explicit Vec4() {}\r
+ slInline explicit Vec4(const float xyzw) {x = xyzw; y = xyzw; z = xyzw; w = xyzw;}\r
+ slInline explicit Vec4(const float xyz, const float iw) {x = xyz; y = xyz; z = xyz; w = iw;}\r
+ slInline explicit Vec4(const float ix, const float iy, const float iz, const float iw) {x = ix; y = iy; z = iz; w = iw;}\r
\r
- slInline explicit Vector4(const Vector2& u, const Vector2& v) {x = u.x; y = u.y; z = v.x; w = v.y;}\r
- slInline explicit Vector4(const Vector2& v, const float iz, const float iw) {x = v.x; y = v.y; z = iz; w = iw;}\r
+ slInline explicit Vec4(const Vec2& u, const Vec2& v) {x = u.x; y = u.y; z = v.x; w = v.y;}\r
+ slInline explicit Vec4(const Vec2& v, const float iz, const float iw) {x = v.x; y = v.y; z = iz; w = iw;}\r
\r
- slInline explicit Vector4(const Vector3& v, const float iw) {x = v.x; y = v.y; z = v.z; w = iw;}\r
+ slInline explicit Vec4(const Vec3& v, const float iw) {x = v.x; y = v.y; z = v.z; w = iw;}\r
\r
- slInline Vector4(const Vector4& v) {x = v.x; y = v.y; z = v.z; w = v.w;} // copy constructor\r
+ slInline Vec4(const Vec4& v) {x = v.x; y = v.y; z = v.z; w = v.w;} // copy constructor\r
\r
- slInline Vector2 AsVector2() const {return Vector2(x, y);}\r
- slInline Vector3 AsVector3() const {return Vector3(x, y, z);}\r
+ slInline Vec2 AsVec2() const {return Vec2(x, y);}\r
+ slInline Vec3 AsVec3() const {return Vec3(x, y, z);}\r
\r
slInline float* AsFloatArray() {return &x;}\r
slInline const float* AsFloatArray() const {return &x;}\r
float s;\r
\r
slInline explicit Quaternion() {}\r
- explicit Quaternion(const float angle, const Vector3& normalized_axis);\r
+ explicit Quaternion(const float angle, const Vec3& normalized_axis);\r
explicit Quaternion(const float angle, const float x, const float y, const float z);\r
\r
slInline Quaternion(const Quaternion& q) {i = q.i; j = q.j; k = q.k; s = q.s;}\r
\r
- Vector4 AsVector4();\r
+ Vec4 AsVec4();\r
slInline float* AsFloatArray() {return &i;}\r
\r
- Vector3 GetImaginary();\r
+ Vec3 GetImaginary();\r
slInline float GetReal() {return s;}\r
};\r
\r
-slInline Quaternion::Quaternion(const float angle, const Vector3& normalized_axis)\r
+slInline Quaternion::Quaternion(const float angle, const Vec3& normalized_axis)\r
{\r
- Assert( EpsilonEquals(LengthVector3(normalized_axis), 1.0f, kEpsilon) );\r
+ Assert( EpsilonEquals(normalized_axis.x * normalized_axis.x + normalized_axis.y * normalized_axis.y + normalized_axis.z * normalized_axis.z, 1.0f, kSqrtEpsilon) );\r
float half_angle = angle * 0.5f;\r
- float sin_half_angle = Sinf(half_angle);\r
+ float sin_half_angle = (float)Sinf(half_angle);\r
i = normalized_axis.x * sin_half_angle;\r
j = normalized_axis.y * sin_half_angle;\r
k = normalized_axis.z * sin_half_angle;\r
- s = Cosf(half_angle);\r
+ s = (float)Cosf(half_angle);\r
}\r
\r
slInline Quaternion::Quaternion(const float angle, const float x, const float y, const float z)\r
{\r
Assert( EpsilonEquals(x * x + y * y + z * z, 1.0f, kSqrtEpsilon) );\r
float half_angle = angle * 0.5f;\r
- float sin_half_angle = Sinf(half_angle);\r
+ float sin_half_angle = (float)Sinf(half_angle);\r
i = x * sin_half_angle;\r
j = y * sin_half_angle;\r
k = z * sin_half_angle;\r
- s = Cosf(half_angle);\r
+ s = (float)Cosf(half_angle);\r
}\r
\r
-Vector4 Quaternion::AsVector4()\r
+Vec4 Quaternion::AsVec4()\r
{\r
- Vector4 r;\r
+ Vec4 r;\r
r.x = i;\r
r.y = j;\r
r.z = k;\r
return r;\r
}\r
\r
-Vector3 Quaternion::GetImaginary()\r
+Vec3 Quaternion::GetImaginary()\r
{\r
- Vector3 r;\r
+ Vec3 r;\r
r.x = i;\r
r.y = j;\r
r.z = k;\r
\r
\r
//----------------------------------------------------------------------------------------\r
-struct Matrix3\r
+struct Mat3\r
{\r
- Vector3 v[3];\r
+ Vec3 v[3];\r
\r
- slInline explicit Matrix3() {}\r
- explicit Matrix3(const Vector3& v0, const Vector3& v1, const Vector3& v2);\r
- explicit Matrix3(const float v00, const float v01, const float v02,\r
- const float v10, const float v11, const float v12,\r
- const float v20, const float v21, const float v22);\r
- Matrix3(Matrix3& m); // copy constructor\r
+ slInline explicit Mat3() {}\r
+ explicit Mat3(const Vec3& v0, const Vec3& v1, const Vec3& v2);\r
+ explicit Mat3(const float v00, const float v01, const float v02,\r
+ const float v10, const float v11, const float v12,\r
+ const float v20, const float v21, const float v22);\r
+ Mat3(const Mat3& m); // copy constructor\r
\r
float* AsFloatArray() {return &v[0].x;}\r
};\r
\r
-slInline Matrix3::Matrix3(const Vector3& v0, const Vector3& v1, const Vector3& v2)\r
+slInline Mat3::Mat3(const Vec3& v0, const Vec3& v1, const Vec3& v2)\r
{\r
v[0] = v0;\r
v[1] = v1;\r
v[2] = v2;\r
}\r
\r
-slInline Matrix3::Matrix3(const float v00, const float v01, const float v02, const float v10, const float v11, const float v12, const float v20, const float v21, const float v22)\r
+slInline Mat3::Mat3(const float v00, const float v01, const float v02, const float v10, const float v11, const float v12, const float v20, const float v21, const float v22)\r
{\r
v[0].x = v00; v[0].y = v01; v[0].z = v02;\r
v[1].x = v10; v[1].y = v11; v[1].z = v12;\r
v[2].x = v20; v[2].y = v21; v[2].z = v22;\r
}\r
\r
-slInline Matrix3::Matrix3(Matrix3& m)\r
+slInline Mat3::Mat3(const Mat3& m)\r
{\r
v[0] = m.v[0];\r
v[1] = m.v[1];\r
\r
\r
//----------------------------------------------------------------------------------------\r
-struc