class RED::Vector3

3D vector used for geometrical operations.

#include <REDVector3.h>

Inherits: Object.

Public functions:

Vector3 ( double iX, double iY, double iZ )
Vector3 ( const RED::Vector4 & iSource )
Vector3 ( )
Vector3 ( double iV )
Vector3 ( const RED::Color & iSource )
virtual ~Vector3 ( )
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 ( )
voidCross ( const RED::Vector3 & iV )
RED::Vector3Cross2 ( const RED::Vector3 & iV ) const
doubleDot ( const RED::Vector3 & iV ) const
doubleGetLength ( ) const
doubleGetLength2 ( ) const
doubleNormalize ( )
booloperator!= ( const RED::Vector3 & iOther ) const
RED::Vector3operator* ( double iScalar ) const
RED::Vector3operator* ( const RED::Vector3 & iRight ) const
voidoperator*= ( double iScalar )
voidoperator*= ( const RED::Vector3 & iRight )
RED::Vector3operator+ ( const RED::Vector3 & iSource ) const
voidoperator+= ( const RED::Vector3 & iSource )
RED::Vector3operator- ( const RED::Vector3 & iSource ) const
RED::Vector3operator- ( ) const
voidoperator-= ( const RED::Vector3 & iSource )
RED::Vector3operator/ ( double iScalar ) const
RED::Vector3operator/ ( const RED::Vector3 & iRight ) const
voidoperator/= ( const RED::Vector3 & iRight )
voidoperator/= ( double iScalar )
booloperator< ( const RED::Vector3 & iOther ) const
booloperator== ( const RED::Vector3 & iOther ) const
doubleoperator[] ( unsigned int iIndex ) const
double &operator[] ( unsigned int iIndex )
voidOrthoBasis ( RED::Vector3 & u, RED::Vector3 & v ) const
voidSet ( double iX, double iY, double iZ )
voidSet ( const double iValues[3] )
doubleX ( ) const
doubleY ( ) const
doubleZ ( ) const

Public static functions:

static RED::CIDGetClassID ( )

Public variables:

double_x
double_y
double_z

Public static variables:

static const RED::Vector3UNDEFINED
static const RED::Vector3UNIT
static const RED::Vector3XAXIS
static const RED::Vector3YAXIS
static const RED::Vector3ZAXIS
static const RED::Vector3ZERO

Functions documentation

public RED::Vector3::Vector3(doubleiX,
doubleiY,
doubleiZ
)

Constructor.

Parameters:

iX:X dimension of the vector.
iY:Y dimension of the vector.
iZ:Z dimension of the vector.
public RED::Vector3::Vector3(const RED::Vector4 &iSource)

Construction from a clamped RED::Vector4.

Parameters:

iSource:The source of the values. The W vector4 value is lost.

Default constructor.

Constructs a zero vector.

public RED::Vector3::Vector3(doubleiV)

Direct assignment construction.

Parameters:

iV:Value, replicated on the 3 members of the vector.
public RED::Vector3::Vector3(const RED::Color &iSource)

Construction from a clamped RED::Color.

Parameters:

iSource:The source of the values. The alpha color value is lost.
public virtual RED::Vector3::~Vector3()

Destructor.

public virtual void * RED::Vector3::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::Vector3::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::Vector3::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::Vector3::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.

public void RED::Vector3::Cross(const RED::Vector3 &iV)

Cross product of two vectors.

The result is stored in this.

Parameters:

iV:Right operand of the cross product.

Cross product of two vectors.

Returns:

the result of the cross product between this and iV.
public double RED::Vector3::Dot(const RED::Vector3 &iV) const

Dot product of two vectors.

Parameters:

iV:Right operand of the dot product.

Returns:

The dot product of the two vectors.
public double RED::Vector3::GetLength() const

Gets the length of the vector.

Returns:

The length of the vector.
public double RED::Vector3::GetLength2() const

Gets the squared length of the vector.

Returns:

The squared length of the vector.
public double RED::Vector3::Normalize()

Normalizes the vector.

The normalized vector is constructed by dividing its three components by its length.

Returns:

The length of the vector before normalization.
public bool RED::Vector3::operator!=(const RED::Vector3 &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::Vector3 RED::Vector3::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.

Component-wise multiplication of a vector by a vector.

Parameters:

iRight:Right operand of the multiplication.

Returns:

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

Multiplies the components of the vector with a scalar.

Parameters:

iScalar:Number to multiply the vector with.
public void RED::Vector3::operator*=(const RED::Vector3 &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::Vector3::operator+=(const RED::Vector3 &iSource)

Increment operation.

Adds the iSource vector to this.

Parameters:

iSource:Right operand of the addition.

Subtraction operation.

Builds a new vector by the subtraction of two others.

Returns:

the subtraction of the two input vectors.

Returns the opposite of the vector.

Returns:

-this
public void RED::Vector3::operator-=(const RED::Vector3 &iSource)

Decrement operation.

Subtracts the iSource vector to this.

Parameters:

iSource:Right operand of the addition.
public RED::Vector3 RED::Vector3::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::Vector3::operator/=(const RED::Vector3 &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::Vector3::operator/=(doubleiScalar)

Divides the components of the vector by a scalar.

Parameters:

iScalar:Number to divide the vector by.
public bool RED::Vector3::operator<(const RED::Vector3 &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::Vector3::operator==(const RED::Vector3 &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::Vector3::operator[](unsigned intiIndex) const

Vector member access.

Parameters:

iIndex:Vector coordinate to access 0:x, 1:y, 2:z.

Returns:

The corresponding vector coordinate.
public double & RED::Vector3::operator[](unsigned intiIndex)

Vector member access.

Parameters:

iIndex:Vector coordinate to access 0:x, 1:y, 2:z.

Returns:

The corresponding vector coordinate.

Builds an orthogonal basis from an input vector.

The returned basis is (u, v, this). u and v are normalized before returning.

Parameters:

u:The first basis vector.
v:The second basis vector.
public void RED::Vector3::Set(doubleiX,
doubleiY,
doubleiZ
)

Sets the 3d vector coordinates to the provided values.

Parameters:

iX:First vector coordinate.
iY:Second vector coordinate.
iZ:Third vector coordinate.
public void RED::Vector3::Set(const doubleiValues[3])

Sets the 3d vector coordinates to the provided values.

Parameters:

iValues:Three vector coordinates.
public double RED::Vector3::X() const

Gets the X dimension of the vector.

Returns:

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

Gets the Y dimension of the vector.

Returns:

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

Gets the Z dimension of the vector.

Returns:

The Z dimension of the vector.

Variables documentation

public double RED::Vector3::_x

X dimension of the vector.

public double RED::Vector3::_y

Y dimension of the vector.

public double RED::Vector3::_z

Z dimension of the vector.

( DBL_MAX, DBL_MAX, DBL_MAX ) vector.

public static const RED::Vector3 RED::Vector3::UNIT

Unit vector.

public static const RED::Vector3 RED::Vector3::XAXIS

( 1, 0, 0 ) vector.

public static const RED::Vector3 RED::Vector3::YAXIS

( 0, 1, 0 ) vector.

public static const RED::Vector3 RED::Vector3::ZAXIS

( 0, 0, 1 ) vector.

public static const RED::Vector3 RED::Vector3::ZERO

Zero vector.