struct
Vector4DA vector in 4d.
Contents
Constructors, destructors, conversion operators
Public functions
- auto getLength(Vector4D& vector) const -> float
- Gets length of vector.
- auto toUnitVector() -> Vector4D&
- Returns this vector as a modified unit vector.
- auto normaliseToRGBA() -> Vector4D
- Normalise color values to OpenGL supporting RGBA. Eg. (128, 128, 128, 255) => (0.5f, 0.5f, 0.5f, 1.0f)
- auto add(const Vector4D& other) -> Vector4D&
- Adds other.
- auto subtract(const Vector4D& other) -> Vector4D&
- Subtracts the given other.
- auto multiply(const Vector4D& other) -> Vector4D&
- Multiplies the given other.
- auto divide(const Vector4D& other) -> Vector4D&
- Divides the given other. Returns [a/x , b/y , c/z , d/w] if [a , b , c , d] is divided by [x , y , z , w].
- auto operator==(const Vector4D& other) -> bool
- Equality operator.
- auto operator!=(const Vector4D& other) -> bool
- Inequality operator.
- auto operator+=(const Vector4D& other) -> Vector4D&
- Addition assignment operator.
- auto operator-=(const Vector4D& other) -> Vector4D&
- Subtraction assignment operator.
- auto operator*=(const Vector4D& other) -> Vector4D&
- Multiplication assignment operator.
- auto operator/=(const Vector4D& other) -> Vector4D&
- Division assignment operator.
Public variables
Friends
- auto operator<<(std::ostream& stream, const Vector4D& vector) -> std::ostream&
- Put to operator.
- auto operator+(Vector4D left, const Vector4D& right) -> Vector4D&
- Addition operator.
- auto operator-(Vector4D left, const Vector4D& right) -> Vector4D&
- Subtraction operator.
- auto operator*(Vector4D left, const Vector4D& right) -> Vector4D&
- Multiplication operator.
- auto operator/(Vector4D left, const Vector4D& right) -> Vector4D&
- Division operator.
Function documentation
RML:: Vector4D:: Vector4D(const float& x,
const float& y,
const float& z,
const float& w)
Constructor.
Parameters | |
---|---|
x | The x coordinate. |
y | The y coordinate. |
z | The z coordinate. |
w | The w coordinate. |
Vector4D& RML:: Vector4D:: toUnitVector()
Returns this vector as a modified unit vector.
Returns | Unit vector pointing in the direction of this vector. |
---|
Vector4D RML:: Vector4D:: normaliseToRGBA()
Normalise color values to OpenGL supporting RGBA. Eg. (128, 128, 128, 255) => (0.5f, 0.5f, 0.5f, 1.0f)
Returns | Color Vector4D with normalised values |
---|
bool RML:: Vector4D:: operator==(const Vector4D& other)
Equality operator.
Parameters | |
---|---|
other | The other. |
Returns | True if the parameters are considered equivalent. |
bool RML:: Vector4D:: operator!=(const Vector4D& other)
Inequality operator.
Parameters | |
---|---|
other | The other. |
Returns | True if the parameters are not considered equivalent. |
Vector4D& RML:: Vector4D:: operator+=(const Vector4D& other)
Addition assignment operator.
Parameters | |
---|---|
other | The other. |
Returns | The result of the operation. |
Vector4D& RML:: Vector4D:: operator-=(const Vector4D& other)
Subtraction assignment operator.
Parameters | |
---|---|
other | The other. |
Returns | The result of the operation. |
Vector4D& RML:: Vector4D:: operator*=(const Vector4D& other)
Multiplication assignment operator.
Parameters | |
---|---|
other | The other. |
Returns | The result of the operation. |
Vector4D& RML:: Vector4D:: operator/=(const Vector4D& other)
Division assignment operator.
Parameters | |
---|---|
other | The other. |
Returns | The result of the operation. |
std::ostream& operator<<(std::ostream& stream, const Vector4D& vector)
Put to operator.
Parameters | |
---|---|
stream | Reference to the stream to be put to. |
vector | Vector4D to be put to stream object. |
Returns | Reference to the stream been put to. |