C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Two-dimensional vector. More...

#include <mb_vector.h>

+ Collaboration diagram for MbVector:

Public Member Functions

 MbVector ()
 Default constructor.
 
 MbVector (double xx, double yy)
 The constructor by coordinates.
 
 MbVector (const MbVector &dir)
 Copy constructor.
 
 MbVector (const MbCartPoint &p1, const MbCartPoint &p2)
 The constructor by two points.
 
 MbVector (const MbCartPoint &p)
 Constructor by point.
 
 MbVector (double a)
 Constructor by angle.
 
 MbVector (const MbDirection &dir)
 Constructor by unit vector of direction.
 
MbVectorInit (const MbCartPoint &p1, const MbCartPoint &p2)
 Initialize by given points.
 
MbVectorInit (double xx, double yy)
 Initialize by given coordinates.
 
template<class Vector >
MbVectorInit (const Vector &v)
 Initialize by given vector.
 
MbVectorSetZero ()
 Set vector coordinates to zero.
 
bool operator== (const MbVector &with) const
 Check for equality.
 
bool Equal (const MbVector &with) const
 Check for equality.
 
bool operator!= (const MbVector &with) const
 Check for inequality.
 
double Length () const
 Calculate vector length.
 
double Length2 () const
 Calculate vector length square.
 
bool Normalize ()
 Normalize a vector.
 
MbVector GetNormalized () const
 Return normalized copy of vector.
 
MbVectorRotate (double angle)
 Rotate vector by an angle 'angle'.
 
MbVectorRotate (const MbDirection &angle)
 Rotate vector by an angle that defined by direction.
 
MbVectorTransform (const MbMatrix &matr)
 Transform according to matrix 'matr'.
 
double DirectionAngle () const
 Calculate an angle by normalized vector.
 
MbVector operator+ (const MbVector &) const
 Sum up two vectors.
 
MbVector operator+ (const MbCartPoint &) const
 Sum up vector and point.
 
MbVector operator- (const MbVector &) const
 Subtract vector from vector.
 
MbVector operator- (const MbCartPoint &) const
 Subtract point from vector.
 
MbVector operator- () const
 Unary minus.
 
MbVector operator* (double factor) const
 Multiply vector by number.
 
MbVector operator/ (double factor) const
 Divide vector by number.
 
MbVectoroperator+= (const MbVector &)
 Sum up two vectors.
 
MbVectoroperator-= (const MbVector &)
 Subtract vector from vector.
 
MbVectoroperator*= (double)
 Multiply vector by number.
 
MbVectoroperator/= (double)
 Divide vector by number.
 
double operator* (const MbVector &) const
 Scalar product of two vectors.
 
double operator* (const MbDirection &) const
 Scalar product of two vectors.
 
double operator| (const MbVector &) const
 Vector product of two vectors.
 
MbVector operator* (const MbMatrix &) const
 Calculate the vector as this copy transformed by the matrix.
 
MbVectorPerpendicular ()
 Makes a vector orthogonal to itself, namely sets the vector (-y, x).
 
MbVector operator~ () const
 Returns a vector orthogonal to this vector, namely the vector (-y, x).
 
MbVectoroperator= (const MbVector &)
 Assign the value of another vector to the vector.
 
MbVectoroperator= (const MbCartPoint &)
 Assign point coordinate values to vector.
 
MbVectoroperator= (const MbHomogeneous &)
 Assign uniform point coordinate values to vector.
 
MbVectoroperator= (const MbDirection &)
 Assign normalized vector values to vector.
 
double & operator[] (size_t i)
 Access to a coordinate by an index.
 
double operator[] (size_t i) const
 The value of a coordinate by an index.
 
int Relative (const MbVector &) const
 Give vector location relative to current vector.
 
bool IsDegenerate (double lenEps=Math::LengthEps) const
 Check for degeneracy.
 
bool IsNormalized (double eps=LENGTH_EPSILON) const
 Check if vector is normalized.
 
bool RoundColinear (const MbVector &with, double eps=Math::paramNear) const
 Check colinearity by dot product.
 
bool Colinear (const MbVector &with, double eps=Math::AngleEps) const
 Check colinearity.
 
bool Orthogonal (const MbVector &with, double eps=Math::AngleEps) const
 Check orthogonality.
 
bool operator|| (const MbVector &with) const
 Check colinearity.
 
void Invert ()
 Change vector direction to opposite.
 
void Scale (double sx, double sy)
 Scale components of vector.
 
void Set (const MbVector &v1, double t1)
 Equate vector with vector v1 multiplied by t1.
 
void Set (const MbVector &v1, double t1, const MbVector &v2, double t2)
 Equate vector with sum of vectors v1 and v2 multiplied with t1 and t2 correspondingly.
 
void Set (const MbVector &v1, double t1, const MbVector &v2, double t2, const MbVector &v3, double t3)
 Equate vector with sum of vectors v1, v2 and v3 multiplied with t1, t2 and t3 correspondingly.
 
void Set (const MbVector &v1, double t1, const MbVector &v2, double t2, const MbVector &v3, double t3, const MbVector &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 MbDirection &v1, double t1, const MbDirection &v2, double t2)
 Equate vector with sum of normalized vectors v1 and v2 multiplied with t1 and t2 correspondingly.
 
void Set (const MbCartPoint &v1, double t1, const MbCartPoint &v2, double t2)
 Equate vector coordinates with sum of points v1 and v2 multiplied with t1 and t2 correspondingly.
 
void Set (const MbCartPoint &v1, double t1, const MbCartPoint &v2, double t2, const MbCartPoint &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 MbCartPoint &v1, double t1, const MbCartPoint &v2, double t2, const MbCartPoint &v3, double t3, const MbCartPoint &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 MbVector &v1, double t1)
 Add vector v1 multiplied by t1 to a vector.
 
void Add (const MbVector &v1, double t1, const MbVector &v2, double t2)
 Add sum of vectors v1 and v2 multiplied with t1 and t2 correspondingly to a vector.
 
void Add (const MbVector &v1, double t1, const MbVector &v2, double t2, const MbVector &v3, double t3)
 Add sum of vectors v1, v2 and v3 multiplied with t1, t2 and t3 correspondingly to a vector.
 
void Add (const MbVector &v1, double t1, const MbVector &v2, double t2, const MbVector &v3, double t3, const MbVector &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 MbDirection &v1, double t1, const MbDirection &v2, double t2)
 Add sum of unit vectors v1 and v2 multiplied with t1 and t2 correspondingly to a vector.
 
double MaxFactor () const
 Give the largest absolute value of a vector.
 
void GetProperties (MbProperties &properties)
 Get properties of the object.
 
void SetProperties (const MbProperties &properties)
 Set properties of the object.
 
bool IsSame (const MbVector &other, double accuracy) const
 Are the objects equal? More...
 

Static Public Member Functions

static size_t GetDimension ()
 The number of point coordinates.
 

Public Attributes

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

Static Public Attributes

static const MbVector zero
 Zero vector.
 
static const MbVector xAxis
 "X" vector of standard basis.
 
static const MbVector yAxis
 "Y" vector of standard basis.
 

Detailed Description

Two-dimensional vector.

Two-dimensional vector. Defined algebraic and geometric operations for vector and number, point or another vector.

Member Function Documentation

◆ IsSame()

bool MbVector::IsSame ( const MbVector 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: