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::Vector4Cross3 ( const RED::Vector4 & iV ) const
doubleDot3 ( const RED::Vector4 & iV ) const
doubleDot3_Sat ( const RED::Vector4 & iV ) const
doubleDot4 ( const RED::Vector4 & iV ) const
doubleDot4_Sat ( const RED::Vector4 & iV ) const
doubleGetLength3 ( ) const
doubleGetLength4 ( ) const
doubleNormalize3 ( )
doubleNormalize4 ( )
booloperator!= ( const RED::Vector4 & iOther ) const
RED::Vector4operator* ( double iScalar ) const
RED::Vector4operator* ( const RED::Vector4 & iRight ) const
voidoperator*= ( double iScalar )
voidoperator*= ( const RED::Vector4 & iRight )
RED::Vector4operator+ ( const RED::Vector4 & iSource ) const
voidoperator+= ( const RED::Vector4 & iSource )
RED::Vector4operator- ( const RED::Vector4 & iRight ) const
RED::Vector4operator- ( ) const
voidoperator-= ( const RED::Vector4 & iSource )
RED::Vector4operator/ ( double iScalar ) const
RED::Vector4operator/ ( const RED::Vector4 & iRight ) const
voidoperator/= ( const RED::Vector4 & iRight )
voidoperator/= ( double iScalar )
booloperator< ( const RED::Vector4 & iOther ) const
booloperator== ( const RED::Vector4 & iOther ) const
doubleoperator[] ( unsigned int iIndex ) const
double &operator[] ( unsigned int iIndex )
voidSet ( double iX, double iY, double iZ, double iW )
doubleW ( ) const
doubleX ( ) const
doubleY ( ) const
doubleZ ( ) const

Public static functions:

static RED::CIDGetClassID ( )

Public variables:

double_w
double_x
double_y
double_z

Public static variables:

static const RED::Vector4UNDEFINED
static const RED::Vector4UNIT
static const RED::Vector4XAXIS
static const RED::Vector4YAXIS
static const RED::Vector4ZAXIS
static const RED::Vector4ZERO

Functions documentation

public RED::Vector4::Vector4(doubleiX,
doubleiY,
doubleiZ,
doubleiW
)

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)

Constructor by copy from a RED::Color.

Parameters:

iSource:Color to put into this.
public RED::Vector4::Vector4(const doubledata[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 floatdata[4])

construction for a four floats array.

Parameters:

data:array containing the four floating-point vector values.

Default constructor.

Constructs a zero vector.

public RED::Vector4::Vector4(doubleiV)

Direct assignment construction.

Parameters:

iV:Value, replicated on the 4 members of the vector.
public virtual RED::Vector4::~Vector4()

Destructor.

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:

An object pointer of the given class on success, NULL otherwise.

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:

An object pointer of the given class on success, NULL otherwise.

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:

A pointer to a const instance of class T on success, NULL otherwise.

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:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

Cross product of 2 vectors in 3 dimensions.

Parameters:

iV:Cross product right operand.

Returns:

The cross product of this with iV.
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:

The dot product of the two vectors.
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:

The dot product of the two vectors.
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:

The dot product of the two vectors.
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:

The dot product of the two vectors.
public double RED::Vector4::GetLength3() const

Gets the 3 dimensions length of the vector.

Returns:

sqrtf(x*x + y*y + z*z).
public double RED::Vector4::GetLength4() const

Gets the 4 dimensions length of the vector.

Returns:

sqrtf(x*x + y*y + z*z + w*w).
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:

The length of the vector before normalization.
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:

The length of the vector before normalization.
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:

true if the two vectors are different, false otherwise.
public RED::Vector4 RED::Vector4::operator*(doubleiScalar) const

Multiplies the components of a vector with a scalar.

Parameters:

iScalar:Number to multiply the vector with.

Returns:

The product of the vector with the scalar.

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:

The product of the two vectors.
public void RED::Vector4::operator*=(doubleiScalar)

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.

Addition operation.

Builds a new vector by the addition of two others.

Returns:

the sum of the two input vectors.
public void RED::Vector4::operator+=(const RED::Vector4 &iSource)

Increment operation.

Adds the iSource vector to this.

Parameters:

iSource:Added term.

Subtraction operation.

Builds a new vector by the subtraction of two others.

Parameters:

iRight:Right operand of the subtraction

Returns:

the subtraction of the two input vectors.

Returns the opposite of the vector.

Returns:

-this
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/(doubleiScalar) const

Divides the components of a vector by a scalar.

Parameters:

iScalar:Number to divide the vector by.

Returns:

The division of the vector by the scalar.

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:

The division of the two vectors.
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/=(doubleiScalar)

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:

true if this is lower than iOther, false otherwise.
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:

true if the two vectors are identical, false otherwise.
public double RED::Vector4::operator[](unsigned intiIndex) const

Gets the n-th component of a vector.

Returns:

The n-th component of the vector.
public double & RED::Vector4::operator[](unsigned intiIndex)

Gets the n-th component of a vector in read-write mode.

Returns:

A reference to the n-th component of the vector.
public void RED::Vector4::Set(doubleiX,
doubleiY,
doubleiZ,
doubleiW
)

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:

The W dimension of the vector.
public double RED::Vector4::X() const

Returns:

The X dimension of the vector.
public double RED::Vector4::Y() const

Returns:

The Y dimension of the vector.
public double RED::Vector4::Z() const

Returns:

The Z dimension of the vector.

Variables documentation

public double RED::Vector4::_w

W dimension of the vector.

public double RED::Vector4::_x

X dimension of the vector.

public double RED::Vector4::_y

Y dimension of the vector.

public double RED::Vector4::_z

Z dimension of the vector.

( FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX ) vector.

public static const RED::Vector4 RED::Vector4::UNIT

Unit vector.

public static const RED::Vector4 RED::Vector4::XAXIS

( 1, 0, 0, 1 ) vector.

public static const RED::Vector4 RED::Vector4::YAXIS

( 0, 1, 0, 1 ) vector.

public static const RED::Vector4 RED::Vector4::ZAXIS

( 0, 0, 1, 1 ) vector.

public static const RED::Vector4 RED::Vector4::ZERO

Zero vector.