100 (this->
Y * vector.
Z) - (this->
Z * vector.
Y),
101 (this->
Z * vector.
X) - (this->
X * vector.
Z),
102 (this->
X * vector.
Y) - (this->
Y * vector.
X)
111 if (length == 0)
return Vector3D(0, 1, 0);
140 perm[(int)permutation.
X] = v.
X;
141 perm[(int)permutation.
Y] = v.
Y;
142 perm[(int)permutation.
Z] = v.
Z;
156 return (
X * vector.
X) + (
Y * vector.
Y) + (
Z * vector.
Z);
169 float max1 = absV.
Max();
173 return (max1 + max2) / 2.0f;
185 return (this->
X == vector.
X) && (this->
Y == vector.
Y) && (this->
Z == vector.
Z);
194 return "[" + x +
", " + y +
", " + z +
"]";
200 input.
Y > max.
Y ? input.
Y : max.
Y,
201 input.
Z > max.
Z ? input.
Z : max.
Z);
206 input.
Y < min.
Y ? input.
Y : min.
Y,
207 input.
Z < min.
Z ? input.
Z : min.
Z);
211 Vector3D startL = start, finishL = finish;
213 return finishL * ratio + startL * (1.0f - ratio);
247 return Vector3D(vector.
X * scalar, vector.
Y * scalar, vector.
Z * scalar);
251 return Vector3D(vector.
X * scalar, vector.
Y * scalar, vector.
Z * scalar);
255 return Vector3D(vector.
X / scalar, vector.
Y / scalar, vector.
Z / scalar);
260 (v1.
Y * v2.
Z) - (v1.
Z * v2.
Y),
261 (v1.
Z * v2.
X) - (v1.
X * v2.
Z),
262 (v1.
X * v2.
Y) - (v1.
Y * v2.
X)
267 return (v1.
X * v2.
X) + (v1.
Y * v2.
Y) + (v1.
Z * v2.
Z);
277 return (v1.
X == v2.
X) && (v1.
Y == v2.
Y) && (v1.
Z == v2.
Z);
286 return !(this->
IsEqual(vector));
Defines a 3D vector and various related operations.
static float Sqrt(float value)
Computes the square root of a value.
static T Min(T value1, T value2)
Returns the minimum of two values.
static bool IsClose(float v1, float v2, float epsilon)
Checks if two values are close within a specified epsilon.
static String DoubleToCleanString(float value)
Converts a floating-point value to a String, removing trailing decimals if not needed.
static T Max(T value1, T value2)
Returns the maximum of two values.
static const float MPID180
The value of , useful for converting degrees to radians.
static const float EPSILON
A small constant used for floating-point comparisons.
static T Constrain(T value, T minimum, T maximum)
Constrains a value between minimum and maximum.
static const float M180DPI
The value of , useful for converting radians to degrees.
Vector3D Normal() const
Computes the squared magnitude of the vector (X^2 + Y^2 + Z^2).
float Max() const
Returns the maximum component value among X, Y, Z.
float Min() const
Returns the minimum component value among X, Y, Z.
Vector3D operator-(const Vector3D &vector) const
Subtraction operator. Subtracts two vectors component-wise.
static Vector3D RadiansToDegrees(const Vector3D &radians)
Converts a Vector3D of radians to degrees (component-wise).
bool operator==(const Vector3D &vector) const
Equality operator. Checks if two Vector3Ds are equal (component-wise).
Vector3D CrossProduct(const Vector3D &vector) const
Computes the cross product of this vector with another Vector3D.
Vector3D Divide(const Vector3D &vector) const
Divides this vector by another Vector3D component-wise.
Vector3D operator+(const Vector3D &vector) const
Addition operator. Adds two vectors component-wise.
float AverageHighestTwoComponents() const
Computes the average of the highest two components of this vector.
Vector3D operator+=(const Vector3D &vector)
In-place addition operator. Adds another vector to this one component-wise.
Vector3D operator*(const Vector3D &vector) const
Multiplication operator. Multiplies two vectors component-wise.
Vector3D operator/(const Vector3D &vector) const
Division operator. Divides two vectors component-wise.
static Vector3D LERP(const Vector3D &start, const Vector3D &finish, const float &ratio)
Performs linear interpolation between two Vector3Ds.
String ToString() const
Converts the vector to a string representation.
Vector3D operator=(const Vector3D &vector)
Assignment operator. Copies another Vector3D into this one.
float Z
The Z-component of the 3D vector.
static Vector3D DegreesToRadians(const Vector3D °rees)
Converts a Vector3D of degrees to radians (component-wise).
Vector3D UnitSphere() const
Normalizes this vector such that its magnitude is 1 (if non-zero).
Vector3D Permutate(const Vector3D &permutation) const
Permutates the components of this vector using another Vector3D as an index/offset.
Vector3D Multiply(const Vector3D &vector) const
Multiplies this vector by another Vector3D component-wise.
Vector3D Constrain(const float &minimum, const float &maximum) const
Constrains each component of this vector between two scalar bounds.
float X
The X-component of the 3D vector.
float Y
The Y-component of the 3D vector.
float DotProduct(const Vector3D &vector) const
Computes the dot product of this vector with another Vector3D.
float CalculateEuclideanDistance(const Vector3D &vector) const
Calculates the Euclidean distance between this vector and another Vector3D.
float Magnitude() const
Computes the magnitude (length) of this vector using the formula sqrt(X^2 + Y^2 + Z^2).
bool IsEqual(const Vector3D &vector) const
Checks if this vector is equal to another Vector3D component-wise.
Vector3D Add(const float &value) const
Adds a scalar value to each component of the vector.
Vector3D Absolute() const
Returns a vector with the absolute value of each component.
Vector3D()
Constructs a default Vector3D with X = 0, Y = 0, and Z = 0.
Vector3D Subtract(const float &value) const
Subtracts a scalar value from each component of the vector.
bool operator!=(const Vector3D &vector) const
Inequality operator. Checks if two Vector3Ds differ (component-wise).