class RED::Vector4
4D vector used for homogeneous geometrical operations.
#include <REDVector4.h>
Inherits: Object.
Public functions:
Vector4 ( double iX, double iY, double iZ, double iW ) | |
Vector4 ( const RED::Color & iSource ) | |
Vector4 ( const double data[4] ) | |
Vector4 ( const RED::Vector3 & iSource ) | |
Vector4 ( const float data[4] ) | |
Vector4 ( ) | |
Vector4 ( double iV ) | |
virtual | ~Vector4 ( ) |
virtual void * | As ( const RED::CID & iCID ) |
virtual const void * | As ( const RED::CID & iCID ) const |
template< class T_As > const T_As * | As ( ) const |
template< class T_As > T_As * | As ( ) |
RED::Vector4 | Cross3 ( const RED::Vector4 & iV ) const |
double | Dot3 ( const RED::Vector4 & iV ) const |
double | Dot3_Sat ( const RED::Vector4 & iV ) const |
double | Dot4 ( const RED::Vector4 & iV ) const |
double | Dot4_Sat ( const RED::Vector4 & iV ) const |
double | GetLength3 ( ) const |
double | GetLength4 ( ) const |
double | Normalize3 ( ) |
double | Normalize4 ( ) |
bool | operator!= ( const RED::Vector4 & iOther ) const |
RED::Vector4 | operator* ( double iScalar ) const |
RED::Vector4 | operator* ( const RED::Vector4 & iRight ) const |
void | operator*= ( double iScalar ) |
void | operator*= ( const RED::Vector4 & iRight ) |
RED::Vector4 | operator+ ( const RED::Vector4 & iSource ) const |
void | operator+= ( const RED::Vector4 & iSource ) |
RED::Vector4 | operator- ( const RED::Vector4 & iRight ) const |
RED::Vector4 | operator- ( ) const |
void | operator-= ( const RED::Vector4 & iSource ) |
RED::Vector4 | operator/ ( double iScalar ) const |
RED::Vector4 | operator/ ( const RED::Vector4 & iRight ) const |
void | operator/= ( const RED::Vector4 & iRight ) |
void | operator/= ( double iScalar ) |
bool | operator< ( const RED::Vector4 & iOther ) const |
bool | operator== ( const RED::Vector4 & iOther ) const |
double | operator[] ( unsigned int iIndex ) const |
double & | operator[] ( unsigned int iIndex ) |
void | Set ( double iX, double iY, double iZ, double iW ) |
double | W ( ) const |
double | X ( ) const |
double | Y ( ) const |
double | Z ( ) const |
Public static functions:
static RED::CID | GetClassID ( ) |
Public variables:
double | _w |
double | _x |
double | _y |
double | _z |
Public static variables:
static const RED::Vector4 | UNDEFINED |
static const RED::Vector4 | UNIT |
static const RED::Vector4 | XAXIS |
static const RED::Vector4 | YAXIS |
static const RED::Vector4 | ZAXIS |
static const RED::Vector4 | ZERO |
Functions documentation
public RED::Vector4::Vector4 | ( | double | iX, |
double | iY, | ||
double | iZ, | ||
double | iW | ||
) |
Direct assignment construction.
Parameters:
iX: | X dimension of the vector. |
iY: | Y dimension of the vector. |
iZ: | Z dimension of the vector. |
iW: | W dimension of the vector. |
public RED::Vector4::Vector4 | ( | const RED::Color & | iSource | ) |
public RED::Vector4::Vector4 | ( | const double | data[4] | ) |
construction for a four double array.
Parameters:
data: | array containing the four double precision floating-point vector values. |
public RED::Vector4::Vector4 | ( | const RED::Vector3 & | iSource | ) |
Construction from a non homogeneous vector.
The fourth vector component receive 1.0f.
Parameters:
iSource: | Three components vector. |
public RED::Vector4::Vector4 | ( | const float | data[4] | ) |
construction for a four floats array.
Parameters:
data: | array containing the four floating-point vector values. |
public RED::Vector4::Vector4 | ( | ) |
Default constructor.
Constructs a zero vector.
public RED::Vector4::Vector4 | ( | double | iV | ) |
Direct assignment construction.
Parameters:
iV: | Value, replicated on the 4 members of the vector. |
public virtual RED::Vector4::~Vector4 | ( | ) |
Destructor.
public static RED::CID RED::Vector4::GetClassID | ( | ) |
Reimplements: RED::Object::GetClassID.
public virtual void * RED::Vector4::As | ( | const RED::CID & | iCID | ) |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::Object::As.
public virtual const void * RED::Vector4::As | ( | const RED::CID & | iCID | ) const |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::Object::As.
template< class T_As > public const T_As * RED::Vector4::As | ( | ) const |
Template version of the as const method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::Object::As.
template< class T_As > public T_As * RED::Vector4::As | ( | ) |
Template version of the as method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::Object::As.
public RED::Vector4 RED::Vector4::Cross3 | ( | const RED::Vector4 & | iV | ) const |
Cross product of 2 vectors in 3 dimensions.
Parameters:
iV: | Cross product right operand. |
Returns:
public double RED::Vector4::Dot3 | ( | const RED::Vector4 & | iV | ) const |
3 dimensions dot product of two vectors.
Parameters:
iV: | Right operand of the dot product. |
Returns:
public double RED::Vector4::Dot3_Sat | ( | const RED::Vector4 & | iV | ) const |
3 dimensions dot product of two vectors, saturated.
The result is clamped to [0,1].
Parameters:
iV: | Right operand of the dot product. |
Returns:
public double RED::Vector4::Dot4 | ( | const RED::Vector4 & | iV | ) const |
Homogeneous dot product of two vectors.
Parameters:
iV: | Right operand of the dot product. |
Returns:
public double RED::Vector4::Dot4_Sat | ( | const RED::Vector4 & | iV | ) const |
Homogeneous dot product of two vectors.
The result is clamped to [0,1].
Parameters:
iV: | Right operand of the dot product. |
Returns:
public double RED::Vector4::GetLength3 | ( | ) const |
Gets the 3 dimensions length of the vector.
Returns:
public double RED::Vector4::GetLength4 | ( | ) const |
Gets the 4 dimensions length of the vector.
Returns:
public double RED::Vector4::Normalize3 | ( | ) |
Normalizes the vector in 3 dimensions.
Calculates the 3 dimensions length of the vector (x*x + y*y + z*z) and divides the 3 dimensions components by this length. The homogeneous term is not modified by the operation.
Returns:
public double RED::Vector4::Normalize4 | ( | ) |
Normalizes the vector in 4 dimensions.
Calculates the 4 dimensions length of the vector (x*x + y*y + z*z + w*w) and divides the 4 dimensions components by this length.
Returns:
public bool RED::Vector4::operator!= | ( | const RED::Vector4 & | iOther | ) const |
Returns the result of a difference test between two vectors.
Parameters:
iOther: | Reference to the vector to test with. |
Returns:
public RED::Vector4 RED::Vector4::operator* | ( | double | iScalar | ) const |
Multiplies the components of a vector with a scalar.
Parameters:
iScalar: | Number to multiply the vector with. |
Returns:
public RED::Vector4 RED::Vector4::operator* | ( | const RED::Vector4 & | iRight | ) const |
Multiplication of members of two vectors.
Builds a new vector whose members are the component wise products of this with iRight.
Parameters:
iRight: | Vector to multiply to this. |
Returns:
public void RED::Vector4::operator*= | ( | double | iScalar | ) |
Multiplies the components of the vector with a scalar.
Parameters:
iScalar: | Number to multiply the vector with. |
public void RED::Vector4::operator*= | ( | const RED::Vector4 & | iRight | ) |
Multiplication of members of two vectors.
Store in this the result of the component wise product of this with iRight.
Parameters:
iRight: | Vector to multiply to this. |
public RED::Vector4 RED::Vector4::operator+ | ( | const RED::Vector4 & | iSource | ) const |
Addition operation.
Builds a new vector by the addition of two others.
Returns:
public void RED::Vector4::operator+= | ( | const RED::Vector4 & | iSource | ) |
Increment operation.
Adds the iSource vector to this.
Parameters:
iSource: | Added term. |
public RED::Vector4 RED::Vector4::operator- | ( | const RED::Vector4 & | iRight | ) const |
Subtraction operation.
Builds a new vector by the subtraction of two others.
Parameters:
iRight: | Right operand of the subtraction |
Returns:
public RED::Vector4 RED::Vector4::operator- | ( | ) const |
Returns the opposite of the vector.
Returns:
public void RED::Vector4::operator-= | ( | const RED::Vector4 & | iSource | ) |
Decrement operation.
Subtracts the iSource vector to this.
Parameters:
iSource: | Subtracted term. |
public RED::Vector4 RED::Vector4::operator/ | ( | double | iScalar | ) const |
Divides the components of a vector by a scalar.
Parameters:
iScalar: | Number to divide the vector by. |
Returns:
public RED::Vector4 RED::Vector4::operator/ | ( | const RED::Vector4 & | iRight | ) const |
Division of members of two vectors.
Builds a new vector whose members are the component wise division of this with iRight.
Parameters:
iRight: | Vector to divide from this. |
Returns:
public void RED::Vector4::operator/= | ( | const RED::Vector4 & | iRight | ) |
Division of members of two vectors.
Store in this the result of the component wise division of this by iRight.
Parameters:
iRight: | Vector to divide from this. |
public void RED::Vector4::operator/= | ( | double | iScalar | ) |
Divides the components of the vector by a scalar.
Parameters:
iScalar: | Number to divide the vector by. |
public bool RED::Vector4::operator< | ( | const RED::Vector4 & | iOther | ) const |
Returns true if this is lower than iOther, component wise.
Parameters:
iOther: | Reference to the vector to test with. |
Returns:
public bool RED::Vector4::operator== | ( | const RED::Vector4 & | iOther | ) const |
Returns the result of an equality test between two vectors.
Parameters:
iOther: | Reference to the vector to test with. |
Returns:
public double RED::Vector4::operator[] | ( | unsigned int | iIndex | ) const |
Gets the n-th component of a vector.
Returns:
public double & RED::Vector4::operator[] | ( | unsigned int | iIndex | ) |
Gets the n-th component of a vector in read-write mode.
Returns:
public void RED::Vector4::Set | ( | double | iX, |
double | iY, | ||
double | iZ, | ||
double | iW | ||
) |
Sets the four component of a vector.
Parameters:
iX: | First component. |
iY: | Second component. |
iZ: | Third component. |
iW: | Fourth component. |
public double RED::Vector4::W | ( | ) const |
Returns:
public double RED::Vector4::X | ( | ) const |
Returns:
public double RED::Vector4::Y | ( | ) const |
Returns:
public double RED::Vector4::Z | ( | ) const |
Returns:
Variables documentation
W dimension of the vector.
X dimension of the vector.
Y dimension of the vector.
Z dimension of the vector.
( FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX ) vector.
Unit vector.
( 1, 0, 0, 1 ) vector.
( 0, 1, 0, 1 ) vector.
( 0, 0, 1, 1 ) vector.
Zero vector.