C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Vector in three-dimensional space. More...

#include <mb_vector3d.h>

+ Collaboration diagram for MbVector3D:

Public Member Functions

 MbVector3D ()
 Constructor without parameters, vector is zero.
 
 MbVector3D (double a, double b, double c)
 The constructor by coordinates.
 
 MbVector3D (const MbVector3D &v)
 Copy constructor.
 
 MbVector3D (const MbFloatVector3D &)
 Copy-constructor.
 
 MbVector3D (const MbCartPoint3D &p)
 Constructor by point.
 
 MbVector3D (const MbCartPoint3D &p1, const MbCartPoint3D &p2)
 Constructor by two points.
 
 MbVector3D (const MbVector &v2d, const MbPlacement3D &place)
 Constructor by two-dimensional vector in XOY plane of local coordinate system 'place'.
 
 MbVector3D (const MbVector &v2d)
 Constructor by two-dimensional vector in XOY plane of local coordinate system 'place'.
 
void Init (const MbVector &, const MbPlacement3D &)
 Initialize by two-dimensional vector in XOY plane of local coordinate system 'place'.
 
void InitXY (const MbVector &)
 Initialize by two-dimensional vector.
 
void Init (double a, double b, double c)
 Initialize by coordinates.
 
template<class Vector >
void Init (const Vector &v)
 Initialize by another vector.
 
void Init (const MbCartPoint3D &p1, const MbCartPoint3D &p2)
 Initialize by two points.
 
void Add (double a, double b, double c)
 Increase coordinates by given values.
 
void Add (const MbVector3D &v)
 Increase coordinates by values of given vector.
 
void SetZero ()
 Set coordinates of vector to zero.
 
bool IsZero (double eps=Math::lengthEpsilon) const
 Check if vector is zero.
 
MbVector3DTransform (const MbMatrix3D &matr)
 Transform according to the matrix. A matrix acts on a vector from the right.
 
MbVector3DRotate (const MbVector3D &axis, double angle)
 Rotate at given angle around axis.
 
MbVector3DRotate (const MbAxis3D &axis, double angle)
 Rotate at given angle around axis.
 
MbVector3DRotateXYZ (int number, double angle)
 Rotate around the axis (by its number) at a given angle ( 0 - X-axis, 1 - Y-axis, 2 - Z-axis ).
 
bool IsDegenerate (double comEps=Math::region) const
 Check vector for degeneracy.
 
bool IsNormalized (double eps=Math::lengthEpsilon) const
 Check if vector is normalized.
 
bool RoundColinear (const MbVector3D &with, double eps=Math::paramNear) const
 Check if vectors are colinear with given tolerance (by cosine of angle between vectors).
 
bool Colinear (const MbVector3D &with, double eps=Math::angleRegion) const
 Check if vectors are colinear with given tolerance (by sine of angle between vectors).
 
bool Orthogonal (const MbVector3D &with, double eps=Math::angleRegion) const
 Check if vectors are orthogonal with given tolerance.
 
double Length () const
 Calculate vector length.
 
double Length2 () const
 Calculate vector length square.
 
double Angle (const MbVector3D &with) const
 Calculate angle between vectors.
 
bool Normalize ()
 Normalize a vector.
 
MbVector3D GetNormalized () const
 Return normalized copy of vector.
 
MbVector3DInvert ()
 Change vector direction to opposite.
 
MbVector3D TangentComponent (const MbVector3D &v) const
 Get parallel to vector v part of vector.
 
MbVector3D NormalComponent (const MbVector3D &v) const
 Get orthogonal to vector v part of vector.
 
void PspDerivative (double, const MbCartPoint3D &)
 Perspective for first derivative is to be considered.
 
void PspDerivative2 (double, const MbCartPoint3D &, const MbVector3D &)
 Perspective for second derivative is to be considered.
 
void PspDerivative2Mix (double, const MbCartPoint3D &, const MbVector3D &, const MbVector3D &)
 Perspective for second order mixed derivative is to be considered.
 
void PspDerivative3 (double, const MbCartPoint3D &, const MbVector3D &, const MbVector3D &)
 Perspective for third derivative is to be considered.
 
void PspDerivative3Mix (double, const MbCartPoint3D &, const MbVector3D &, const MbVector3D &, const MbVector3D &, const MbVector3D &)
 Perspective for third order mixed derivative is to be considered.
 
void PspNormal (double, const MbCartPoint3D &)
 Perspective for normal is to be considered.
 
void PspNormalDerivative (double, const MbCartPoint3D &, const MbVector3D &, const MbVector3D &)
 Perspective for derivative of normal is to be considered.
 
bool operator== (const MbVector3D &) const
 Check for equality.
 
bool operator!= (const MbVector3D &) const
 Check for inequality.
 
MbVector3D operator+ (const MbVector3D &) const
 Sum up two vectors.
 
MbVector3D operator- (const MbVector3D &) const
 Find the difference of vectors.
 
MbVector3D operator+ (const MbCartPoint3D &) const
 Sum up vector and point.
 
MbVector3D operator- (const MbCartPoint3D &) const
 Subtract point from vector.
 
MbVector3D operator- () const
 Unary minus.
 
MbVector3Doperator+= (const MbVector3D &)
 Sum up two vectors.
 
MbVector3Doperator-= (const MbVector3D &)
 Subtract point from vector.
 
MbVector3Doperator*= (double)
 Multiply vector by number.
 
MbVector3Doperator/= (double)
 Divide vector by number.
 
double operator* (const MbVector3D &) const
 Calculate dot product of two vectors.
 
MbVector3D operator| (const MbVector3D &) const
 Calculate vector product of two vectors.
 
