CodeSubWars 0.4.7b
ARSTD::Vector4< Type > Struct Template Reference

#include <Vector4.h>

Public Member Functions

 Vector4 (const Type &x=0, const Type &y=0, const Type &z=0, const Type &w=1)
 
const Type getLength () const
 
const Type getSquaredLength () const
 
const Vector4< Type > & normalize ()
 
Vector4< Type > getNormalized () const
 

Related Functions

(Note that these are not member functions.)

template<class Type >
bool equals (const Vector4< Type > &lhs, const Vector4< Type > &rhs, double fEpsilon=EPSILON)
 
template<class Type >
bool operator== (const Vector4< Type > &lhs, const Vector4< Type > &rhs)
 
template<class Type >
bool operator!= (const Vector4< Type > &lhs, const Vector4< Type > &rhs)
 
template<class Type >
std::ostream & operator<< (std::ostream &stream, const Vector4< Type > &vec)
 
template<class Type >
std::istream & operator>> (std::istream &stream, Vector4< Type > &vec)
 

Detailed Description

template<class Type>
struct ARSTD::Vector4< Type >

This represents a 4-dimensional vector

Constructor & Destructor Documentation

◆ Vector4()

template<class Type >
ARSTD::Vector4< Type >::Vector4 ( const Type &  x = 0,
const Type &  y = 0,
const Type &  z = 0,
const Type &  w = 1 
)

Constructs a vector from given components

Parameters
xx-component
yy-component
zz-component
ww-component

Member Function Documentation

◆ getLength()

template<class Type >
const Type ARSTD::Vector4< Type >::getLength ( ) const

Returns the length

Returns
length of the vector

◆ getNormalized()

template<class Type >
Vector4< Type > ARSTD::Vector4< Type >::getNormalized ( ) const

Returns the normalized version of this vector

Precondition
getLength() != 0.0
Returns
The normalized vector

◆ getSquaredLength()

template<class Type >
const Type ARSTD::Vector4< Type >::getSquaredLength ( ) const

Returns the squared length

Returns
Squared length of the vector.

◆ normalize()

template<class Type >
const Vector4< Type > & ARSTD::Vector4< Type >::normalize ( )

Normalizes the vector to a length of 1

Precondition
getLength() != 0.0
Postcondition
getLength() is 1
Returns
The normalized vector

Friends And Related Function Documentation

◆ equals()

template<class Type >
bool equals ( const Vector4< Type > &  lhs,
const Vector4< Type > &  rhs,
double  fEpsilon = EPSILON 
)
related

Compares two vectors with the epsilon given by the parameter fEpsilon

Returns
true, if the vectors are considered equal, false otherwise

◆ operator!=()

template<class Type >
bool operator!= ( const Vector4< Type > &  lhs,
const Vector4< Type > &  rhs 
)
related

Compares two matrices using default EPSILON

Returns
true, if the vectors are considered as not equal, false otherwise

◆ operator<<()

template<class Type >
std::ostream & operator<< ( std::ostream &  stream,
const Vector4< Type > &  vec 
)
related

Writes the vector to a std output stream

◆ operator==()

template<class Type >
bool operator== ( const Vector4< Type > &  lhs,
const Vector4< Type > &  rhs 
)
related

Compares two matrices using default EPSILON

Returns
true, if the vectors are considered equal, false otherwise

◆ operator>>()

template<class Type >
std::istream & operator>> ( std::istream &  stream,
Vector4< Type > &  vec 
)
related

Reads the vector from a std input stream


Generated at Sun Aug 7 2022 for project CodeSubWars. www.codesubwars.org