CVector3 Class Reference



Your Ad Here

Related Scripting Object: SIVector3

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

#include <xsi_vector3.h>

List of all members.

Public Member Functions

__forceinline  CVector3 ()
__forceinline  CVector3 (double in_dX, double in_dY, double in_dZ)
__forceinline  CVector3 (const CVector3 &in_vector3)
__forceinline  ~CVector3 ()
__forceinline CVector3 operator= (const CVector3 &in_vector3)
__forceinline bool  operator== (const CVector3 &in_vector3) const
__forceinline bool  operator!= (const CVector3 &in_vector3) const
__forceinline CVector3 operator~ ()
__forceinline CVector3 operator+= (const CVector3 &in_vector3)
__forceinline CVector3 operator-= (const CVector3 &in_vector3)
__forceinline CVector3 operator *= (const CMatrix3 &in_matrix3)
__forceinline CVector3 operator *= (const CMatrix4 &in_matrix4)
__forceinline CVector3 operator *= (const CTransformation &in_transformation)
__forceinline CVector3 operator *= (const double &in_dAlpha)
__forceinline double  operator[] (const short &in_sIndex)
__forceinline CVector3 MulByMatrix3InPlace (const CMatrix3 &in_matrix3)
__forceinline CVector3 MulByMatrix3 (const CVector3 &in_vector3, const CMatrix3 &in_matrix3)
__forceinline CVector3 MulByMatrix4InPlace (const CMatrix4 &in_matrix4)
__forceinline CVector3 MulByMatrix4 (const CVector3 &in_vector3, const CMatrix4 &in_matrix4)
__forceinline CVector3 MulByTransformationInPlace (const CTransformation &in_transformation)
CVector3 MulByTransformation (const CVector3 &in_vector3, const CTransformation &in_transformation)
__forceinline CVector3 PutNull ()
__forceinline short  GetMaxComponentIndex () const
__forceinline double  GetMaxComponent () const
__forceinline short  GetMinComponentIndex () const
__forceinline double  GetMinComponent () const
__forceinline double  GetLength () const
__forceinline double  GetLengthSquared () const
CStatus  NormalizeInPlace ()
CStatus  Normalize (const CVector3 &in_vector3)
__forceinline double  Dot (const CVector3 &in_vector3) const
__forceinline CVector3 Cross (const CVector3 &in_vector3A, const CVector3 &in_vector3B)
double  GetAngle (const CVector3 &in_vector3) const
__forceinline CVector3 LinearlyInterpolate (const CVector3 &in_vector3A, const CVector3 &in_vector3B, double in_dAlpha)
CVector3 AbsoluteInPlace ()
CVector3 Absolute (const CVector3 &in_vector3)
CVector3 ClampInPlace (double in_dMinValue, double in_dMaxValue)
__forceinline CVector3 Clamp (double in_dMinValue, double in_dMaxValue, const CVector3 &in_vector3)
__forceinline bool  EpsilonEquals (const CVector3 &in_vector3, double in_dEpsilon) const
__forceinline bool  Equals (const CVector3 &in_vector3) const
__forceinline CVector3 ScaleAddInPlace (double in_dS, const CVector3 &in_vector3)
__forceinline CVector3 ScaleAdd (double in_dS, const CVector3 &in_vector3A, const CVector3 &in_vector3B)
__forceinline CVector3 ScaleInPlace (double in_dAlpha)
__forceinline CVector3 Scale (double in_dAlpha, const CVector3 &in_vector3)
__forceinline CVector3 NegateInPlace ()
__forceinline CVector3 Negate (const CVector3 &in_vector3)
__forceinline CVector3 SubInPlace (const CVector3 &in_vector3)
__forceinline CVector3 Sub (const CVector3 &in_vector3A, const CVector3 &in_vector3B)
__forceinline CVector3 AddInPlace (const CVector3 &in_vector3)
__forceinline CVector3 Add (const CVector3 &in_vector3A, const CVector3 &in_vector3B)
void  Get (double &io_dX, double &io_dY, double &io_dZ) const
__forceinline CVector3 Set (double in_dX, double in_dY, double in_dZ)
__forceinline double  GetZ () const
__forceinline CVector3 PutZ (double in_dZ)
__forceinline double  GetY () const
__forceinline CVector3 PutY (double in_dY)
__forceinline double  GetX () const
__forceinline CVector3 PutX (double in_dX)


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());


