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.
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>
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 CVector3 & | operator= (const CVector3 &in_vector3) |
| SICPPSDK_INLINE bool | operator== (const CVector3 &in_vector3) const |
| SICPPSDK_INLINE bool | operator!= (const CVector3 &in_vector3) const |
| SICPPSDK_INLINE CVector3 & | operator~ () |
| SICPPSDK_INLINE CVector3 & | operator+= (const CVector3 &in_vector3) |
| SICPPSDK_INLINE CVector3 & | operator-= (const CVector3 &in_vector3) |
| SICPPSDK_INLINE CVector3 & | operator*= (const CMatrix3 &in_matrix3) |
| SICPPSDK_INLINE CVector3 & | operator*= (const CMatrix4 &in_matrix4) |
| SICPPSDK_INLINE CVector3 & | operator*= (const CTransformation &in_transformation) |
| SICPPSDK_INLINE CVector3 & | operator*= (const double &in_dAlpha) |
| SICPPSDK_INLINE double | operator[] (const short &in_sIndex) |
| SICPPSDK_INLINE CVector3 & | MulByMatrix3InPlace (const CMatrix3 &in_matrix3) |
| SICPPSDK_INLINE CVector3 & | MulByMatrix3 (const CVector3 &in_vector3, const CMatrix3 &in_matrix3) |
| SICPPSDK_INLINE CVector3 & | MulByMatrix4InPlace (const CMatrix4 &in_matrix4) |
| SICPPSDK_INLINE CVector3 & | MulByMatrix4 (const CVector3 &in_vector3, const CMatrix4 &in_matrix4) |
| SICPPSDK_INLINE CVector3 & | MulByTransformationInPlace (const CTransformation &in_transformation) |
| CVector3 & | MulByTransformation (const CVector3 &in_vector3, const CTransformation &in_transformation) |
| SICPPSDK_INLINE CVector3 & | PutNull () |
| 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 CVector3 & | Cross (const CVector3 &in_vector3A, const CVector3 &in_vector3B) |
| double | GetAngle (const CVector3 &in_vector3) const |
| SICPPSDK_INLINE 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) |
| SICPPSDK_INLINE CVector3 & | Clamp (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 CVector3 & | ScaleAddInPlace (double in_dS, const CVector3 &in_vector3) |
| SICPPSDK_INLINE CVector3 & | ScaleAdd (double in_dS, const CVector3 &in_vector3A, const CVector3 &in_vector3B) |
| SICPPSDK_INLINE CVector3 & | ScaleInPlace (double in_dAlpha) |
| SICPPSDK_INLINE CVector3 & | Scale (double in_dAlpha, const CVector3 &in_vector3) |
| SICPPSDK_INLINE CVector3 & | NegateInPlace () |
| SICPPSDK_INLINE CVector3 & | Negate (const CVector3 &in_vector3) |
| SICPPSDK_INLINE CVector3 & | SubInPlace (const CVector3 &in_vector3) |
| SICPPSDK_INLINE CVector3 & | Sub (const CVector3 &in_vector3A, const CVector3 &in_vector3B) |
| SICPPSDK_INLINE CVector3 & | AddInPlace (const CVector3 &in_vector3) |
| SICPPSDK_INLINE CVector3 & | Add (const CVector3 &in_vector3A, const CVector3 &in_vector3B) |
| void | Get (double &io_dX, double &io_dY, double &io_dZ) const |
| SICPPSDK_INLINE CVector3 & | Set (double in_dX, double in_dY, double in_dZ) |
| SICPPSDK_INLINE double | GetZ () const |
| SICPPSDK_INLINE CVector3 & | PutZ (double in_dZ) |
| SICPPSDK_INLINE double | GetY () const |
| SICPPSDK_INLINE CVector3 & | PutY (double in_dY) |
| SICPPSDK_INLINE double | GetX () const |
| SICPPSDK_INLINE CVector3 & | PutX (double in_dX) |
| SICPPSDK_INLINE CVector3 | ( | ) |
Default constructor.
| SICPPSDK_INLINE CVector3 | ( | double | in_dX, |
| double | in_dY, | ||
| double | in_dZ | ||
| ) |
Constructor.
| in_dX | Value of the x component |
| in_dY | Value of the y component |
| in_dZ | Value of the z component |
Copy constructor.
| in_vector3 | constant class object. |
| SICPPSDK_INLINE ~CVector3 | ( | ) |
Default destructor.
Assignment operator.
| in_vector3 | constant class object. |
| SICPPSDK_INLINE bool operator== | ( | const CVector3 & | in_vector3 | ) | const |
Equality operator tests the strict equality of this CVector3 with the specified vector3.
| in_vector3 | Operand vector. |
| SICPPSDK_INLINE bool operator!= | ( | const CVector3 & | in_vector3 | ) | const |
Inequality operator tests the strict inequality of this CVector3 with the specified vector3.
| in_vector3 | Operand vector. |
| SICPPSDK_INLINE CVector3 & operator~ | ( | ) |
Negates this vector (this = - this).
Adds the input vector to this one (this = this + in_vector3)
| in_vector3 | Operand vector.. |
Subtracts the input vector (in_vector3) from this one (this = this - in_vector3).
| in_vector3 | Operand vector. |
Right-multiplies this vector by the matrix m in place (this = this . m ).
| in_matrix3 | Operand matrix. |
Right-multiplies this vector by the matrix m in place (this = this . m ).
| in_matrix4 | Operand matrix. |
| SICPPSDK_INLINE CVector3 & operator*= | ( | const CTransformation & | in_transformation | ) |
Right-multiplies this vector by the transformation t in place (this = this . t).
| in_transformation | transformation operand. |
| SICPPSDK_INLINE CVector3 & operator*= | ( | const double & | in_dAlpha | ) |
Scales this vector by the input scalar (alpha) (this = alpha * this).
| in_dAlpha | Scalar multiplicator. |
| SICPPSDK_INLINE double operator[] | ( | const short & | in_sIndex | ) |
Read-only accessors to the X,Y,Z components.
| in_sIndex | 0,1,2 for X,Y and Z values. |
Right-multiplies this vector by the matrix m in place (this = this . m ).
| in_matrix3 | Operand matrix. |
| 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 ).
| in_vector3 | Operand vector |
| in_matrix3 | Operand matrix. |
Right-multiplies this vector by the matrix m in place (this = this . m ).
| in_matrix4 | Operand matrix. |
| 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 ).
| in_vector3 | Operand vector |
| in_matrix4 | Operand matrix. |
| SICPPSDK_INLINE CVector3 & MulByTransformationInPlace | ( | const CTransformation & | in_transformation | ) |
Right-multiplies this vector by the transformation t in place (this = this . t).
| in_transformation | transformation operand. |
| 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 ).
| in_vector3 | transformation operand. |
| in_transformation | transformation operand. |
| SICPPSDK_INLINE CVector3 & PutNull | ( | ) |
Sets this vector to a null vector.
| SICPPSDK_INLINE short GetMaxComponentIndex | ( | ) | const |
Returns the index of the maximum component of this vector.
| SICPPSDK_INLINE double GetMaxComponent | ( | ) | const |
Returns the maximum component value of this vector.
| SICPPSDK_INLINE short GetMinComponentIndex | ( | ) | const |
Returns the index of the minimum component of this vector.
| SICPPSDK_INLINE double GetMinComponent | ( | ) | const |
Returns the minimum component value of this vector.
| SICPPSDK_INLINE double GetLength | ( | ) | const |
Returns the length of this vector.
| SICPPSDK_INLINE double GetLengthSquared | ( | ) | const |
Returns the squared length of this vector.
| CStatus NormalizeInPlace | ( | ) |
Normalizes this vector in place.
Sets the value of this vector to the normalization of inputed vector.
| in_vector3 | vector operand. |
| SICPPSDK_INLINE double Dot | ( | const CVector3 & | in_vector3 | ) | const |
Returns the dot product of this vector and the inputed vector.
| in_vector3 | vector operand. |
Sets this vector to the vector cross product of vectors A and B.
| in_vector3A | vector operand. |
| in_vector3B | vector operand. |
| double GetAngle | ( | const CVector3 & | in_vector3 | ) | const |
Returns the angle (in radians) between this vector and the inputed vector.
| in_vector3 | vector operand. |
| 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.
| in_vector3A | vector operand. |
| in_vector3B | vector operand. |
| in_dAlpha | Scalar interpolator Possible Values: [0.0, 1.0] Domain of validity |
| CVector3& AbsoluteInPlace | ( | ) |
Sets each component of this vector3 to its absolute value.
Sets each component of the specified MATH::CVector3 to its absolute value and places the modified values into this vector.
| in_vector3 | Vector to convert to absolute |
| CVector3& ClampInPlace | ( | double | in_dMinValue, |
| double | in_dMaxValue | ||
| ) |
Clamps this vector3's components to the range [MinValue, MaxValue].
| in_dMinValue | Lower bound of the clamping domain. |
| in_dMaxValue | Higher bound of the clamping domain. |
| 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.
| in_dMinValue | Lower bound of the clamping domain. |
| in_dMaxValue | Higher bound of the clamping domain. |
| in_vector3 | Operand 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.
| in_vector3 | Operand vector. |
| in_dEpsilon | Error margin Possible Values: [0, +INF[ should be a positive value |
| SICPPSDK_INLINE bool Equals | ( | const CVector3 & | in_vector3 | ) | const |
Tests the strict equality of this vector3 with the specified vector3.
| in_vector3 | Operand vector. |
Sets the value of this vector to the scalar multiplication of itself by s and then adds vector3 v. (this = s*this + v)
| in_dS | Scalar multiplicator. |
| in_vector3 | Operand 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).
| in_dS | Scalar multiplicator. |
| in_vector3A | Operand vector. |
| in_vector3B | Operand vector. |
| SICPPSDK_INLINE CVector3 & ScaleInPlace | ( | double | in_dAlpha | ) |
Scales this vector by the input scalar (alpha) (this = alpha * this).
| in_dAlpha | Scalar multiplicator. |
Scales the input vector (v) by (alpha) store the result into this one (this = alpha * v).
| in_dAlpha | Scalar multiplicator. |
| in_vector3 | Operand vector. |
| SICPPSDK_INLINE CVector3 & NegateInPlace | ( | ) |
Negates this vector (this = - this).
Negates the input vector (v) store the result into this one (this = - v).
| in_vector3 | Operand vector. |
Subtracts the input vector3 (v) from this one (this = this - v).
| in_vector3 | Operand vector. |
Subtracts the input vector3 (in_vector3B) from the input vector3 (in_vector3A) and stores the result in this one (this = A - B).
| in_vector3A | Operand vector. |
| in_vector3B | Operand vector. |
Adds the input vector to this one (this = this + in_vector3).
| in_vector3 | Operand vector. |
Adds both input vectors and stores the result in this one. (this = A + B)
| in_vector3A | Operand vector. |
| in_vector3B | Operand 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.
| 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. |
| SICPPSDK_INLINE CVector3 & Set | ( | double | in_dX, |
| double | in_dY, | ||
| double | in_dZ | ||
| ) |
Sets the X, Y and Z values of the vector.
| 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. |
| SICPPSDK_INLINE double GetZ | ( | ) | const |
Returns the Z value of this vector.
| SICPPSDK_INLINE CVector3 & PutZ | ( | double | in_dZ | ) |
Sets the Z value of this vector.
| in_dZ | z value. |
| SICPPSDK_INLINE double GetY | ( | ) | const |
Returns the Y value of this vector.
| SICPPSDK_INLINE CVector3 & PutY | ( | double | in_dY | ) |
Sets the Y value of this vector.
| in_dY | y value. |
| SICPPSDK_INLINE double GetX | ( | ) | const |
Returns the X value of this vector.
| SICPPSDK_INLINE CVector3 & PutX | ( | double | in_dX | ) |
Sets the X value of this vector.
| in_dX | x value. |