C3D Toolkit  Kernel - 110464, Vision - 2.5.0.35

The cartesian two-dimensional point. More...

#include <mb_cart_point.h>

+ Collaboration diagram for MbCartPoint:

Public Member Functions

 MbCartPoint ()
 Default constructor. More...
 
 MbCartPoint (const MbCartPoint &p)
 Copy-constructor.
 
 MbCartPoint (const MbVector &p)
 Constructor by a vector.
 
 MbCartPoint (double initX, double initY)
 Constructor by coordinates.
 
 MbCartPoint (const MbCartPoint &p, const MbMatrix &matr)
 Constructor by a point in a local coordinate system. More...
 
 MbCartPoint (const MbFloatPoint &)
 Constructor by float point.
 
void SetZero ()
 Set coordinates to zero.
 
template<class Point >
MbCartPointInit (const Point &p)
 Initialize by another point.
 
MbCartPointInit (double initX, double initY)
 Initialize by coordinates.
 
double DistanceToPoint (const MbCartPoint &to) const
 Find the distance between points.
 
MbCartPointTransform (const MbMatrix &matr)
 Transform according to the matrix.
 
MbCartPointMove (const MbVector &to)
 Translate along a vector.
 
MbCartPointMove (double dx, double dy)
 Translate by given increments.
 
double DistanceToPoint2 (const MbCartPoint &to) const
 Find the squared distance between points.
 
double DistanceToLineSeg (const MbCartPoint &p1, const MbCartPoint &p2) const
 The distance from a point to a segment. More...
 
double Length () const
 The vector length ( 0, p(x,y) ).
 
void Scale (double sx, double sy)
 Scale the coordinates. More...
 
void GetProperties (MbProperties &properties)
 Get properties of the object.
 
void SetProperties (const MbProperties &properties)
 Set properties of the object.
 
bool IsSame (const MbCartPoint &other, double accuracy) const
 Are the objects equal? More...
 
bool IsUndefined () const
 Is the point undefined?
 
Translations, rotations, reflections.
void MoveAlongLine (const MbCartPoint &p2, double delta)
 Translate along the direction which is defined by a second point. More...
 
void MoveAlongLine (double angle, double delta)
 Translate along the direction which is defined by an angle. More...
 
void MoveAlongLine (const MbDirection &angle, double delta)
 Translate along the direction which is defined by a vector. More...
 
void MoveAlongLine (const MbVector &vect, double delta)
 Translate along the direction which is defined by a vector. More...
 
void MoveUntilDist (const MbCartPoint &p1, double dist)
 Translate the point towards a given point to the distance "dist". More...
 
void GoNearToPoint (const MbCartPoint &to, double ratio)
 Translate along the direction. More...
 
void Rotate (const MbCartPoint &pnt, double angle)
 Rotate by an angle. More...
 
void Rotate (const MbCartPoint &pnt, const MbDirection &angle)
 Rotate by an angle. More...
 
void Rotate (double angle)
 Rotate by an angle. More...
 
void Rotate (const MbDirection &angle)
 Rotate by an angle. More...
 
MbCartPoint Mirror (const MbCartPoint &from) const
 Reflect a point specularly from a given point. More...
 
MbCartPoint Mirror (const MbCartPoint &p1, const MbCartPoint &p2) const
 Reflect a point specularly from a line. More...
 
void Mirror (const MbCartPoint &p1, const MbDirection &dir)
 Reflect a point specularly from a line. More...
 
Logical and arithmetical operations.
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.
 
bool operator== (const MbCartPoint &with) const
 Check for equality with tolerance.
 
bool operator!= (const MbCartPoint &with) const
 Check for inequality.
 
bool Equal (const MbCartPoint &with) const
 Check for an accurate equality.
 
bool operator< (const MbCartPoint &) const
 Check for "less".
 
bool operator> (const MbCartPoint &) const
 Check for "greater".
 
MbVector operator+ (const MbCartPoint &pnt) const
 Sum two points.
 
MbVector operator- (const MbCartPoint &pnt) const
 Subtract a point from the point.
 
