123 return Vector3D(fabs(other.
x), fabs(other.
y), fabs(other.
z));
135 return a.
x < scalar && a.
y < scalar && a.
z < scalar;
146 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z;
201 return sqrtf32(v.
x * v.
x + v.
y * v.
y + v.
z * v.
z);
238 return (a / mag) * (
Dot(a, b) / mag);
250 if (mag == 0) mag = 1;
269 return x == other.
x &&
y == other.
y &&
z == other.
z;
275 return abs(*
this - other) < tolerance;
302 float n10,
float n11,
float n12,
303 float n20,
float n21,
float n22)
356 return (*
reinterpret_cast<Vector3D *
>(n[i]));
364 return (*
reinterpret_cast<const Vector3D *
>(n[i]));
372 return Vector3D(n[0][j], n[1][j], n[2][j]);
380 return Vector3D(n[0][j], n[1][j], n[2][j]);
388 return (*
this)[0] == other[0] && (*this)[1] == other[1] && (*this)[2] == other[2];
396 return (*
this)[0].equals(other[0], tolerance) && (*this)[1].equals(other[2], tolerance) && (*this)[1].equals(other[2], tolerance);
409 Dot(A[1], col0),
Dot(A[1], col1),
Dot(A[1], col2),
410 Dot(A[2], col0),
Dot(A[2], col1),
Dot(A[2], col2));
429 os <<
"Vector: " << v.
x <<
", " << v.
y <<
", " << v.
z;
441 os <<
"Matrix: " << std::endl
bool equals(const Matrix3D &other, float tolerance)
Definition: TinyMath.hpp:394
bool operator==(const Matrix3D &other)
Definition: TinyMath.hpp:386
Vector3D column(int j)
Definition: TinyMath.hpp:370
float & operator ()(int i, int j)
Definition: TinyMath.hpp:337
Matrix3D(float n00, float n01, float n02, float n10, float n11, float n12, float n20, float n21, float n22)
Definition: TinyMath.hpp:301
Matrix3D() = default
Default constructor.
Matrix3D(const Vector3D &a, const Vector3D &b, const Vector3D &c)
Definition: TinyMath.hpp:319
Vector3D CrossProduct(const Vector3D &a, const Vector3D &b)
Definition: TinyMath.hpp:262
const Vector3D & operator[](int i) const
Definition: TinyMath.hpp:362
Vector3D Normalize(const Vector3D &v)
Definition: TinyMath.hpp:247
Vector3D operator+(const Vector3D &a, const Vector3D &b)
Definition: TinyMath.hpp:210
float Magnitude(const Vector3D &v)
Definition: TinyMath.hpp:199
Vector3D operator-(const Vector3D &a, const Vector3D &b)
Definition: TinyMath.hpp:223
Vector3D column(int j) const
Definition: TinyMath.hpp:378
Vector3D operator/(const Vector3D &v, float s)
Definition: TinyMath.hpp:178
Vector3D operator*(const Matrix3D &M, const Vector3D &v)
Definition: TinyMath.hpp:416
float Dot(const Vector3D &a, const Vector3D &b)
Definition: TinyMath.hpp:144
Vector3D & operator[](int i)
Definition: TinyMath.hpp:354
bool operator<(const Vector3D &a, float scalar)
Definition: TinyMath.hpp:133
bool equals(const Vector3D &other, float tolerance)
Definition: TinyMath.hpp:273
bool operator==(const Vector3D &other)
Definition: TinyMath.hpp:267
static Vector3D abs(const Vector3D &other)
Definition: TinyMath.hpp:121
Vector3D & operator-=(const Vector3D &v)
Definition: TinyMath.hpp:92
Vector3D & operator+=(const Vector3D &v)
Definition: TinyMath.hpp:78
Vector3D & operator/=(float s)
Definition: TinyMath.hpp:64
Vector3D & operator*=(float s)
Definition: TinyMath.hpp:53
const float & operator[](int i) const
Definition: TinyMath.hpp:44
Vector3D Project(const Vector3D &a, const Vector3D &b)
Definition: TinyMath.hpp:235
float & operator[](int i)
Definition: TinyMath.hpp:35
Vector3D(float a, float b)
Definition: TinyMath.hpp:29
Vector3D(float a, float b, float c)
Definition: TinyMath.hpp:27
std::ostream & operator<<(std::ostream &os, const Matrix3D &m)
Definition: TinyMath.hpp:439
Vector3D() = default
Default constructor.
float z
Definition: TinyMath.hpp:19
float y
Definition: TinyMath.hpp:19
float x
Definition: TinyMath.hpp:19
Definition: TinyMath.hpp:281
Definition: TinyMath.hpp:15