MbMatrix3D operator& (const MbVector3D &) const
 Calculate direct product of two vectors.
 
MbVector3D operator* (const MbMatrix3D &) const
 Calculate the vector as this copy transformed by the matrix.
 
MbVector3Doperator= (const MbCartPoint3D &)
 Assign point coordinate values to vector.
 
MbVector3Doperator= (const MbHomogeneous3D &)
 Assign uniform point coordinate values to vector.
 
MbVector3Doperator= (const MbFloatVector3D &)
 Assign coordinates of another vector to the vector.
 
MbVector3Doperator= (const MbVector3D &)
 Assign the value of another vector to the vector.
 
double & operator[] (size_t i)
 Access to coordinate by an index.
 
double operator[] (size_t i) const
 Get coordinate value by an index.
 
void Set (const MbVector3D &v1, double t1)
 Equate vector with vector v1 multiplied by t1.
 
void Set (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2)
 Equate vector with sum of vectors v1 and v2 multiplied with t1 and t2 correspondingly.
 
void Set (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2, const MbVector3D &v3, double t3)
 Equate vector with sum of vectors v1, v2 and v3 multiplied with t1, t2 and t3 correspondingly.
 
void Set (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2, const MbVector3D &v3, double t3, const MbVector3D &v4, double t4)
 Equate vector with sum of vectors v1, v2, v3 and v4 multiplied with t1, t2, t3 and t4 correspondingly.
 
void Set (const MbCartPoint3D &v1, double t1)
 Equate coordinates of vector with coordinates of point v1 multiplied by t1.
 
void Set (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2)
 Equate vector coordinates with sum of points v1 and v2 multiplied with t1 and t2 correspondingly.
 
void Set (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2, const MbCartPoint3D &v3, double t3)
 Equate vector coordinates with coordinates of sum of vectors v1, v2 and v3 multiplied with t1, t2 and t3 correspondingly.
 
void Set (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2, const MbCartPoint3D &v3, double t3, const MbCartPoint3D &v4, double t4)
 Equate vector coordinates with coordinates of sum of points v1, v2, v3 and v4 multiplied with t1, t2, t3 and t4 correspondingly.
 
void Add (const MbVector3D &v1, double t1)
 Add vector v1 multiplied by t1 to a vector.
 
void Add (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2)
 Add sum of vectors v1 and v2 multiplied with t1 and t2 correspondingly to a vector.
 
void Add (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2, const MbVector3D &v3, double t3)
 Add sum of vectors v1, v2 and v3 multiplied with t1, t2 and t3 correspondingly to a vector.
 
void Add (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2, const MbVector3D &v3, double t3, const MbVector3D &v4, double t4)
 Add sum of vectors v1, v2, v3 and v4 multiplied with t1, t2, t3 and t4 correspondingly to a vector.
 
void Add (const MbCartPoint3D &v1, double t1)
 Add coordinates of point v1 multiplied by t1 to coordinates of vector.
 
void Add (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2)
 Add sum of coordinates of points v1 and v2 multiplied with t1 and t2 correspondingly to coordinates of vector.
 
void Add (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2, const MbCartPoint3D &v3, double t3)
 Add sum of coordinates of points v1, v2 and v3 multiplied with t1, t2 and t3 correspondingly to coordinates of vector.
 
void Add (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2, const MbCartPoint3D &v3, double t3, const MbCartPoint3D &v4, double t4)
 Add sum of coordinates of points v1, v2, v3 and v4 multiplied with t1, t2, t3 and t4 correspondingly to coordinates of vector.
 
void SetVecM (const MbVector3D &vF, const MbVector3D &vS)
 Set vector product of two given vectors.
 
void SetVecM (const MbVector3D &vF, const MbVector3D &vS, double mulKoef)
 Set vector product of two given vectors multiplied by mulKoef.
 
void AddVecM (const MbVector3D &vF, const MbVector3D &vS)
 Add vector product of two given vectors to vector.
 
void AddVecM (const MbVector3D &vF, const MbVector3D &vS, double mulKoef)
 Add vector product of two given vectors multiplied by mulKoef to vector.
 
double MaxFactor () const
 Find the largest absolute value of a vector.
 
void Scale (double sx, double sy, double sz)
 Scale components.
 
void Scale (double s)
 Scale components.
 
bool SetRoundedValue (bool total, double eps)
 Round components of vector.

 
void GetProperties (MbProperties &)
 Get properties of the object.
 
void SetProperties (const MbProperties &)
 Set properties of the object.
 
bool IsSame (const MbVector3D &other, double accuracy) const
 Are the objects equal? More...
 

Static Public Member Functions

static size_t GetDimension ()
 Get point coordinates count.
 

Public Attributes

double x
 First component of vector.
 
double y
 Second component of vector.
 
double z
 Third component of vector.

 

Static Public Attributes

static const MbVector3D zero
 Zero vector.
 
static const MbVector3D xAxis
 "X" vector of standard basis.
 
static const MbVector3D yAxis
 "Y" vector of standard basis.
 
static const MbVector3D zAxis
 "Z" vector of standard basis.
 

Detailed Description

Vector in three-dimensional space.

Vector describes translation or direction in three-dimensional space and is defined by three coordinates x, y, z in the Cartesian coordinate system.
Vector is not binded to space points and therefore has not method for translating it in space.

Member Function Documentation

◆ IsSame()

bool MbVector3D::IsSame ( const MbVector3D other,
double  accuracy 
) const
inline

Are the objects equal?

The objects are equal if their data are equal with a given accuracy.

Parameters
[in]other- The object to compare.
[in]accuracy- The accuracy to compare.
Returns
Whether the objects are equal.

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