Vector4 is a 4D vector class used in graphics, math, and color representations. It supports arithmetic, normalization, dot/cross products, and interpolation.
More...
#include <Vector4.h>
|
float | x = 0 |
|
float | y = 0 |
|
float | z = 0 |
|
float | w = 0 |
|
Vector4 is a 4D vector class used in graphics, math, and color representations. It supports arithmetic, normalization, dot/cross products, and interpolation.
◆ Vector4() [1/3]
Default constructor. Initializes components to zero.
◆ Vector4() [2/3]
Vector4::Vector4 |
( |
float | x, |
|
|
float | y, |
|
|
float | z, |
|
|
float | w ) |
Constructor with individual components.
- Parameters
-
x | X component. |
y | Y component. |
z | Z component. |
w | W component. |
◆ Vector4() [3/3]
Vector4::Vector4 |
( |
Vector3 | vec3, |
|
|
float | w = 0 ) |
Constructs a Vector4 from a Vector3 and a w component.
- Parameters
-
vec3 | The 3D vector to use for x, y, z. |
w | The w component (default: 0.0f). |
◆ Cross()
Computes the 3D cross product of two vectors (ignores w).
- Parameters
-
a | First vector. |
b | Second vector. |
- Returns
- Resulting vector from cross product (w = 0).
◆ Dot()
Computes the dot product between two vectors.
- Parameters
-
a | First vector. |
b | Second vector. |
- Returns
- Dot product result.
◆ GetAsFloatPtr()
const float * Vector4::GetAsFloatPtr |
( |
| ) |
const |
Gets a float pointer to the vector's data.
- Returns
- Pointer to the first component (x).
◆ Lerp()
Linearly interpolates between two vectors.
- Parameters
-
a | Start vector. |
b | End vector. |
f | Interpolation factor (0.0 to 1.0). |
- Returns
- Interpolated vector.
◆ Magnitude()
float Vector4::Magnitude |
( |
| ) |
const |
Computes the magnitude (length) of the vector.
- Returns
- Magnitude of the vector.
◆ MagnitudeSqr()
float Vector4::MagnitudeSqr |
( |
| ) |
const |
Computes the squared magnitude of the vector.
- Returns
- Squared magnitude.
◆ Normalize() [1/2]
void Vector4::Normalize |
( |
| ) |
|
Normalizes the vector to unit length.
◆ Normalize() [2/2]
Returns a normalized copy of the input vector.
- Parameters
-
- Returns
- Normalized vector.
◆ operator*=()
Vector4 & Vector4::operator*= |
( |
float | scalar | ) |
|
◆ operator+=()
◆ operator-=()
◆ operator[]()
float & Vector4::operator[] |
( |
int | i | ) |
|
Accesses a component by index (0 = x, 1 = y, 2 = z, 3 = w).
- Parameters
-
- Returns
- Reference to the component.
◆ Reflect()
Reflects a vector across a normal vector.
- Parameters
-
v | Incoming vector. |
n | Normal vector (should be normalized). |
- Returns
- Reflected vector.
◆ ToString()
std::string Vector4::ToString |
( |
| ) |
const |
Converts the vector to a readable string format.
- Returns
- String in format (x , y , z , w).
◆ Matrix4
◆ operator* [1/3]
◆ operator* [2/3]
◆ operator* [3/3]
◆ operator+
◆ operator-
◆ ONE
◆ ZERO
The documentation for this struct was generated from the following files: