C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Extended point with homogeneous coordinates in the two-dimensional space. More...

#include <mb_homogeneous.h>

+ Collaboration diagram for MbHomogeneous:

Public Member Functions

 MbHomogeneous ()
 Default constructor.
 
 MbHomogeneous (const MbVector &v, double ww)
 The constructor by a point and a weight.
 
 MbHomogeneous (const MbHomogeneous &other)
 The copy constructor.
 
 MbHomogeneous (double initX, double initY, double initW)
 The constructor by point components and weight.
 
void Init (double initX, double initY)
 The initialization by point components.
 
void Init (double initX, double initY, double initW)
 The initialization by point components and weight.
 
void Init (const MbCartPoint &pnt, double weight)
 The initialization by point components and weight.
 
void SetZero ()
 Set a vector with null length.
 
void Transform (const MbMatrix &matr)
 The transformation by a matrix.
 
void Move (const MbVector &shift)
 Translate along a vector.
 
void Rotate (const MbCartPoint &pnt, double angle)
 Rotate by an angle. More...
 
double GetWeight () const
 Get a point weight.
 
void GetCartPoint (MbCartPoint &pnt) const
 Calculate cartesian coordinates as point.
 
void GetVector (MbVector &vect) const
 Calculate cartesian coordinates as vector.
 
void Set (const MbCartPoint &pnt)
 Transform a point to homogeneous coordinates.
 
void Set (const MbCartPoint &pnt, double weight)
 Transform a point to homogeneous coordinates.
 
void Set (const MbVector &pnt, double weight)
 Transform a vector to homogeneous coordinates.
 
void Set (const MbCartPoint &pnt1, double weight1, const MbCartPoint &pnt2, double weight2)
 Set by points. More...
 
void Add (double initX, double initY, double weight)
 Increase coordinates by given values. More...
 
void Add (const MbCartPoint &pnt1, double weight1, const MbCartPoint &pnt2, double weight2)
 Add points. More...
 
void Add (const MbCartPoint &pnt, double weight)
 Add a point. More...
 
void Dec (const MbHomogeneous &p1, const MbHomogeneous &p2, double kk)
 Subtract p2 - p1 multiple by kk.
 
void Set (const MbHomogeneous &v1, double t1)
 Equate coordinates of vector with coordinates of point v1 multiplied by t1.
 
void Set (const MbHomogeneous &v1, double t1, const MbHomogeneous &v2, double t2)
 Equate vector coordinates with sum of points v1 and v2 multiplied with t1 and t2 correspondingly.
 
void Set (const MbHomogeneous &v1, double t1, const MbHomogeneous &v2, double t2, const MbHomogeneous &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 MbHomogeneous &v1, double t1, const MbHomogeneous &v2, double t2, const MbHomogeneous &v3, double t3, const MbHomogeneous &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 Set (const MbHomogeneous &v1, double t1, const MbHomogeneous &v2, double t2, const MbHomogeneous &v3, double t3, const MbHomogeneous &v4, double t4, const MbHomogeneous &v5, double t5)
 Equate vector coordinates with coordinates of sum of points v1, v2, v3 and v4 multiplied with t1, t2, t3, t4, t5 correspondingly.
 
void Add (const MbHomogeneous &p, double kk)
 Add vector p multiplied by kk.
 
Overload of arithmetic operations.
MbHomogeneous operator+ (const MbHomogeneous &with) const
 Add two points.
 
MbHomogeneous operator- (const MbHomogeneous &with) const
 Subtract a point from the point.
 
MbHomogeneous operator* (double factor) const
 Multiply point coordinates by a number.
 
MbHomogeneous operator/ (double factor) const
 Divide point coordinates by a number.
 
double operator* (const MbHomogeneous &vector) const
 Scalar product of two vectors.
 
MbHomogeneous operator| (const MbHomogeneous &vect2) const
 Vector product of two vectors.
 
void operator= (const MbHomogeneous &other)
 Assign a value.
 
void operator*= (double factor)
 Multiply point coordinates by a number.
 
void operator/= (double factor)
 Divide point coordinates by a number.
 
bool operator== (const MbHomogeneous &) const
 Check for equality.
 
bool operator!= (const MbHomogeneous &) const
 Check for inequality.
 
bool IsSame (const MbHomogeneous &other, double accuracy) const
 Are the objects equal? More...
 

Public Attributes

double x
 A first point coordinate.
 
double y
 A second point coordinate.
 
double w
 A point weight.
 

Static Public Attributes

static const MbHomogeneous zero
 Zero point.
 

Detailed Description

Extended point with homogeneous coordinates in the two-dimensional space.

Extended point with homogeneous coordinates in the two-dimensional space.
Additional coordinate of a point (weight) is introduced for the convenience of working with non-uniform rational splines.
Operations of transformation of a point and a vector in homogeneous coordinates are defined. Various arithmetic operations of a homogeneous point with a number, a Cartesian point and a homogeneous point are defined.

Member Function Documentation

◆ Rotate()

void MbHomogeneous::Rotate ( const MbCartPoint pnt,
double  angle 
)

Rotate by an angle.

An angle defines a rotation vector and a point defines a center.

Parameters
[in]pnt- A point.
[in]angle- A rotation angle.

◆ Set()

void MbHomogeneous::Set ( const MbCartPoint pnt1,
double  weight1,
const MbCartPoint pnt2,
double  weight2 
)
inline

Set by points.

Coordinates of a point are equal to the sum of homogeneous coordinates of initial points, and weight is equal to the sum of the weights.

Parameters
[in]pnt1,pnt2- Initial points.
[in]weight1,weight2- Weights of points.

◆ Add() [1/3]

void MbHomogeneous::Add ( double  initX,
double  initY,
double  weight 
)
inline

Increase coordinates by given values.

Increase coordinates by given values.

Parameters
[in]initX- The initial value of x.
[in]initY- The initial value of y.
[in]weight- A weight.

◆ Add() [2/3]

void MbHomogeneous::Add ( const MbCartPoint pnt1,
double  weight1,
const MbCartPoint pnt2,
double  weight2 
)
inline

Add points.

Increase coordinates by values of the homogeneous coordinates of two initial points.

Parameters
[in]pnt1,pnt2- Initial points.
[in]weight1,weight2- Weights of points.

◆ Add() [3/3]

void MbHomogeneous::Add ( const MbCartPoint pnt,
double  weight 
)
inline

Add a point.

Increase coordinates by values of homogeneous coordinates of a point.

Parameters
[in]pnt- The initial point.
[in]weight- A point weight.

◆ IsSame()

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