Constructor & Destructor Documentation

__forceinline CVector3 (  ) 

Default constructor.

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

Constructor.

Parameters:
in_dX  Value of the x component
in_dY  Value of the y component
in_dZ  Value of the z component

__forceinline CVector3 ( const CVector3 in_vector3  ) 

Copy constructor.

Parameters:
in_vector3  constant class object.

__forceinline ~CVector3 (  ) 

Default destructor.


Member Function Documentation

__forceinline CVector3 & operator= ( const CVector3 in_vector3  ) 

Assignment operator.

Parameters:
in_vector3  constant class object.
Returns:
A reference to this vector.

__forceinline bool operator== ( const CVector3 in_vector3  )  const

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

Parameters:
in_vector3  Operand vector.
Returns:
true if equal else false.
See also:
CVector3::Equals

__forceinline bool operator!= ( const CVector3 in_vector3  )  const

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

Parameters:
in_vector3  Operand vector.
Returns:
true if equal else false.
See also:
CVector3::Equals

__forceinline CVector3 & operator~ (  ) 

Negates this vector (this = - this).

Returns:
A reference to this vector.
See also:
CVector3::NegateInPlace

__forceinline CVector3 & operator+= ( const CVector3 in_vector3  ) 

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

Parameters:
in_vector3  Operand vector..
Returns:
A reference to this vector.
See also:
CVector3::AddInPlace

__forceinline CVector3 & operator-= ( const CVector3 in_vector3  ) 

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

Parameters:
in_vector3  Operand vector.
Returns:
A reference to this vector.
See also:
CVector3::SubInPlace

__forceinline CVector3 & operator *= ( const CMatrix3 in_matrix3  ) 

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

Parameters:
in_matrix3  Operand matrix.
Returns:
A reference to this vector.
See also:
CVector3::MulByMatrix3InPlace

__forceinline CVector3 & operator *= ( const CMatrix4 in_matrix4  ) 

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

Parameters:
in_matrix4  Operand matrix.
Returns:
A reference to this vector.
See also:
CVector3::MulByMatrix4InPlace

__forceinline CVector3 & operator *= ( const CTransformation in_transformation  ) 

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

Parameters:
in_transformation  transformation operand.
Returns:
A reference to this vector.
See also:
CVector3::MulByTransformationInPlace

__forceinline CVector3 & operator *= ( const double &  in_dAlpha  ) 

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

Parameters:
in_dAlpha  Scalar multiplicator.
Returns:
A reference to this vector.
See also:
CVector3::ScaleInPlace

__forceinline double operator[] ( const short &  in_sIndex  ) 

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

Parameters:
in_sIndex  0,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()

__forceinline CVector3 & MulByMatrix3InPlace ( const CMatrix3 in_matrix3  ) 

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

Parameters:
in_matrix3  Operand matrix.
Returns:
A reference to this vector.

__forceinline 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_vector3  Operand vector
in_matrix3  Operand matrix.
Returns:
A reference to this vector.

__forceinline CVector3 & MulByMatrix4InPlace ( const CMatrix4 in_matrix4  ) 

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

Parameters:
in_matrix4  Operand matrix.
Returns:
A reference to this vector.

__forceinline 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_vector3  Operand vector
in_matrix4  Operand matrix.
Returns:
A reference to this vector.

__forceinline CVector3 & MulByTransformationInPlace ( const CTransformation in_transformation  ) 

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

Parameters:
in_transformation  transformation 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_vector3  transformation operand.
in_transformation  transformation operand.
Returns:
A reference to this vector.

__forceinline CVector3 & PutNull (  ) 

Sets this vector to a null vector.

Returns:
A reference to this vector.

__forceinline short GetMaxComponentIndex (  )  const

Returns the index of the maximum component of this vector.

Returns:
Index of the maximum component of this vector.

__forceinline double GetMaxComponent (  )  const

Returns the maximum component value of this vector.

Returns:
Maximum component value of this vector.

__forceinline short GetMinComponentIndex (  )  const

Returns the index of the minimum component of this vector.

Returns:
Index of the minimum component of this vector.

__forceinline double GetMinComponent (  )  const

Returns the minimum component value of this vector.

Returns:
Minimum component value of this vector.

__forceinline double GetLength (  )  const

Returns the length of this vector.

Returns:
Length of this vector.

