24 memset (
mVector, 0,
sizeof (
float ) * 3 );
34 memcpy (
mVector, aVector,
sizeof (
float ) * 3 );
44 mVector[0] = * (
reinterpret_cast<const float*
> ( aVector ) );
45 mVector[1] = * (
reinterpret_cast<const float*
> (
reinterpret_cast<const uint8_t*
> ( aVector ) + ( aStride ) ) );
46 mVector[2] = * (
reinterpret_cast<const float*
> (
reinterpret_cast<const uint8_t*
> ( aVector ) + ( aStride * 2 ) ) );
51 return Dot ( *
this, *
this );
99 memcpy ( aData,
mVector,
sizeof (
float ) * 3 );
133 assert ( aIndex < 3 );
139 assert ( aIndex < 3 );
163 return Vector3 ( aLhs ) -= aRhs;
178 return Vector3 ( aLhs ) += aRhs;
215 return Vector3 ( aLhs ) *= aRhs;
223 return Vector3 ( aLhs ) /= aRhs;
231 return Vector3 ( aRhs ) *= aLhs;
236 return Vector3 ( aRhs ) *= aLhs;
259 float magnitude = sqrtf (
Dot ( aVector, aVector ) );
260 assert ( magnitude != 0.0f );
262 aVector.
GetX() / magnitude,
263 aVector.
GetY() / magnitude,
264 aVector.
GetZ() / magnitude );
270 std::abs ( aVector[0] ),
271 std::abs ( aVector[1] ),
272 std::abs ( aVector[2] )
277 double i2 = interpolation * interpolation;
278 double i3 = i2 * interpolation;
281 ( p2[0] - p0[0] ) / 2.0,
282 ( p2[1] - p0[1] ) / 2.0,
283 ( p2[2] - p0[2] ) / 2.0
288 ( p3[0] - p1[0] ) / 2.0,
289 ( p3[1] - p1[1] ) / 2.0,
290 ( p3[2] - p1[2] ) / 2.0
294 static_cast<float> ( ( 2 * i3 - 3 * i2 + 1 ) * p1[0] + ( -2 * i3 + 3 * i2 ) * p2[0] + ( i3 - 2 * i2 + interpolation ) * t0[0] + ( i3 - i2 ) * t1[0] ),
295 static_cast<float> ( ( 2 * i3 - 3 * i2 + 1 ) * p1[1] + ( -2 * i3 + 3 * i2 ) * p2[1] + ( i3 - 2 * i2 + interpolation ) * t0[1] + ( i3 - i2 ) * t1[1] ),
296 static_cast<float> ( ( 2 * i3 - 3 * i2 + 1 ) * p1[2] + ( -2 * i3 + 3 * i2 ) * p2[2] + ( i3 - 2 * i2 + interpolation ) * t0[2] + ( i3 - i2 ) * t1[2] )
Inline functions related to 3D Math.
Header for the plane class.
Header for the 3D vector class.
DLL const float & GetDistance() const
Get the distance from the origin to the plane.
DLL const Vector3 & GetNormal() const
Get the plane normal vector.
DLL float GetLenghtSquared() const
Get the squared length of the vector.
DLL const float *const GetVector3() const
Get a pointer to the internal vector data.
DLL float operator[](const size_t aIndex) const
Access a component by index (const).
DLL float GetMaxAxisLenght() const
Get the absolute value of the largest axis component.
DLL const float & GetZ() const
Get the Z component.
DLL float GetMinAxisLenght() const
Get the absolute value of the smallest axis component.
DLL size_t GetMaxAxisIndex() const
Get the index of the axis with the largest absolute value.
DLL float GetDistanceToPlane(const Plane &aPlane) const
Get the signed distance from this point to a plane.
DLL float GetLenght() const
Get the length of the vector.
DLL Vector3 & operator=(const float *aLhs)
Assign from a raw float array.
DLL Vector3 & operator*=(const float aLhs)
Scale this vector by a scalar.
DLL Vector3 & operator/=(const float aLhs)
Divide this vector by a scalar.
DLL void SetVector3(const float *const aVector)
Set the vector from a float array.
DLL bool IsZero() const
Check whether all components are zero.
DLL Vector3 & operator-=(const Vector3 &aLhs)
Subtract a vector from this vector.
DLL const float & GetY() const
Get the Y component.
DLL Vector3()
Default constructor.
DLL Vector3 & operator+=(const Vector3 &aLhs)
Add a vector to this vector.
DLL const float & GetX() const
Get the X component.
DLL void Get(float *aData) const
Copy vector data to an external float array.
DLL size_t GetMinAxisIndex() const
Get the index of the axis with the smallest absolute value.
<- This is here just for the literals
DLL const Vector3 Spline(const Vector3 &p0, const Vector3 &p1, const Vector3 &p2, const Vector3 &p3, double interpolation)
Catmull-Rom spline interpolation between four control points.
DLL bool operator!=(const Vector3 &aLhs, const Vector3 &aRhs)
Inequality comparison operator.
DLL const Vector3 operator/(const Vector3 &aLhs, const float aRhs)
Scalar division operator.
DLL const Matrix3x3 operator*(const Matrix3x3 &lhs, const Matrix3x3 &rhs)
Multiplies two 3x3 matrices. Multiplies two 3x3 matrices.
DLL const float Dot(const Vector3 &aLhs, const Vector3 &aRhs)
Compute the dot product of two vectors.
DLL const Vector3 operator+(const Vector3 &aLhs, const Vector3 &aRhs)
Addition operator.
DLL const Matrix3x3 Abs(const Matrix3x3 &aMatrix3x3)
Compute the element-wise absolute value of a matrix.
DLL const Vector3 Cross(const Vector3 &aLhs, const Vector3 &aRhs)
Compute the cross product of two vectors.
DLL const Vector3 operator-(const Vector3 &aLhs, const Vector3 &aRhs)
Subtraction operator.
DLL const bool operator==(const Matrix3x3 &lhs, const Matrix3x3 &rhs)
Compare two 3x3 matrices for equality.
DLL const Vector3 Normalize(const Vector3 &aVector)
Return a normalized (unit length) copy of the vector.