26 array<float, 3>
data { 0.0f, 0.0f, 0.0f };
41 inline Vector3(
float x,
float y,
float z) {
51 inline Vector3(
const array<float,3>& vector3) {
227 return (
this == &vector3) ||
306 if (Float::isNaN(sign) ==
true) sign = 1.0f;
307 return Math::mod(((angle * sign) + 360.0f), 360.0f);
325 auto b =
Vector3(0.0f, 1.0f, 0.0f);
326 auto n =
Vector3(1.0f, 0.0f, 0.0f);
332 auto b =
Vector3(0.0f, 0.0f, -1.0f);
333 auto n =
Vector3(0.0f, 1.0f, 0.0f);
339 auto b =
Vector3(0.0f, 1.0f, 0.0f);
340 auto n =
Vector3(0.0f, 0.0f, 1.0f);
357 (b.
data[0] * t) + ((1.0f - t) * a.
data[0]),
358 (b.
data[1] * t) + ((1.0f - t) * a.
data[1]),
359 (b.
data[2] * t) + ((1.0f - t) * a.
data[2])
367 return (array<float,3>&)
data;
412 auto r = this->
clone().
add(vector3);
432 auto r = this->
clone().
sub(vector3);
472 auto vInverted =
Vector3(1.0f / vector3[0], 1.0f / vector3[1], 1.0f / vector3[2]);
483 return this->
add(scalar);
492 return this->
add(vector3);
501 return this->
sub(scalar);
510 return this->
sub(vector3);
519 return this->
scale(scalar);
528 return this->
scale(vector3);
537 return this->
scale(1.0f / scalar);
546 auto vInverted =
Vector3(1.0f / vector3[0], 1.0f / vector3[1], 1.0f / vector3[2]);
547 return this->
scale(vInverted);
556 return this->
equals(vector3);
565 return this->
equals(vector3) ==
false;
static float sqrt(float value)
Returns the square root of given value.
static auto mod(auto value, auto range)
Returns modulo of value, so that return value is -range < value < range.
static constexpr float EPSILON
static auto abs(auto value)
Returns absolute value.
static float acos(float x)
Returns the arc cosine of x.
static constexpr float PI
static auto sign(auto value)
Returns sign of value.
static auto clamp(auto value, auto min, auto max)
Clamps a value to min or max value.
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Quaternion class representing quaternion mathematical structure and operations with x,...
Vector3 class representing vector3 mathematical structure and operations with x, y,...
static float computeDotProduct(const Vector3 &a, const Vector3 &b)
Computes the dot product of a and b.
Vector3 & setX(float x)
Sets x component.
const float & operator[](int i) const
Const array access operator.
Vector3 operator/(const float scalar) const
Operator / scalar.
Vector3(float x, float y, float z)
Public constructor.
float & operator[](int i)
Array access operator.
static Vector3 computeCrossProduct(const Vector3 &a, const Vector3 &b)
Computes the cross product of a and b.
float computeLength() const
Vector3 operator+(const float scalar) const
Operator + scalar.
Vector3 & scale(const Vector3 &vector3)
Scales by vector3.
Vector3 computeEulerAngles() const
Computes Euler angles.
Vector3 & add(float scalar)
Adds a scalar.
bool operator!=(const Vector3 &vector3) const
Non equality comparison operator.
Vector3 & setY(float y)
Sets y component.
Vector3 & sub(const Vector3 &vector3)
Subtracts a vector3.
Vector3 & operator+=(const float scalar)
Operator += scalar.
bool operator==(const Vector3 &vector3) const
Equality comparison operator.
static Vector3 interpolateLinear(const Vector3 &a, const Vector3 &b, float t)
Interpolates between a and b by 0f<=t<=1f linearly.
const array< float, 3 > & getArray() const
Vector3 operator-(const float scalar) const
Operator - scalar.
Vector3 & add(const Vector3 &vector3)
Adds a vector3.
float computeLengthSquared() const
Vector3(const array< float, 3 > &vector3)
Public constructor.
Vector3 clone() const
Clones this vector3.
Vector3 & operator*=(const float scalar)
Operator *= scalar.
Vector3 & sub(float scalar)
Subtracts a scalar.
Vector3 & scale(float scalar)
Scales by scalar.
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.
Vector3 & operator/=(const float scalar)
Operator /= scalar.
Vector3 & setZ(float z)
Sets z component.
Vector3()
Public constructor.
Vector3 & set(const array< float, 3 > &vector3)
Sets this vector3 by array.
Vector3(const Vector3 &vector3)
Public constructor.
Vector3 operator*(const float scalar) const
Operator * scalar.
Vector3 & set(const Vector3 &vector3)
Sets this vector3 by given vector3.
static float computeAngle(const Vector3 &a, const Vector3 &b, const Vector3 &n)
Computes angle between a and b from, where 0.0 <= angle < 360.0.
static float computeAngle(const Vector3 &a, const Vector3 &b)
Computes angle between a and b from 0.0 <= angle < 180.0.
bool equals(const Vector3 &vector3, float tolerance=Math::EPSILON) const
Compares this vector3 with given vector3.
Vector3 & operator-=(const float scalar)
Operator -= scalar.
Vector3 & normalize()
Normalizes this vector3.
Vector4 class representing vector4 mathematical structure and operations with x, y,...