StevEngine
StevEngine is a customizable C++ game engine.
Loading...
Searching...
No Matches
StevEngine::Utilities::Vector4 Class Reference

4D vector class More...

#include <utilities/Vector4.hpp>

Public Member Functions

 Vector4 (double w, double x, double y, double z)
 Create vector from components.
 
 Vector4 (const Vector4 &from)
 Copy constructor.
 
 Vector4 (double w, const Vector3 &vec3)
 Create from scalar and 3D vector.
 
 Vector4 (double v)
 Create vector with all components equal.
 
 Vector4 ()
 Create zero vector.
 
Vector4 Get () const
 Get copy of this vector.
 
double Magnitude () const
 Get vector length.
 
Vector4Normalize ()
 Normalize this vector.
 
Vector4 Normalized () const
 Get normalized copy.
 
Vector4 operator+ (const Vector4 &other) const
 Addition.
 
Vector4 operator- (const Vector4 &other) const
 Subtraction.
 
Vector4 operator- () const
 Negation.
 
Vector4operator+= (const Vector4 &other)
 Add-assign.
 
Vector4operator-= (const Vector4 &other)
 Subtract-assign.
 
Vector4 operator* (const double &other) const
 Scalar multiplication.
 
Vector4 operator/ (const double &other) const
 Scalar division.
 
bool operator== (const Vector4 &other) const
 Equality comparison.
 
 operator std::string () const
 Convert to string.
 
 operator Quaternion () const
 Convert to Quaternion.
 
const float * data () const
 Get raw float array.
 

Static Public Member Functions

static double Dot (const Vector4 &a, const Vector4 &b)
 Calculate dot product.
 

Public Attributes

double W
 
double X
 
double Y
 
double Z
 Vector components.
 

Detailed Description

4D vector class

Represents a point or direction in 4D space. Used for homogeneous coordinates and quaternion math.

Constructor & Destructor Documentation

◆ Vector4() [1/4]

StevEngine::Utilities::Vector4::Vector4 ( double w,
double x,
double y,
double z )

Create vector from components.

Parameters
wW component
xX component
yY component
zZ component

◆ Vector4() [2/4]

StevEngine::Utilities::Vector4::Vector4 ( const Vector4 & from)

Copy constructor.

Parameters
fromVector to copy

◆ Vector4() [3/4]

StevEngine::Utilities::Vector4::Vector4 ( double w,
const Vector3 & vec3 )

Create from scalar and 3D vector.

Parameters
wW component
vec3XYZ components

◆ Vector4() [4/4]

StevEngine::Utilities::Vector4::Vector4 ( double v)

Create vector with all components equal.

Parameters
vValue for all components

Member Function Documentation

◆ Dot()

double StevEngine::Utilities::Vector4::Dot ( const Vector4 & a,
const Vector4 & b )
static

Calculate dot product.

Parameters
aFirst vector
bSecond vector
Returns
Dot product

The documentation for this class was generated from the following files: