Vector4
Fields
double |
|
double |
|
double |
|
double |
|
const Vector4 |
|
const Vector4 |
|
const Vector4 |
|
const Vector4 |
|
const Vector4 |
|
const Vector4 |
Functions
|
|
double |
|
double & |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
bool |
|
bool |
|
bool |
|
double |
|
double |
|
double |
|
double |
|
double |
|
double |
|
double |
|
double |
|
void |
|
double |
|
double |
|
double |
|
double |
Detailed Description
-
class Vector4 : public RED::Object
4D vector used for homogeneous geometrical operations.
@related class RED::Vector3, class RED::Matrix
Public Functions
- SET_CID (CID_class_REDVector4) IMPLEMENT_AS()
-
Vector4()
Default constructor.
Constructs a zero vector.
-
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.
-
Vector4(double iV)
Direct assignment construction.
- Parameters
iV – Value, replicated on the 4 members of the vector.
-
Vector4(const RED::Color &iSource)
Constructor by copy from a RED::Color.
- Parameters
iSource – Color to put into ‘this’.
-
Vector4(const RED::Vector3 &iSource)
Construction from a non homogeneous vector.
The fourth vector component receive 1.0f.
- Parameters
iSource – Three components vector.
-
Vector4(const float data[4])
construction for a four floats array.
- Parameters
data – array containing the four floating-point vector values.
-
Vector4(const double data[4])
construction for a four double array.
- Parameters
data – array containing the four double precision floating-point vector values.
-
virtual ~Vector4()
Destructor.
-
inline double operator[](unsigned int iIndex) const
Gets the n-th component of a vector.
- Returns
The n-th component of the vector.
-
inline double &operator[](unsigned int iIndex)
Gets the n-th component of a vector in read-write mode.
- Returns
A reference to the n-th component of the vector.
-
inline RED::Vector4 operator+(const RED::Vector4 &iSource) const
Addition operation.
Builds a new vector by the addition of two others.
- Returns
the sum of the two input vectors.
-
inline 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
the subtraction of the two input vectors.
-
inline void operator+=(const RED::Vector4 &iSource)
Increment operation.
Adds the iSource vector to ‘this’.
- Parameters
iSource – Added term.
-
inline void operator-=(const RED::Vector4 &iSource)
Decrement operation.
Subtracts the iSource vector to ‘this’.
- Parameters
iSource – Subtracted term.
-
inline RED::Vector4 operator*(double iScalar) 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.
-
inline 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
The product of the two vectors.
-
inline void operator*=(double iScalar)
Multiplies the components of the vector with a scalar.
- Parameters
iScalar – Number to multiply the vector with.
-
inline void 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.
-
inline RED::Vector4 operator/(double iScalar) 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.
-
inline 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
The division of the two vectors.
-
inline void operator/=(double iScalar)
Divides the components of the vector by a scalar.
- Parameters
iScalar – Number to divide the vector by.
-
inline void 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.
-
inline bool 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.
-
inline bool 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.
-
inline bool 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.
-
inline double GetLength3() const
Gets the 3 dimensions length of the vector.
- Returns
sqrtf(x*x + y*y + z*z).
-
inline double GetLength4() const
Gets the 4 dimensions length of the vector.
- Returns
sqrtf(x*x + y*y + z*z + w*w).
-
inline double 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.
-
inline double 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.
-
inline double 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.
-
inline double 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.
-
inline double 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.
-
inline double 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.
-
inline RED::Vector4 Cross3(const RED::Vector4 &iV) const
Cross product of 2 vectors in 3 dimensions.
- Parameters
iV – Cross product right operand.
- Returns
The cross product of this with iV.
-
inline void 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.
-
inline double X() const
- Returns
The X dimension of the vector.
-
inline double Y() const
- Returns
The Y dimension of the vector.
-
inline double Z() const
- Returns
The Z dimension of the vector.
-
inline double W() const
- Returns
The W dimension of the vector.
Public Members
-
double _x
X dimension of the vector.
-
double _y
Y dimension of the vector.
-
double _z
Z dimension of the vector.
-
double _w
W dimension of the vector.
Public Static Attributes