Public Member Functions
CVector3 Class Reference

Detailed Description

A 3-element vector that is represented by double precision floating point x,y,z coordinates.

In this API vectors are considered as row vectors as described in [Foley, J., and A. van Dam, Fundamentals of Interactive Computer Graphics, Addison-Wesley, Reading, MA, 1982]. This is important when you multiply a CVector3 by a CMatrix3 or a CMatrix4.

See also:
CMatrix3, CMatrix4, CTransformation
Example:
        using namespace XSI;
        using namespace MATH;
        Application app;
        Model root = app.GetActiveSceneRoot();

        X3DObject myCube;
        root.AddGeometry( L"Cube", L"MeshSurface",L"",myCube );

        KinematicState  globalKinematicState = myCube.GetKinematics().GetGlobal();
        globalKinematicState.PutParameterValue(L"posy", 4.0);
        globalKinematicState.PutParameterValue(L"posx", 2.0);

        X3DObject myCube2;
        myCube.AddGeometry( L"Cube", L"MeshSurface",L"",myCube2);

        globalKinematicState = myCube2.GetKinematics().GetGlobal();
        globalKinematicState.PutParameterValue(L"posz",3.0);
        globalKinematicState.PutParameterValue(L"rotx",45.0);

        CTransformation localTransformation =
                                myCube.GetKinematics().GetLocal().GetTransform();
        CTransformation globalTransformation = globalKinematicState.GetTransform();

        CVector3 translation(localTransformation.GetTranslation());

        app.LogMessage(L"The translation of the cube relative to its parent: x " +
                        CValue(translation.GetX()).GetAsText() +
                        L" y " +
                        CValue(translation.GetY()).GetAsText() +
                        L" z " +
                        CValue(translation.GetZ()).GetAsText());

        MapObjectPoseToWorldSpace(  globalTransformation, localTransformation);

        translation = localTransformation.GetTranslation();

        app.LogMessage(L"The translation of the cube relative to the origin of the universe: x " +
                      CValue(translation.GetX()).GetAsText() +
                      L" y " + CValue(translation.GetY()).GetAsText() +
                      L" z " + CValue(translation.GetZ()).GetAsText());

#include <xsi_vector3.h>

List of all members.

Public Member Functions

