4D vector structure for mathematical operations.
More...
#include <Vector4.h>
|
| Vector4 () |
| Default constructor. Initializes all components to 0.0f.
|
|
| Vector4 (float inX, float inY, float inZ, float inW) |
| Constructor with component values.
|
|
float | LengthSqr () const |
| Returns the squared length of the vector.
|
|
float | Length () const |
| Returns the length (magnitude) of the vector.
|
|
void | Normalize () |
| Normalizes the vector in place.
|
|
const float * | GetAsFloatPtr () const |
| Returns a pointer to the first component as a float array.
|
|
void | Set (float inX, float inY, float inZ, float inW) |
| Sets all four components of the vector.
|
|
float & | operator[] (int i) |
| Accesses a component by index.
|
|
Vector4 & | operator*= (float scalar) |
| Multiplies the vector by a scalar in place.
|
|
Vector4 & | operator+= (const Vector4 &right) |
| Adds another vector to this vector in place.
|
|
Vector4 & | operator-= (const Vector4 &right) |
| Subtracts another vector from this vector in place.
|
|
|
float | x |
| X component.
|
|
float | y |
| Y component.
|
|
float | z |
| Z component.
|
|
float | w |
| W component.
|
|
4D vector structure for mathematical operations.
◆ Vector4()
Vector4::Vector4 |
( |
float | inX, |
|
|
float | inY, |
|
|
float | inZ, |
|
|
float | inW ) |
|
inline |
Constructor with component values.
- Parameters
-
inX | X component |
inY | Y component |
inZ | Z component |
inW | W component |
◆ Cross()
Computes the cross product of two vectors.
- Parameters
-
a | First vector |
b | Second vector |
- Returns
- Cross product vector
- Note
- The w component is not set by this operation.
◆ Dot()
Computes the dot product of two vectors.
- Parameters
-
a | First vector |
b | Second vector |
- Returns
- Dot product (a.x * b.x + a.y * b.y + a.z * b.z)
◆ GetAsFloatPtr()
const float * Vector4::GetAsFloatPtr |
( |
| ) |
const |
|
inline |
Returns a pointer to the first component as a float array.
- Returns
- Pointer to the float array of components
◆ Length()
float Vector4::Length |
( |
| ) |
const |
Returns the length (magnitude) of the vector.
- Returns
- Length of the vector
◆ LengthSqr()
float Vector4::LengthSqr |
( |
| ) |
const |
Returns the squared length of the vector.
- Returns
- Squared length (x^2 + y^2 + z^2 + w^2)
◆ Lerp()
Linearly interpolates between two vectors.
- Parameters
-
a | Start vector |
b | End vector |
f | Interpolation factor [0, 1] |
- Returns
- Interpolated vector
◆ Normalize()
Returns a normalized copy of the provided vector.
- Parameters
-
- Returns
- Normalized vector
◆ operator*=()
Vector4 & Vector4::operator*= |
( |
float | scalar | ) |
|
|
inline |
Multiplies the vector by a scalar in place.
- Parameters
-
- Returns
- Reference to this vector
◆ operator+=()
Adds another vector to this vector in place.
- Parameters
-
- Returns
- Reference to this vector
◆ operator-=()
Subtracts another vector from this vector in place.
- Parameters
-
- Returns
- Reference to this vector
◆ operator[]()
float & Vector4::operator[] |
( |
int | i | ) |
|
|
inline |
Accesses a component by index.
- Parameters
-
i | Index (0=x, 1=y, 2=z, 3=w) |
- Returns
- Reference to the component
◆ Reflect()
Reflects a vector about a normal.
- Parameters
-
v | Vector to reflect |
n | Normal vector (should be normalized) |
- Returns
- Reflected vector
◆ Set()
void Vector4::Set |
( |
float | inX, |
|
|
float | inY, |
|
|
float | inZ, |
|
|
float | inW ) |
|
inline |
Sets all four components of the vector.
- Parameters
-
inX | X component |
inY | Y component |
inZ | Z component |
inW | W component |
◆ operator* [1/3]
Component-wise multiplication.
- Parameters
-
left | Left vector |
right | Right vector |
- Returns
- Result of left * right
◆ operator* [2/3]
Scalar multiplication.
- Parameters
-
vec | Vector |
scalar | Scalar value |
- Returns
- Result of vec * scalar
◆ operator* [3/3]
Scalar multiplication.
- Parameters
-
scalar | Scalar value |
vec | Vector |
- Returns
- Result of scalar * vec
◆ operator+
Vector addition.
- Parameters
-
a | First vector |
b | Second vector |
- Returns
- Result of a + b
◆ operator-
Vector subtraction.
- Parameters
-
a | First vector |
b | Second vector |
- Returns
- Result of a - b
The documentation for this struct was generated from the following files:
- D:/DEV JEUX/2025/CPP/Opengl/ClutterEngineOpenGL/ClutterEngine/Engine/Core/Maths/Vectors/Vector4.h
- D:/DEV JEUX/2025/CPP/Opengl/ClutterEngineOpenGL/ClutterEngine/Engine/Core/Maths/Vectors/Vector4.cpp