MbCartPoint operator+ (const MbDirection &d) const
 Add a point to a vector.
 
MbCartPoint operator- (const MbDirection &d) const
 Subtract a vector from a point.
 
MbCartPoint operator- () const
 The unary minus.
 
MbCartPoint operator* (double factor) const
 Multiply a point by a number.
 
MbCartPoint operator/ (double factor) const
 Divide a point by a number.
 
MbCartPoint operator* (const MbMatrix &) const
 Calculate the point as this copy transformed by the matrix.
 
void operator+= (const MbCartPoint &pnt)
 Sum two points.
 
void operator-= (const MbCartPoint &pnt)
 Subtract a point from the point.
 
void operator*= (double factor)
 Multiply a point by a number.
 
void operator/= (double factor)
 Divide a point by a number.
 
void operator+= (MbVector &v)
 Add a point to a vector.
 
void operator-= (MbVector &v)
 Subtract a vector from a point.
 
MbCartPoint operator+ (const MbVector &vector) const
 Add a point to a vector.
 
MbCartPoint operator- (const MbVector &vector) const
 Subtract a vector from a point.
 
void operator= (const MbVector &)
 Assign values of vector components to the point.
 
void operator= (const MbDirection &)
 Assign values of vector components to the point.
 
void operator= (const MbFloatPoint &)
 Assign the float-point value to the point.
 
The functions of addition and multiplication of points with points and vectors.
void Set (const MbCartPoint &v1, const MbVector &v2, double t2)
 Equate coordinates to sum of point coordinates and vector coordinates. More...
 
void Set (const MbCartPoint &v1, const MbVector &v2, double t2, const MbVector &v3, double t3)
 Equate coordinates to sum of point coordinates and two vectors coordinates. More...
 
void Set (const MbCartPoint &v1, double t1, const MbCartPoint &v2, double t2)
 Equate coordinates to sum of two points coordinates. More...
 
void Set (const MbCartPoint &v1, double t1, const MbCartPoint &v2, double t2, const MbCartPoint &v3, double t3)
 Equate coordinates to sum of three points coordinates. More...
 
void Set (const MbCartPoint &v1, double t1, const MbCartPoint &v2, double t2, const MbCartPoint &v3, double t3, const MbCartPoint &v4, double t4)
 Equate coordinates to sum of four points coordinates. More...
 
void Set (const MbCartPoint &v1, const MbDirection &v2, double t2, const MbDirection &v3, double t3)
 Equate coordinates to sum of point coordinates and two vectors coordinates. More...
 
void Add (const MbVector &v1, double t1)
 Increase coordinates by values of vector components. More...
 
void Add (const MbVector &v1, double t1, const MbVector &v2, double t2)
 Increase coordinates by values of two vectors components. More...
 
void Add (const MbVector &v1, double t1, const MbVector &v2, double t2, const MbVector &v3, double t3)
 Increase coordinates by values of v1, v2 and v3 vectors components multiplied by t1, t2 and t3 respectively. More...
 
void Add (const MbVector &v1, double t1, const MbVector &v2, double t2, const MbVector &v3, double t3, const MbVector &v4, double t4)
 Increase coordinates by values of three vectors components. More...
 
void Add (const MbDirection &v1, double t1, const MbDirection &v2, double t2)
 Increase coordinates by values of two vectors components. More...
 
void Add (const MbCartPoint &v1, double t1)
 Increase coordinates by values of point coordinates. More...
 
void Add (const MbCartPoint &v1, double t1, const MbCartPoint &v2, double t2, const MbCartPoint &v3, double t3)
 Increase coordinates by values of three points coordinates. More...
 
void Add (const MbCartPoint &v1, double t1, const MbCartPoint &v2, double t2, const MbCartPoint &v3, double t3, const MbCartPoint &v4, double t4)
 Increase coordinates by values of four points coordinates. More...
 

Static Public Member Functions

static size_t GetDimension ()
 The number of point coordinates.
 

Public Attributes

double x
 A first coordinate of point.
 