SICPPSDK_INLINE CVector3 ()
SICPPSDK_INLINE CVector3 (double in_dX, double in_dY, double in_dZ)
SICPPSDK_INLINE CVector3 (const CVector3 &in_vector3)
SICPPSDK_INLINE ~CVector3 ()
SICPPSDK_INLINE CVector3operator= (const CVector3 &in_vector3)
SICPPSDK_INLINE bool operator== (const CVector3 &in_vector3) const
SICPPSDK_INLINE bool operator!= (const CVector3 &in_vector3) const
SICPPSDK_INLINE CVector3operator~ ()
SICPPSDK_INLINE CVector3operator+= (const CVector3 &in_vector3)
SICPPSDK_INLINE CVector3operator-= (const CVector3 &in_vector3)
SICPPSDK_INLINE CVector3operator*= (const CMatrix3 &in_matrix3)
SICPPSDK_INLINE CVector3operator*= (const CMatrix4 &in_matrix4)
SICPPSDK_INLINE CVector3operator*= (const CTransformation &in_transformation)
SICPPSDK_INLINE CVector3operator*= (const double &in_dAlpha)
SICPPSDK_INLINE double operator[] (const short &in_sIndex)
SICPPSDK_INLINE CVector3MulByMatrix3InPlace (const CMatrix3 &in_matrix3)
SICPPSDK_INLINE CVector3MulByMatrix3 (const CVector3 &in_vector3, const CMatrix3 &in_matrix3)
SICPPSDK_INLINE CVector3MulByMatrix4InPlace (const CMatrix4 &in_matrix4)
SICPPSDK_INLINE CVector3MulByMatrix4 (const CVector3 &in_vector3, const CMatrix4 &in_matrix4)
SICPPSDK_INLINE CVector3MulByTransformationInPlace (const CTransformation &in_transformation)
CVector3MulByTransformation (const CVector3 &in_vector3, const CTransformation &in_transformation)
SICPPSDK_INLINE CVector3PutNull ()
SICPPSDK_INLINE short GetMaxComponentIndex () const
SICPPSDK_INLINE double GetMaxComponent () const
SICPPSDK_INLINE short GetMinComponentIndex () const
SICPPSDK_INLINE double GetMinComponent () const
SICPPSDK_INLINE double GetLength () const
SICPPSDK_INLINE double GetLengthSquared () const
CStatus NormalizeInPlace ()
CStatus Normalize (const CVector3 &in_vector3)
SICPPSDK_INLINE double Dot (const CVector3 &in_vector3) const
SICPPSDK_INLINE CVector3Cross (const CVector3 &in_vector3A, const CVector3 &in_vector3B)
double GetAngle (const CVector3 &in_vector3) const
SICPPSDK_INLINE CVector3LinearlyInterpolate (const CVector3 &in_vector3A, const CVector3 &in_vector3B, double in_dAlpha)
CVector3AbsoluteInPlace ()
CVector3Absolute (const CVector3 &in_vector3)
CVector3ClampInPlace (double in_dMinValue, double in_dMaxValue)
SICPPSDK_INLINE CVector3Clamp (double in_dMinValue, double in_dMaxValue, const CVector3 &in_vector3)
SICPPSDK_INLINE bool EpsilonEquals (const CVector3 &in_vector3, double in_dEpsilon) const
SICPPSDK_INLINE bool Equals (const CVector3 &in_vector3) const
SICPPSDK_INLINE CVector3ScaleAddInPlace (double in_dS, const CVector3 &in_vector3)
SICPPSDK_INLINE CVector3ScaleAdd (double in_dS, const CVector3 &in_vector3A, const CVector3 &in_vector3B)
SICPPSDK_INLINE CVector3ScaleInPlace (double in_dAlpha)
SICPPSDK_INLINE CVector3Scale (double in_dAlpha, const CVector3 &in_vector3)
SICPPSDK_INLINE CVector3NegateInPlace ()
SICPPSDK_INLINE CVector3Negate (const CVector3 &in_vector3)
SICPPSDK_INLINE CVector3SubInPlace (const CVector3 &in_vector3)
SICPPSDK_INLINE CVector3Sub (const CVector3 &in_vector3A, const CVector3 &in_vector3B)
SICPPSDK_INLINE CVector3AddInPlace (const CVector3 &in_vector3)
SICPPSDK_INLINE CVector3Add (const CVector3 &in_vector3A, const CVector3 &in_vector3B)
void Get (double &io_dX, double &io_dY, double &io_dZ) const
SICPPSDK_INLINE CVector3Set (double in_dX, double in_dY, double in_dZ)
SICPPSDK_INLINE double GetZ () const
SICPPSDK_INLINE CVector3PutZ (double in_dZ)
SICPPSDK_INLINE double GetY () const
SICPPSDK_INLINE CVector3PutY (double in_dY)
SICPPSDK_INLINE double GetX () const
SICPPSDK_INLINE CVector3PutX (double in_dX)

Constructor & Destructor Documentation

SICPPSDK_INLINE CVector3 ( )

Default constructor.

SICPPSDK_INLINE CVector3 ( double  in_dX,
double  in_dY,
double  in_dZ 
)

Constructor.

Parameters:
in_dXValue of the x component
in_dYValue of the y component
in_dZValue of the z component
SICPPSDK_INLINE CVector3 ( const CVector3 in_vector3)

Copy constructor.

Parameters:
in_vector3constant class object.
SICPPSDK_INLINE ~CVector3 ( )

Default destructor.


Member Function Documentation

SICPPSDK_INLINE CVector3 & operator= ( const CVector3 in_vector3)

Assignment operator.

Parameters:
in_vector3constant class object.
Returns:
A reference to this vector.
SICPPSDK_INLINE bool operator== ( const CVector3 in_vector3) const

Equality operator tests the strict equality of this CVector3 with the specified vector3.

