C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

The three-dimensional point. More...

#include <mb_cart_point3d.h>

+ Collaboration diagram for MbCartPoint3D:

Public Member Functions

 MbCartPoint3D ()
 Constructor without parameters. A point is located at the origin of global coordinates.
 
 MbCartPoint3D (const MbCartPoint3D &p)
 Copy-constructor.
 
 MbCartPoint3D (const MbFloatPoint3D &)
 Copy-constructor.
 
 MbCartPoint3D (double xx, double yy, double zz)
 Constructor by coordinates.
 
 MbCartPoint3D (const MbCartPoint3D &p, const MbMatrix3D &matr)
 Constructor by a point in a local coordinate system. More...
 
 MbCartPoint3D (const MbCartPoint &p, const MbPlacement3D &place)
 Constructor by a two-dimensional point. More...
 
void Init (const MbCartPoint &p, const MbPlacement3D &place)
 The initialization by two-dimensional point. More...
 
void Init (const MbCartPoint &p)
 The initialization by two-dimensional point.
 
template<class Point >
MbCartPoint3DInit (const Point &p)
 Initialize by another point.
 
MbCartPoint3DInit (double xx, double yy, double zz)
 Initialize by coordinates.
 
MbCartPoint3DTransform (const MbMatrix3D &)
 Transform according to the matrix.
 
MbCartPoint3DMove (double dx, double dy, double dz)
 Translate along a vector.
 
MbCartPoint3DMove (const MbVector3D &to)
 Translate along a vector.
 
MbCartPoint3DRotate (const MbAxis3D &, double angle)
 Rotate around an axis.
 
double DistanceToPoint (const MbCartPoint3D &) const
 The distance to a point.
 
void SetZero ()
 Set coordinates to zero.
 
double DistanceToPoint2 (const MbCartPoint3D &to) const
 The squared distance between two points. More...
 
void MoveAlongLine (const MbCartPoint3D &to, double delta)
 Translate in the direction of the "to" point on the "delta" distance.

 
void GoNearToPoint (const MbCartPoint3D &to, double ratio)
 Translate along the direction. More...
 
void Maximum (const MbCartPoint3D &p)
 The initialization by the maximum coordinates. More...
 
void Minimum (const MbCartPoint3D &p)
 The initialization by the minimal coordinates. More...
 
void Perspective (double znear)
 Increase coordinates x and y in ( znear / z ) times. More...
 
void Mirror (const MbCartPoint3D &p0, const MbVector3D &dir)
 The specular reflection of a point relative to a plane. More...
 
void Scale (double sx, double sy, double sz)
 Scale the coordinates. More...
 
void Scale (double s)
 Scale the coordinates. More...
 
double MaxFactor () const
 Get the maximum absolute coordinate

 
bool SetRoundedValue (bool total, double eps)
 Rounded with eps tolerance. More...
 
void GetProperties (MbProperties &)
 Get properties of the object.
 
void SetProperties (const MbProperties &)
 Set properties of the object.
 
bool IsSame (const MbCartPoint3D &other, double accuracy) const
 Are the objects equal? More...
 
bool IsUndefined () const
 Is the point undefined?
 
Logical and arithmetical operations.
void operator+= (const MbVector3D &)
 Add a vector.
 
void operator-= (const MbVector3D &)
 Subtract a vector.
 
void operator+= (const MbCartPoint3D &)
 Add point coordinates.
 
void operator-= (const MbCartPoint3D &)
 Subtract point coordinates.
 
void operator*= (double factor)
 Multiply coordinates by a factor.
 
void operator/= (double factor)
 Divide coordinates by a factor.
 
bool operator== (const MbCartPoint3D &) const
 Check for equality.
 
bool operator!= (const MbCartPoint3D &) const
 Check for inequality.
 
bool operator< (const MbCartPoint3D &) const
 Check for "less".
 
bool operator> (const MbCartPoint3D &) const
 Check for "greater".
 
MbCartPoint3Doperator= (const MbCartPoint3D &)
 Assign coordinates of another point to the point.
 
MbCartPoint3Doperator= (const MbFloatPoint3D &)
 Assign coordinates of another point to the point.
 
MbCartPoint3Doperator= (const MbVector3D &)
 Assign vector components to the point.
 
MbCartPoint3Doperator= (const MbHomogeneous3D &)
 Assign values of uniform coordinates to the point.
 
MbCartPoint3D operator+ (const MbVector3D &) const
 Add a point and vector.
 
MbCartPoint3D operator- (const MbVector3D &) const
 Subtract a vector from the point.
 
MbVector3D operator+ (const MbCartPoint3D &) const
 Add two points.
 
MbVector3D operator- (const MbCartPoint3D &) const
 Subtract a point from the point.
 
MbCartPoint3D operator- () const
 The unary minus.
 