double y
 A second coordinate of point.
 

Static Public Attributes

static const MbCartPoint origin
 The origin or { 0, 0 }.
 

Detailed Description

The cartesian two-dimensional point.

The two-dimensional point is defined by two coordinates. Different logical, arithmetical and geometrical operations of points with points and vectors are defined. The point is named in honor of French scientist Rene Descartes (lat. Renatus Cartesius).

Constructor & Destructor Documentation

◆ MbCartPoint() [1/2]

MbCartPoint::MbCartPoint ( )
inline

Default constructor.

Creates a point with zero coordinates.

◆ MbCartPoint() [2/2]

MbCartPoint::MbCartPoint ( const MbCartPoint p,
const MbMatrix matr 
)
inline

Constructor by a point in a local coordinate system.

A transition matrix is given for transforming of a point to the global coordinate system from a local coordinate system.

Parameters
[in]p- A point in the local coordinate system.
[in]matr- A transition matrix from the local coordinate system to the global coordinate system.

Member Function Documentation

◆ MoveAlongLine() [1/4]

void MbCartPoint::MoveAlongLine ( const MbCartPoint p2,
double  delta 
)

Translate along the direction which is defined by a second point.

Parameters
[in]p2- An initial point, which defines the direction of the translation.
[in]delta- Magnitude of the translation.

◆ MoveAlongLine() [2/4]

void MbCartPoint::MoveAlongLine ( double  angle,
double  delta 
)
inline

Translate along the direction which is defined by an angle.

Parameters
[in]angle- An angle which defines the direction of the translation.
[in]delta- Magnitude of the translation.

◆ MoveAlongLine() [3/4]

void MbCartPoint::MoveAlongLine ( const MbDirection angle,
double  delta 
)
inline

Translate along the direction which is defined by a vector.

Parameters
[in]angle- A vector which defines the direction of the translation.
[in]delta- Magnitude of the translation.

◆ MoveAlongLine() [4/4]

void MbCartPoint::MoveAlongLine ( const MbVector vect,
double  delta 
)
inline

Translate along the direction which is defined by a vector.

Parameters
[in]angle- A vector which defines the direction of the translation.
[in]delta- Magnitude of the translation.

◆ MoveUntilDist()

void MbCartPoint::MoveUntilDist ( const MbCartPoint p1,
double  dist 
)

Translate the point towards a given point to the distance "dist".

Parameters
[in]p1- An initial point, which defines the direction of the translation.
[in]dist- Magnitude of the translation.

◆ GoNearToPoint()

void MbCartPoint::GoNearToPoint ( const MbCartPoint to,
double  ratio 
)
inline

Translate along the direction.

Translation along the direction of the "to" point to the distance which is defined by the ratio of "ratio" and distance between points.

Parameters
[in]to- A point.
[in]ratio- A distance part.

◆ Rotate() [1/4]

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

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.

◆ Rotate() [2/4]

void MbCartPoint::Rotate ( const MbCartPoint pnt,
const MbDirection angle 
)

Rotate by an angle.

An angle is defined by a rotation vector.

Parameters
[in]pnt- A point is a rotation center.
[in]angle- A rotation vector.

◆ Rotate() [3/4]

void MbCartPoint::Rotate ( double  angle)
inline

Rotate by an angle.

An angle defines a rotation vector.

Parameters
[in]angle- A rotation angle.

◆ Rotate() [4/4]

void MbCartPoint::Rotate ( const MbDirection angle)

Rotate by an angle.

An angle is defined by a rotation vector.

Parameters
[in]angle- A rotation vector.

◆ Mirror() [1/3]

MbCartPoint MbCartPoint::Mirror ( const MbCartPoint from) const
inline

Reflect a point specularly from a given point.

Parameters
[in]from- A point from which it is necessary to reflect the initial point.
Returns
Returns a reflected point.

◆ Mirror() [2/3]

MbCartPoint MbCartPoint::Mirror ( const MbCartPoint p1,
const MbCartPoint p2 
) const

Reflect a point specularly from a line.

Parameters
[in]p1,p2- Points which define a line.
Returns
Returns a reflected point.

◆ Mirror() [3/3]

void MbCartPoint::Mirror ( const MbCartPoint p1,
const MbDirection dir 
)
inline

Reflect a point specularly from a line.

The reflection from a line in the direction which is defined by the base point.

Parameters
[in]p1- A point which defines the direction of the reflection.
[in]dir- A vector defines a line from which the reflection is made.

◆ DistanceToLineSeg()

double MbCartPoint::DistanceToLineSeg ( const MbCartPoint p1,
const MbCartPoint p2 
) const

The distance from a point to a segment.

A segment is defined by two input points,

Parameters
[in]p1,p2- Start and end points of a segment.
Returns
The required distance.

◆ Scale()

void MbCartPoint::Scale ( double  sx,
double  sy 
)
inline

Scale the coordinates.

Parameters
[in]sx,sy- Scaling coefficients for components x & y respectively.

◆ Set() [1/6]

void MbCartPoint::Set ( const MbCartPoint v1,
const MbVector v2,
double  t2 
)
inline

Equate coordinates to sum of point coordinates and vector coordinates.

Equate coordinates to sum of v1 point coordinates and v2 vector coordinates multiplied by t2.

Parameters
[in]v1- The initial point.
[in]v2- The initial vector.
[in]t2- Coordinates of the initial vector v2 are multiplied by this number.

◆ Set() [2/6]

void MbCartPoint::Set ( const MbCartPoint v1,
const MbVector v2,
double  t2,
const MbVector v3,
double  t3 
)
inline

Equate coordinates to sum of point coordinates and two vectors coordinates.

Equate coordinates to sum of v1 point coordinates and v2 and v3 vectors coordinates multiplied by the numbers t2 and t3 respectively.

Parameters
[in]v1- The initial point.
[in]v2,v3- The initial vectors.
[in]t2,t3- Coordinates of v2 and v3 vectors are multiplied by these numbers respectively.

◆ Set() [3/6]

void MbCartPoint::Set ( const MbCartPoint v1,
double  t1,
const MbCartPoint v2,
double  t2 
)
inline

Equate coordinates to sum of two points coordinates.

Equate coordinates to sum of v1 and v2 points coordinates multiplied by the numbers t1 and t2 respectively.

Parameters
[in]v1,v2- Initial points.
[in]t1,t2- Coordinates of v1 and v2 points are multiplied by these numbers respectively.

◆ Set() [4/6]

void MbCartPoint::Set ( const MbCartPoint v1,
double  t1,
const MbCartPoint v2,
double  t2,
const MbCartPoint v3,
double  t3 
)
inline

Equate coordinates to sum of three points coordinates.

Equate coordinates to sum of v1, v2 and v3 points coordinates multiplied by the numbers t1, t2 and t3 respectively.

Parameters
[in]v1,v2,v3- Initial points.
[in]t1,t2,t3- Coordinates of v1, v2 and v3 points are multiplied by these numbers respectively.

◆ Set() [5/6]

void MbCartPoint::Set ( const MbCartPoint v1,
double  t1,
const MbCartPoint v2,
double  t2,
const MbCartPoint v3,
double  t3,
const MbCartPoint v4,
double  t4 
)
inline

Equate coordinates to sum of four points coordinates.

Equate coordinates to sum of v1, v2, v3 and v4 points coordinates multiplied by the numbers t1, t2, t3 and t4 respectively.

Parameters
[in]v1,v2,v3,v4- Initial points.
[in]t1,t2,t3,t4- Coordinates of v1, v2, v3 and v4 points are multiplied by these numbers respectively.

◆ Set() [6/6]

void MbCartPoint::Set ( const MbCartPoint v1,
const MbDirection v2,
double  t2,
const MbDirection v3,
double  t3 
)
inline

Equate coordinates to sum of point coordinates and two vectors coordinates.

Equate coordinates to sum of v1 point coordinates and v2 and v3 vectors coordinates multiplied by the numbers t2 and t3 respectively.

Parameters
[in]v1- The initial point.
[in]v2,v3- The initial vectors.
[in]t2,t3- Coordinates of v2 and v3 vectors are multiplied by these numbers respectively.

◆ Add() [1/8]

void MbCartPoint::Add ( const MbVector v1,
double  t1 
)
inline

Increase coordinates by values of vector components.

Increase coordinates by values of v1 vector components multiplied by t1.

Parameters
[in]v1- The initial vector.
[in]t1- Coordinates of the initial vector v1 are multiplied by this number.

◆ Add() [2/8]

void MbCartPoint::Add ( const MbVector v1,
double  t1,
const MbVector v2,
double  t2 
)
inline

Increase coordinates by values of two vectors components.

Increase coordinates by values of v1 and v2 vectors components multiplied by the numbers t1 and t2 respectively.

Parameters
[in]v1,v2- The initial vectors.
[in]t1,t2- Coordinates of v1 and v2 vectors are multiplied by these numbers respectively.

◆ Add() [3/8]

void MbCartPoint::Add ( const MbVector v1,
double  t1,
const MbVector v2,
double  t2,
const MbVector v3,
double  t3 
)
inline

Increase coordinates by values of v1, v2 and v3 vectors components multiplied by t1, t2 and t3 respectively.

Parameters
[in]v1,v2,v3- The initial vectors.
[in]t1,t2,t3- Coordinates of v1, v2 and v3 vectors are multiplied by these numbers respectively.

◆ Add() [4/8]

void MbCartPoint::Add ( const MbVector v1,
double  t1,
const MbVector v2,
double  t2,
const MbVector v3,
double  t3,
const MbVector v4,
double  t4 
)
inline

Increase coordinates by values of three vectors components.

Increase coordinates by values of v1, v2 and v3 vectors components multiplied by the numbers t1, t2 and t3 respectively.

Parameters
[in]v1,v2,v3- The initial vectors.
[in]t1,t2,t3- Coordinates of v1, v2 and v3 vectors are multiplied by these numbers respectively.

◆ Add() [5/8]

void MbCartPoint::Add ( const MbDirection v1,
double  t1,
const MbDirection v2,
double  t2 
)
inline

Increase coordinates by values of two vectors components.

Increase coordinates by values of v1 and v2 vectors components multiplied by the numbers t1 and t2 respectively.

Parameters
[in]v1,v2- The initial vectors.
[in]t1,t2- Coordinates of v1 and v2 vectors are multiplied by these numbers respectively.

◆ Add() [6/8]

void MbCartPoint::Add ( const MbCartPoint v1,
double  t1 
)
inline

Increase coordinates by values of point coordinates.

Increase coordinates by values of v1 point coordinates multiplied by t1.

Parameters
[in]v1- The initial point.
[in]t1- Coordinates of the initial point v1 are multiplied by this number.

◆ Add() [7/8]

void MbCartPoint::Add ( const MbCartPoint v1,
double  t1,
const MbCartPoint v2,
double  t2,
const MbCartPoint v3,
double  t3 
)
inline

Increase coordinates by values of three points coordinates.

Increase coordinates by values of v1, v2 and v3 points coordinates multiplied by the numbers t1, t2 and t3 respectively.

Parameters
[in]v1,v2,v3- Initial points.
[in]t1,t2,t3- Coordinates of v1, v2 and v3 points are multiplied by these numbers respectively.

◆ Add() [8/8]

void MbCartPoint::Add ( const MbCartPoint v1,
double  t1,
const MbCartPoint v2,
double  t2,
const MbCartPoint v3,
double  t3,
const MbCartPoint v4,
double  t4 
)
inline

Increase coordinates by values of four points coordinates.

Increase coordinates by values of v1, v2, v3 and v4 points coordinates multiplied by the numbers t1, t2, t3 and t4 respectively.

Parameters
[in]v1,v2,v3,v4- Initial points.
[in]t1,t2,t3,t4- Coordinates of v1, v2, v3 and v4 points are multiplied by these numbers respectively.

◆ IsSame()

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