Parameters:
in_vector3Operand vector.
Returns:
true if equal else false.
See also:
CVector3::Equals
SICPPSDK_INLINE bool operator!= ( const CVector3 in_vector3) const

Inequality operator tests the strict inequality of this CVector3 with the specified vector3.

Parameters:
in_vector3Operand vector.
Returns:
true if equal else false.
See also:
CVector3::Equals
SICPPSDK_INLINE CVector3 & operator~ ( )

Negates this vector (this = - this).

Returns:
A reference to this vector.
See also:
CVector3::NegateInPlace
SICPPSDK_INLINE CVector3 & operator+= ( const CVector3 in_vector3)

Adds the input vector to this one (this = this + in_vector3)

Parameters:
in_vector3Operand vector..
Returns:
A reference to this vector.
See also:
CVector3::AddInPlace
SICPPSDK_INLINE CVector3 & operator-= ( const CVector3 in_vector3)

Subtracts the input vector (in_vector3) from this one (this = this - in_vector3).

Parameters:
in_vector3Operand vector.
Returns:
A reference to this vector.
See also:
CVector3::SubInPlace
SICPPSDK_INLINE CVector3 & operator*= ( const CMatrix3 in_matrix3)

Right-multiplies this vector by the matrix m in place (this = this . m ).

Parameters:
in_matrix3Operand matrix.
Returns:
A reference to this vector.
See also:
CVector3::MulByMatrix3InPlace
SICPPSDK_INLINE CVector3 & operator*= ( const CMatrix4 in_matrix4)

Right-multiplies this vector by the matrix m in place (this = this . m ).

Parameters:
in_matrix4Operand matrix.
Returns:
A reference to this vector.
See also:
CVector3::MulByMatrix4InPlace
SICPPSDK_INLINE CVector3 & operator*= ( const CTransformation in_transformation)

Right-multiplies this vector by the transformation t in place (this = this . t).

Parameters:
in_transformationtransformation operand.
Returns:
A reference to this vector.
See also:
CVector3::MulByTransformationInPlace
SICPPSDK_INLINE CVector3 & operator*= ( const double &  in_dAlpha)

Scales this vector by the input scalar (alpha) (this = alpha * this).

Parameters:
in_dAlphaScalar multiplicator.
Returns:
A reference to this vector.
See also:
CVector3::ScaleInPlace
SICPPSDK_INLINE double operator[] ( const short &  in_sIndex)

Read-only accessors to the X,Y,Z components.

Parameters:
in_sIndex0,1,2 for X,Y and Z values.
Returns:
The value of the specified component. If the index supplied is out of range the function returns DBL_MAX.
See also:
CVector3::GetX(), CVector3::GetY(), CVector3::GetZ()
SICPPSDK_INLINE CVector3 & MulByMatrix3InPlace ( const CMatrix3 in_matrix3)

Right-multiplies this vector by the matrix m in place (this = this . m ).

Parameters:
in_matrix3Operand matrix.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & MulByMatrix3 ( const CVector3 in_vector3,
const CMatrix3 in_matrix3 
)

Right-multiplies the vector v by the matrix m and store the result in this vector (this = v . m ).

Parameters:
in_vector3Operand vector
in_matrix3Operand matrix.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & MulByMatrix4InPlace ( const CMatrix4 in_matrix4)

Right-multiplies this vector by the matrix m in place (this = this . m ).

Parameters:
in_matrix4Operand matrix.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & MulByMatrix4 ( const CVector3 in_vector3,
const CMatrix4 in_matrix4 
)

Right-multiplies the vector v by the matrix m and store the result in this vector (this = v . m ).

Parameters:
in_vector3Operand vector
in_matrix4Operand matrix.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & MulByTransformationInPlace ( const CTransformation in_transformation)

Right-multiplies this vector by the transformation t in place (this = this . t).

Parameters:
in_transformationtransformation operand.
Returns:
A reference to this vector.
CVector3& MulByTransformation ( const CVector3 in_vector3,
const CTransformation in_transformation 
)

