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 ( ) |
void | Cross ( const RED::Vector3 & iV ) |
RED::Vector3 | Cross2 ( const RED::Vector3 & iV ) const |
double | Dot ( const RED::Vector3 & iV ) const |
double | GetLength ( ) const |
double | GetLength2 ( ) const |
double | Normalize ( ) |
bool | operator!= ( const RED::Vector3 & iOther ) const |
RED::Vector3 | operator* ( double iScalar ) const |
RED::Vector3 | operator* ( const RED::Vector3 & iRight ) const |
void | operator*= ( double iScalar ) |
void | operator*= ( const RED::Vector3 & iRight ) |
RED::Vector3 | operator+ ( const RED::Vector3 & iSource ) const |
void | operator+= ( const RED::Vector3 & iSource ) |
RED::Vector3 | operator- ( const RED::Vector3 & iSource ) const |
RED::Vector3 | operator- ( ) const |
void | operator-= ( const RED::Vector3 & iSource ) |
RED::Vector3 | operator/ ( double iScalar ) const |
RED::Vector3 | operator/ ( const RED::Vector3 & iRight ) const |
void | operator/= ( const RED::Vector3 & iRight ) |
void | operator/= ( double iScalar ) |
bool | operator< ( const RED::Vector3 & iOther ) const |
bool | operator== ( const RED::Vector3 & iOther ) const |
double | operator[] ( unsigned int iIndex ) const |
double & | operator[] ( unsigned int iIndex ) |
void | OrthoBasis ( RED::Vector3 & u, RED::Vector3 & v ) const |
void | Set ( double iX, double iY, double iZ ) |
void | Set ( const double iValues[3] ) |
double | X ( ) const |
double | Y ( ) const |
double | Z ( ) const |
Public static functions:
static RED::CID | GetClassID ( ) |
Public variables:
double | _x |
double | _y |
double | _z |
Public static variables:
static const RED::Vector3 | UNDEFINED |
static const RED::Vector3 | UNIT |
static const RED::Vector3 | XAXIS |
static const RED::Vector3 | YAXIS |
static const RED::Vector3 | ZAXIS |
static const RED::Vector3 | ZERO |
Functions documentation
public RED::Vector3::Vector3 | ( | double | iX, |
double | iY, | ||
double | iZ | ||
) |
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. |
public RED::Vector3::Vector3 | ( | ) |
Default constructor.
Constructs a zero vector.
public RED::Vector3::Vector3 | ( | double | iV | ) |
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 static RED::CID RED::Vector3::GetClassID | ( | ) |
Reimplements: RED::Object::GetClassID.
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:
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:
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:
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:
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. |
public RED::Vector3 RED::Vector3::Cross2 | ( | const RED::Vector3 & | iV | ) const |
Cross product of two vectors.
Returns:
public double RED::Vector3::Dot | ( | const RED::Vector3 & | iV | ) const |
Dot product of two vectors.
Parameters:
iV: | Right operand of the dot product. |
Returns:
public double RED::Vector3::GetLength | ( | ) const |
Gets the length of the vector.
Returns:
public double RED::Vector3::GetLength2 | ( | ) const |
Gets the squared length of the vector.
Returns:
public double RED::Vector3::Normalize | ( | ) |
Normalizes the vector.
The normalized vector is constructed by dividing its three components by its length.
Returns:
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:
public RED::Vector3 RED::Vector3::operator* | ( | double | iScalar | ) const |
Multiplies the components of a vector with a scalar.
Parameters:
iScalar: | Number to multiply the vector with. |
Returns:
public RED::Vector3 RED::Vector3::operator* | ( | const RED::Vector3 & | iRight | ) const |
Component-wise multiplication of a vector by a vector.
Parameters:
iRight: | Right operand of the multiplication. |
Returns:
public void RED::Vector3::operator*= | ( | double | iScalar | ) |
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. |
public RED::Vector3 RED::Vector3::operator+ | ( | const RED::Vector3 & | iSource | ) const |
Addition operation.
Builds a new vector by the addition of two others.
Returns:
public void RED::Vector3::operator+= | ( | const RED::Vector3 & | iSource | ) |
Increment operation.
Adds the iSource vector to this.
Parameters:
iSource: | Right operand of the addition. |
public RED::Vector3 RED::Vector3::operator- | ( | const RED::Vector3 & | iSource | ) const |
Subtraction operation.
Builds a new vector by the subtraction of two others.
Returns:
public RED::Vector3 RED::Vector3::operator- | ( | ) const |
Returns the opposite of the vector.
Returns:
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/ | ( | double | iScalar | ) const |
Divides the components of a vector by a scalar.
Parameters:
iScalar: | Number to divide the vector by. |
Returns:
public RED::Vector3 RED::Vector3::operator/ | ( | const RED::Vector3 & | 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::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/= | ( | double | iScalar | ) |
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:
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:
public double RED::Vector3::operator[] | ( | unsigned int | iIndex | ) const |
Vector member access.
Parameters:
iIndex: | Vector coordinate to access 0:x, 1:y, 2:z. |
Returns:
public double & RED::Vector3::operator[] | ( | unsigned int | iIndex | ) |
Vector member access.
Parameters:
iIndex: | Vector coordinate to access 0:x, 1:y, 2:z. |
Returns:
public void RED::Vector3::OrthoBasis | ( | RED::Vector3 & | u, |
RED::Vector3 & | v | ||
) | const |
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 | ( | double | iX, |
double | iY, | ||
double | iZ | ||
) |
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 double | iValues[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:
public double RED::Vector3::Y | ( | ) const |
Gets the Y dimension of the vector.
Returns:
public double RED::Vector3::Z | ( | ) const |
Gets the Z dimension of the vector.
Returns:
Variables documentation
X dimension of the vector.
Y dimension of the vector.
Z dimension of the vector.
( DBL_MAX, DBL_MAX, DBL_MAX ) vector.
Unit vector.
( 1, 0, 0 ) vector.
( 0, 1, 0 ) vector.
( 0, 0, 1 ) vector.
Zero vector.