MbCartPoint3D operator* (const MbMatrix3D &) const
 Calculate the point as this copy transformed by the matrix.
 
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.
 
The functions of addition and multiplication of points with points and vectors.
MbCartPoint3DSetAdd (const MbCartPoint3D &v1, const MbVector3D &v2)
 Equate coordinates to sum of point coordinates and vector coordinates. More...
 
MbCartPoint3DSetDec (const MbCartPoint3D &v1, const MbVector3D &v2)
 Equate difference between the coordinates of point and vector to coordinates. More...
 
MbCartPoint3DSet (const MbCartPoint3D &v1, const MbVector3D &v2, double t2)
 Equate coordinates to sum of point coordinates and vector coordinates. More...
 
MbCartPoint3DSet (const MbCartPoint3D &v1, const MbVector3D &v2, double t2, const MbVector3D &v3, double t3)
 Equate coordinates to sum of point coordinates and two vectors coordinates. More...
 
MbCartPoint3DSet (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2)
 Equate sum of the components of two vectors to coordinates. More...
 
MbCartPoint3DSet (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2, const MbVector3D &v3, double t3, const MbVector3D &v4, double t4)
 Equate coordinates to sum of the components of four vectors. More...
 
MbCartPoint3DSet (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2)
 Equate coordinates to sum of two points coordinates. More...
 
MbCartPoint3DSet (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2, const MbCartPoint3D &v3, double t3)
 Equate coordinates to sum of three points coordinates. More...
 
MbCartPoint3DSet (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2, const MbCartPoint3D &v3, double t3, const MbCartPoint3D &v4, double t4)
 Equate coordinates to sum of four points coordinates. More...
 
void Add (const MbVector3D &v1, double t1)
 Increase coordinates by values of vector components. More...
 
void Add (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2)
 Increase coordinates by values of two vectors components. More...
 
void Add (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2, const MbVector3D &v3, double t3)
 Increase coordinates by values of three vectors components. More...
 
void Add (const MbVector3D &v1, double t1, const MbVector3D &v2, double t2, const MbVector3D &v3, double t3, const MbVector3D &v4, double t4)
 Increase coordinates by components values of four vectors. More...
 
void Add (const MbCartPoint3D &v1, double t1)
 Increase coordinates by values of point coordinates. More...
 
void Add (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2, const MbCartPoint3D &v3, double t3)
 Increase coordinates by values of three points coordinates. More...
 