Right-multiplies the vector v by the transformation t and stores the result in this vector (this = v . t ).

Parameters:
in_vector3transformation operand.
in_transformationtransformation operand.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & PutNull ( )

Sets this vector to a null vector.

Returns:
A reference to this vector.
SICPPSDK_INLINE short GetMaxComponentIndex ( ) const

Returns the index of the maximum component of this vector.

Returns:
Index of the maximum component of this vector.
SICPPSDK_INLINE double GetMaxComponent ( ) const

Returns the maximum component value of this vector.

Returns:
Maximum component value of this vector.
SICPPSDK_INLINE short GetMinComponentIndex ( ) const

Returns the index of the minimum component of this vector.

Returns:
Index of the minimum component of this vector.
SICPPSDK_INLINE double GetMinComponent ( ) const

Returns the minimum component value of this vector.

Returns:
Minimum component value of this vector.
SICPPSDK_INLINE double GetLength ( ) const

Returns the length of this vector.

Returns:
Length of this vector.
SICPPSDK_INLINE double GetLengthSquared ( ) const

Returns the squared length of this vector.

Returns:
Squared length of this vector.
CStatus NormalizeInPlace ( )

Normalizes this vector in place.

Returns:
CStatus::OK if the normalization has been computed,
CStatus Normalize ( const CVector3 in_vector3)

Sets the value of this vector to the normalization of inputed vector.

Parameters:
in_vector3vector operand.
Returns:
CStatus::OK if the normalization has been computed.
SICPPSDK_INLINE double Dot ( const CVector3 in_vector3) const

Returns the dot product of this vector and the inputed vector.

Parameters:
in_vector3vector operand.
Returns:
Dot product of this vector and vector in_vector3.
SICPPSDK_INLINE CVector3 & Cross ( const CVector3 in_vector3A,
const CVector3 in_vector3B 
)

Sets this vector to the vector cross product of vectors A and B.

Parameters:
in_vector3Avector operand.
in_vector3Bvector operand.
Returns:
A reference to this vector.
double GetAngle ( const CVector3 in_vector3) const

Returns the angle (in radians) between this vector and the inputed vector.

Parameters:
in_vector3vector operand.
Returns:
Angle (in radians) between this vector and the inputed vector.
SICPPSDK_INLINE CVector3 & LinearlyInterpolate ( const CVector3 in_vector3A,
const CVector3 in_vector3B,
double  in_dAlpha 
)

Linearly interpolates between vectors A and B and places the result into this vector: this = (1-alpha)*A + alpha*B.

Parameters:
in_vector3Avector operand.
in_vector3Bvector operand.
in_dAlphaScalar interpolator
Possible Values: [0.0, 1.0] Domain of validity
Returns:
A reference to this vector.
CVector3& AbsoluteInPlace ( )

Sets each component of this vector3 to its absolute value.

Returns:
A reference to this vector.
CVector3& Absolute ( const CVector3 in_vector3)

Sets each component of the specified MATH::CVector3 to its absolute value and places the modified values into this vector.

Parameters:
in_vector3Vector to convert to absolute
Returns:
A reference to this vector.
CVector3& ClampInPlace ( double  in_dMinValue,
double  in_dMaxValue 
)

Clamps this vector3's components to the range [MinValue, MaxValue].

Parameters:
in_dMinValueLower bound of the clamping domain.
in_dMaxValueHigher bound of the clamping domain.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3& Clamp ( double  in_dMinValue,
double  in_dMaxValue,
const CVector3 in_vector3 
)

Clamps the specified vector3's components to the range [MinValue, MaxValue] and places the values into this vector3.

Parameters:
in_dMinValueLower bound of the clamping domain.
in_dMaxValueHigher bound of the clamping domain.
in_vector3Operand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE bool EpsilonEquals ( const CVector3 in_vector3,
double  in_dEpsilon 
) const

Tests the equality of this vector3 with the specified vector3, with a tolerance of Epsilon.