__forceinline 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_vector3  vector operand.
Returns:
CStatus::OK if the normalization has been computed.

__forceinline double Dot ( const CVector3 in_vector3  )  const

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

Parameters:
in_vector3  vector operand.
Returns:
Dot product of this vector and vector in_vector3.

__forceinline 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_vector3A  vector operand.
in_vector3B  vector 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_vector3  vector operand.
Returns:
Angle (in radians) between this vector and the inputed vector.

__forceinline 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_vector3A  vector operand.
in_vector3B  vector operand.
in_dAlpha  Scalar 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 vector3 to its absolute value and places the modified values into this vector.

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_dMinValue  Lower bound of the clamping domain.
in_dMaxValue  Higher bound of the clamping domain.
Returns:
A reference to this vector.

__forceinline 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_dMinValue  Lower bound of the clamping domain.
in_dMaxValue  Higher bound of the clamping domain.
in_vector3  Operand vector.
Returns:
A reference to this vector.

__forceinline 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_vector3  Operand vector.
in_dEpsilon  Error margin
Possible Values: [0, +INF[ should be a positive value
Returns:
true if equal else false.

__forceinline bool Equals ( const CVector3 in_vector3  )  const

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

Parameters:
in_vector3  Operand vector.
Returns:
true if equal else false.

__forceinline 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_dS  Scalar multiplicator.
in_vector3  Operand vector.
Returns:
A reference to this vector.

__forceinline 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_dS  Scalar multiplicator.
in_vector3A  Operand vector.
in_vector3B  Operand vector.
Returns:
A reference to this vector.

__forceinline CVector3 & ScaleInPlace ( double  in_dAlpha  ) 

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

Parameters:
in_dAlpha  Scalar multiplicator.
Returns:
A reference to this vector.

__forceinline 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_dAlpha  Scalar multiplicator.
in_vector3  Operand vector.
Returns:
A reference to this vector.

__forceinline CVector3 & NegateInPlace (  ) 

Negates this vector (this = - this).

Returns:
A reference to this vector.

__forceinline CVector3 & Negate ( const CVector3 in_vector3  ) 

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

Parameters:
in_vector3  Operand vector.
Returns:
A reference to this vector.

__forceinline CVector3 & SubInPlace ( const CVector3 in_vector3  ) 

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

Parameters:
in_vector3  Operand vector.
Returns:
A reference to this vector.

__forceinline CVector3 & Sub ( const CVector3 in_vector3A,
const CVector3 in_vector3B  
)

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

Parameters:
in_vector3A  Operand vector.
in_vector3B  Operand vector.
Returns:
A reference to this vector.

__forceinline CVector3 & AddInPlace ( const CVector3 in_vector3  ) 

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

Parameters:
in_vector3  Operand vector.
Returns:
A reference to this vector.

__forceinline 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_vector3A  Operand vector.
in_vector3B  Operand vector.
Returns:
A reference to this vector.

__forceinline void Get ( double &  io_dX,
double &  io_dY,
double &  io_dZ  
) const

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

Parameters:
io_dX  X value to get in the vector.
io_dY  Y value to get in the vector.
io_dZ  Z value to get in the vector.

__forceinline CVector3 & Set ( double  in_dX,
double  in_dY,
double  in_dZ  
)

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

Parameters:
in_dX  X value to set in the vector.
in_dY  Y value to set in the vector.
in_dZ  Z value to set in the vector.
Returns:
A reference to the vector.

__forceinline double GetZ (  )  const

Returns the Z value of this vector.

Returns:
Z value of this vector.

__forceinline CVector3 & PutZ ( double  in_dZ  ) 

Sets the Z value of this vector.

Parameters:
in_dZ  z value.
Returns:
A reference to this vector.

__forceinline double GetY (  )  const

Returns the Y value of this vector.

Returns:
Y value of this vector.

__forceinline CVector3 & PutY ( double  in_dY  ) 

Sets the Y value of this vector.

Parameters:
in_dY  y value.
Returns:
A reference to this vector.

__forceinline double GetX (  )  const

Returns the X value of this vector.

Returns:
X value of this vector.

__forceinline CVector3 & PutX ( double  in_dX  ) 

Sets the X value of this vector.

Parameters:
in_dX  x value.
Returns:
A reference to this vector.


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

Return to Softimage XSI Index


Your Ad Here