void Add (const MbCartPoint3D &v1, double t1, const MbCartPoint3D &v2, double t2, const MbCartPoint3D &v3, double t3, const MbCartPoint3D &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.
 
double z
 A third coordinate of point.

 

Static Public Attributes

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

Detailed Description

The three-dimensional point.

The three-dimensional point (cartesian point) is defined by three coordinates in a cartesian coordinate system. The point is named cartesian in honor of French scientist Rene Descartes (lat. Renatus Cartesius).
A point can be defined by radius-vector. A radius-vector describes transform which translates a start point of a cartesian coordinate system to a space point with the given coordinates in this system.

Constructor & Destructor Documentation

◆ MbCartPoint3D() [1/2]

MbCartPoint3D::MbCartPoint3D ( const MbCartPoint3D p,
const MbMatrix3D matr 
)

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.

◆ MbCartPoint3D() [2/2]

MbCartPoint3D::MbCartPoint3D ( const MbCartPoint p,
const MbPlacement3D place 
)

Constructor by a two-dimensional point.

A two-dimensional point is located in the XOY plane defined by a local coordinate system.

Parameters
[in]p- A two-dimensional point.
[in]place- The initial local coordinate system.

Member Function Documentation

◆ Init()

void MbCartPoint3D::Init ( const MbCartPoint p,
const MbPlacement3D place 
)

The initialization by two-dimensional point.

A two-dimensional point is located in the XOY plane defined by a local coordinate system.

Parameters
[in]p- A two-dimensional point.
[in]place- The initial local coordinate system.

◆ DistanceToPoint2()

double MbCartPoint3D::DistanceToPoint2 ( const MbCartPoint3D to) const
inline

The squared distance between two points.

Calculate the squared distance from point to point.

Parameters
[in]to- A point.
Returns
The squared distance between two points.

◆ GoNearToPoint()

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

Translate along the direction.

The translation in the direction of point "to" to the distance which is defined by the ratio of "ratio" and the distance between points.

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

◆ Maximum()

void MbCartPoint3D::Maximum ( const MbCartPoint3D p)
inline

The initialization by the maximum coordinates.

A coordinate x (or y, z) of a point is initialized by maximum value which is got from comparison of corresponding coordinate of initial point and point given in function argument.

Parameters
[in]p- A given point.

◆ Minimum()

void MbCartPoint3D::Minimum ( const MbCartPoint3D p)
inline

The initialization by the minimal coordinates.

A coordinate x (or y, z) of a point is initialized by minimal value which is got from comparison of corresponding coordinate of initial point and point given in function argument.

Parameters
[in]p- A given point.

◆ Perspective()

void MbCartPoint3D::Perspective ( double  znear)

Increase coordinates x and y in ( znear / z ) times.

The increase of coordinates is produced for a perspective transformation. A point must be located in a local or view coordinate system. Z-coordinate of a point can't be equal to zero.

Parameters
[in]znear- The value znear/z defines the scale factor.

◆ Mirror()

void MbCartPoint3D::Mirror ( const MbCartPoint3D p0,
const MbVector3D dir 
)
inline

The specular reflection of a point relative to a plane.

The specular reflection of a point relative to a plane with origin "p0" and normal "dir".

Parameters
[in]p0- A point of plane of symmetry.
[in]dir- A direction of normal of plane of symmetry.

◆ SetAdd()

MbCartPoint3D & MbCartPoint3D::SetAdd ( const MbCartPoint3D v1,
const MbVector3D v2 
)
inline

Equate coordinates to sum of point coordinates and vector coordinates.

Parameters
[in]v1- The initial point.
[in]v2- The initial vector.

◆ SetDec()

MbCartPoint3D & MbCartPoint3D::SetDec ( const MbCartPoint3D v1,
const MbVector3D v2 
)
inline

Equate difference between the coordinates of point and vector to coordinates.

Parameters
[in]v1- The initial point.
[in]v2- The initial vector.

◆ Set() [1/7]

MbCartPoint3D & MbCartPoint3D::Set ( const MbCartPoint3D v1,
const MbVector3D 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- Factor the coordinates of the initial vector v2 are multiplied by.

◆ Set() [2/7]

MbCartPoint3D & MbCartPoint3D::Set ( const MbCartPoint3D v1,
const MbVector3D v2,
double  t2,
const MbVector3D 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/7]

MbCartPoint3D & MbCartPoint3D::Set ( const MbVector3D v1,
double  t1,
const MbVector3D v2,
double  t2 
)
inline

Equate sum of the components of two vectors to coordinates.

Equate coordinates to sum 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.

◆ Set() [4/7]

MbCartPoint3D & MbCartPoint3D::Set ( const MbVector3D v1,
double  t1,
const MbVector3D v2,
double  t2,
const MbVector3D v3,
double  t3,
const MbVector3D v4,
double  t4 
)
inline

Equate coordinates to sum of the components of four vectors.

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

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

◆ Set() [5/7]

MbCartPoint3D & MbCartPoint3D::Set ( const MbCartPoint3D v1,
double  t1,
const MbCartPoint3D 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() [6/7]

MbCartPoint3D & MbCartPoint3D::Set ( const MbCartPoint3D v1,
double  t1,
const MbCartPoint3D v2,
double  t2,
const MbCartPoint3D 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() [7/7]

MbCartPoint3D & MbCartPoint3D::Set ( const MbCartPoint3D v1,
double  t1,
const MbCartPoint3D v2,
double  t2,
const MbCartPoint3D v3,
double  t3,
const MbCartPoint3D 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.

◆ Add() [1/7]

void MbCartPoint3D::Add ( const MbVector3D 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/7]

void MbCartPoint3D::Add ( const MbVector3D v1,
double  t1,
const MbVector3D 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/7]

void MbCartPoint3D::Add ( const MbVector3D v1,
double  t1,
const MbVector3D v2,
double  t2,
const MbVector3D v3,
double  t3 
)
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() [4/7]

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

Increase coordinates by components values of four vectors.

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

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

◆ Add() [5/7]

void MbCartPoint3D::Add ( const MbCartPoint3D 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() [6/7]

void MbCartPoint3D::Add ( const MbCartPoint3D v1,
double  t1,
const MbCartPoint3D v2,
double  t2,
const MbCartPoint3D 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() [7/7]

void MbCartPoint3D::Add ( const MbCartPoint3D v1,
double  t1,
const MbCartPoint3D v2,
double  t2,
const MbCartPoint3D v3,
double  t3,
const MbCartPoint3D 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.

◆ Scale() [1/2]

void MbCartPoint3D::Scale ( double  sx,
double  sy,
double  sz 
)
inline

Scale the coordinates.

Parameters
[in]sx,sy,sz- Scale factors for x,y and z components respectively.

◆ Scale() [2/2]

void MbCartPoint3D::Scale ( double  s)
inline

Scale the coordinates.

Parameters
[in]s- A scale factor.

◆ SetRoundedValue()

bool MbCartPoint3D::SetRoundedValue ( bool  total,
double  eps 
)

Rounded with eps tolerance.

Point coordinates are rounded with a given tolerance.

Parameters
[in]total- If true round anyway.
[in]eps- A round-off tolerance.
Returns
Returns true if round-off has been done.

◆ IsSame()

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