Parameters:
in_vector3Operand vector.
in_dEpsilonError margin
Possible Values: [0, +INF[ should be a positive value
Returns:
true if equal else false.
SICPPSDK_INLINE bool Equals ( const CVector3 in_vector3) const

Tests the strict equality of this vector3 with the specified vector3.

Parameters:
in_vector3Operand vector.
Returns:
true if equal else false.
SICPPSDK_INLINE CVector3 & ScaleAddInPlace ( double  in_dS,
const CVector3 in_vector3 
)

Sets the value of this vector to the scalar multiplication of itself by s and then adds vector3 v. (this = s*this + v)

Parameters:
in_dSScalar multiplicator.
in_vector3Operand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & ScaleAdd ( double  in_dS,
const CVector3 in_vector3A,
const CVector3 in_vector3B 
)

Sets the value of this vector3 to the scalar multiplication of vector3 A by s and then adds vector3 B. (this = s*v1 + v2).

Parameters:
in_dSScalar multiplicator.
in_vector3AOperand vector.
in_vector3BOperand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & ScaleInPlace ( double  in_dAlpha)

Scales this vector by the input scalar (alpha) (this = alpha * this).

Parameters:
in_dAlphaScalar multiplicator.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & Scale ( double  in_dAlpha,
const CVector3 in_vector3 
)

Scales the input vector (v) by (alpha) store the result into this one (this = alpha * v).

Parameters:
in_dAlphaScalar multiplicator.
in_vector3Operand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & NegateInPlace ( )

Negates this vector (this = - this).

Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & Negate ( const CVector3 in_vector3)

Negates the input vector (v) store the result into this one (this = - v).

Parameters:
in_vector3Operand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & SubInPlace ( const CVector3 in_vector3)

Subtracts the input vector3 (v) from this one (this = this - v).

Parameters:
in_vector3Operand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & Sub ( const CVector3 in_vector3A,
const CVector3 in_vector3B 
)

Subtracts the input vector3 (in_vector3B) from the input vector3 (in_vector3A) and stores the result in this one (this = A - B).

Parameters:
in_vector3AOperand vector.
in_vector3BOperand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & AddInPlace ( const CVector3 in_vector3)

Adds the input vector to this one (this = this + in_vector3).

Parameters:
in_vector3Operand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE CVector3 & Add ( const CVector3 in_vector3A,
const CVector3 in_vector3B 
)

Adds both input vectors and stores the result in this one. (this = A + B)

Parameters:
in_vector3AOperand vector.
in_vector3BOperand vector.
Returns:
A reference to this vector.
SICPPSDK_INLINE void Get ( double &  io_dX,
double &  io_dY,
double &  io_dZ 
) const

Returns the X, Y and Z values of the vector.

Parameters:
io_dXX value to get in the vector.
io_dYY value to get in the vector.
io_dZZ value to get in the vector.
SICPPSDK_INLINE CVector3 & Set ( double  in_dX,
double  in_dY,
double  in_dZ 
)

Sets the X, Y and Z values of the vector.

Parameters:
in_dXX value to set in the vector.
in_dYY value to set in the vector.
in_dZZ value to set in the vector.
Returns:
A reference to the vector.
SICPPSDK_INLINE double GetZ ( ) const

Returns the Z value of this vector.

Returns:
Z value of this vector.
SICPPSDK_INLINE CVector3 & PutZ ( double  in_dZ)

Sets the Z value of this vector.

Parameters:
in_dZz value.
Returns:
A reference to this vector.
SICPPSDK_INLINE double GetY ( ) const

Returns the Y value of this vector.

Returns:
Y value of this vector.
SICPPSDK_INLINE CVector3 & PutY ( double  in_dY)

Sets the Y value of this vector.

Parameters:
in_dYy value.
Returns:
A reference to this vector.
SICPPSDK_INLINE double GetX ( ) const

Returns the X value of this vector.

Returns:
X value of this vector.
SICPPSDK_INLINE CVector3 & PutX ( double  in_dX)

Sets the X value of this vector.

Parameters:
in_dXx value.
Returns:
A reference to this vector.

The documentation for this class was generated from the following file: