DATAKIT API  V2025.1
Dtk_pnt Class Reference

This is a mathematical point class. More...

+ Inheritance diagram for Dtk_pnt:

Public Member Functions

Dtk_pnt Affinitised (const Dtk_pnt &p, const Dtk_dir &xdir, const Dtk_dir &ydir, double f[3]) const
 
void Affinity (const Dtk_pnt &, const Dtk_dir &xdir, const Dtk_dir &ydir, double f[3])
 
void Affinity (double f[3])
 
 Dtk_pnt ()
 default constructor More...
 
 Dtk_pnt (const double d[])
 constructor from a 3 double array More...
 
 Dtk_pnt (const Dtk_pnt &s)
 copy constructor More...
 
 Dtk_pnt (double a, double b, double c=0.0)
 constructor from 3 double More...
 
void GetXYZ (Dtk_Double64 &outX, Dtk_Double64 &outY, Dtk_Double64 &outZ) const
 Retrieves to the 3 coordinates of the class. More...
 
int IsEqual (const Dtk_pnt &inPointToCompare, const double inTolerance) const
 test if 2 Dtk_pnt are equal - with a tolerance - More...
 
Dtk_pnt Multiplied (const CDtk_3dMat &matrix) const
 
Dtk_pnt MultipliedByTransposed (const CDtk_3dMat &matrix) const
 
void Multiply (const CDtk_3dMat &matrix)
 
void MultiplyByTransposed (const CDtk_3dMat &matrix)
 
Dtk_pnt operator* (const CDtk_3dMat &matrix) const
 
Dtk_pnt operator* (double a) const
 
void operator*= (const CDtk_3dMat &matrix)
 
Dtk_pntoperator*= (double)
 
Dtk_pntoperator+= (const Dtk_dir &)
 translate the Dtk_pnt with the given Dtk_dir More...
 
Dtk_pnt operator- ()
 
Dtk_pntoperator-= (const Dtk_dir &)
 translate (in the opposite direction) the Dtk_pnt with the given Dtk_dir More...
 
Dtk_pntoperator/= (double)
 
Dtk_pntoperator= (const Dtk_pnt &s)
 
double & operator[] (Dtk_Size_t i)
 access to a specified coordinate of the Dtk_pnt More...
 
const double & operator[] (Dtk_Size_t i) const
 access to a specified coordinate of the Dtk_pnt. More...
 
Dtk_pnt PostMultiplied (const CDtk_3dMat &matrix) const
 
void PostMultiply (const CDtk_3dMat &matrix)
 
double Project (const Dtk_dir &zdir, double d)
 
double Project (const Dtk_dir &zdir, double d, const Dtk_dir &zPrj)
 
double Project (const Dtk_pnt &org, const Dtk_dir &zdir)
 
double Project (const Dtk_pnt &org, const Dtk_dir &zdir, const Dtk_dir &zPrj)
 
Dtk_pnt Projected (const Dtk_dir &zdir, double d) const
 
Dtk_pnt Projected (const Dtk_dir &zdir, double d, const Dtk_dir &zPrj) const
 
Dtk_pnt Projected (const Dtk_pnt &org, const Dtk_dir &zdir) const
 
Dtk_pnt Projected (const Dtk_pnt &org, const Dtk_dir &zdir, const Dtk_dir &zPrj) const
 
Dtk_pnt ProjectedOnLine (const Dtk_pnt &org, const Dtk_dir &dir) const
 
void ProjectOnLine (const Dtk_pnt &org, const Dtk_dir &dir)
 
void Rotate (const Dtk_dir &dir, double angle, const Dtk_pnt &center)
 
void Rotate (const Dtk_pnt &p0, const CDtk_3dMat &matrix)
 
Dtk_pnt Rotated (const Dtk_dir &dir, double angle, const Dtk_pnt &center) const
 
Dtk_pnt Rotated (const Dtk_pnt &p0, const CDtk_3dMat &matrix) const
 
void Scale (const Dtk_pnt &p0, double s)
 
Dtk_pnt Scaled (const Dtk_pnt &p0, double s) const
 
void SetXYZ (const Dtk_Double64 &inX, const Dtk_Double64 &inY, const Dtk_Double64 &inZ)
 Sets the 3 coordinates of the class. More...
 
double Solve (const CDtk_3dMat &matrix, const Dtk_dir &col3)
 
double Solve (const Dtk_dir &col0, const Dtk_dir &col1, const Dtk_dir &col2, const Dtk_dir &col3)
 
Dtk_pnt Symetrised (const Dtk_pnt &opl, const Dtk_dir &zpl) const
 
void Symetry (const Dtk_dir &zpl)
 
void Symetry (const Dtk_pnt &opl, const Dtk_dir &zpl)
 
void Transform (const CDtk_3dMat &matrix)
 
Dtk_pnt Transformed (const CDtk_3dMat &matrix) const
 
void Translate (const Dtk_dir &dir)
 
void Translate (const Dtk_pnt &p0, const Dtk_pnt &p1)
 
Dtk_pnt Translated (const Dtk_dir &dir) const
 
Dtk_pnt Translated (const Dtk_pnt &p0, const Dtk_pnt &p1) const
 
double & x ()
 access to x coordinate of the Dtk_pnt. More...
 
const double & x () const
 access to x coordinate of the Dtk_pnt. More...
 
double & y ()
 access to y coordinate of the Dtk_pnt. More...
 
const double & y () const
 access to y coordinate of the Dtk_pnt. More...
 
double & z ()
 access to z coordinate of the Dtk_pnt. More...
 
const double & z () const
 access to z coordinate of the Dtk_pnt. More...
 
 ~Dtk_pnt ()
 

Static Public Member Functions

static Dtk_Double64 ProcessDistance (const Dtk_pnt &inPoint1, const Dtk_pnt &inPoint2)
 
static void ProcessMiddlePoint (const Dtk_pnt &inPntA, const Dtk_pnt &inPntB, Dtk_pnt &outMiddlePnt)
 

Protected Attributes

double _Coords [3]
 

Friends

double Argument (const Dtk_pnt &O, const Dtk_dir &x, const Dtk_dir &y, const Dtk_pnt &P)
 
double Argument (const Dtk_pnt &O, const Dtk_dir &x, const Dtk_pnt &P)
 
double Argument (const Dtk_pnt &P)
 
int operator!= (const Dtk_pnt &, const Dtk_pnt &)
 test if 2 Dtk_pnt are different More...
 
Dtk_pnt operator* (double, const Dtk_pnt &)
 
Dtk_pnt operator+ (const Dtk_pnt &, const Dtk_dir &)
 translate a Dtk_pnt with a Dtk_dir More...
 
Dtk_dir operator- (const Dtk_pnt &, const Dtk_dir &)
 translate (in the opposite direction) a Dtk_pnt with a Dtk_dir More...
 
Dtk_pnt operator/ (const Dtk_pnt &, double)
 
Dtk_pnt operator/ (double, const Dtk_pnt &)
 
std::ostream & operator<< (std::ostream &o, const Dtk_pnt &d)
 
int operator== (const Dtk_pnt &, const Dtk_pnt &)
 test if 2 Dtk_pnt are equal More...
 

Detailed Description

This is a mathematical point class.

This class provides all method about points

Constructor & Destructor Documentation

◆ Dtk_pnt() [1/4]

Dtk_pnt::Dtk_pnt ( )

default constructor

◆ ~Dtk_pnt()

Dtk_pnt::~Dtk_pnt ( )
28 {}

◆ Dtk_pnt() [2/4]

Dtk_pnt::Dtk_pnt ( const Dtk_pnt s)

copy constructor

◆ Dtk_pnt() [3/4]

Dtk_pnt::Dtk_pnt ( double  a,
double  b,
double  c = 0.0 
)

constructor from 3 double

◆ Dtk_pnt() [4/4]

Dtk_pnt::Dtk_pnt ( const double  d[])

constructor from a 3 double array

Member Function Documentation

◆ Affinitised()

Dtk_pnt Dtk_pnt::Affinitised ( const Dtk_pnt p,
const Dtk_dir xdir,
const Dtk_dir ydir,
double  f[3] 
) const

◆ Affinity() [1/2]

void Dtk_pnt::Affinity ( const Dtk_pnt ,
const Dtk_dir xdir,
const Dtk_dir ydir,
double  f[3] 
)

◆ Affinity() [2/2]

void Dtk_pnt::Affinity ( double  f[3])
259 { _Coords[ 0 ] *= f[ 0 ]; _Coords[ 1 ] *= f[ 1 ]; _Coords[ 2 ] *= f[ 2 ]; }

◆ GetXYZ()

void Dtk_pnt::GetXYZ ( Dtk_Double64 outX,
Dtk_Double64 outY,
Dtk_Double64 outZ 
) const

Retrieves to the 3 coordinates of the class.

Warning
You can't modify the returned value.
80  {
81  outX = _Coords[ 0 ];
82  outY = _Coords[ 1 ];
83  outZ = _Coords[ 2 ];
84  }

◆ IsEqual()

int Dtk_pnt::IsEqual ( const Dtk_pnt inPointToCompare,
const double  inTolerance 
) const

test if 2 Dtk_pnt are equal - with a tolerance -

Parameters
pnt2the Dtk_pnt to compare
tolthe tolerance to compare
Returns
0 if not equals != 0 else

Sample:

Dtk_pnt a(0.0,0.0,0.0);
Dtk_pnt b(15.0,0.0,0.0);
...
if(a.is_equal(b, 0.1))
{...}

◆ Multiplied()

Dtk_pnt Dtk_pnt::Multiplied ( const CDtk_3dMat &  matrix) const

◆ MultipliedByTransposed()

Dtk_pnt Dtk_pnt::MultipliedByTransposed ( const CDtk_3dMat &  matrix) const

◆ Multiply()

void Dtk_pnt::Multiply ( const CDtk_3dMat &  matrix)

◆ MultiplyByTransposed()

void Dtk_pnt::MultiplyByTransposed ( const CDtk_3dMat &  matrix)

◆ operator*() [1/2]

Dtk_pnt Dtk_pnt::operator* ( const CDtk_3dMat &  matrix) const
269 {
270  return Multiplied( matrix );
271 }

◆ operator*() [2/2]

Dtk_pnt Dtk_pnt::operator* ( double  a) const
144 { return Dtk_pnt( _Coords[ 0 ] * a, _Coords[ 1 ] * a, _Coords[ 2 ] * a ); }

◆ operator*=() [1/2]

void Dtk_pnt::operator*= ( const CDtk_3dMat &  matrix)
264 {
265  Multiply( matrix );
266 }

◆ operator*=() [2/2]

Dtk_pnt& Dtk_pnt::operator*= ( double  )

◆ operator+=()

Dtk_pnt& Dtk_pnt::operator+= ( const Dtk_dir )

translate the Dtk_pnt with the given Dtk_dir

Parameters
athe translation direction

Sample:

Dtk_pnt a(0.0,0.0,0.0);
Dtk_dir b(15.0,0.0,0.0);
a += b; //Now a is (15.0,0.0,0.0)

◆ operator-()

Dtk_pnt Dtk_pnt::operator- ( )

◆ operator-=()

Dtk_pnt& Dtk_pnt::operator-= ( const Dtk_dir )

translate (in the opposite direction) the Dtk_pnt with the given Dtk_dir

Parameters
athe translation direction

Sample:

Dtk_pnt a(0.0,0.0,0.0);
Dtk_dir b(15.0,0.0,0.0);
a -= b; //Now a is (-15.0,0.0,0.0)

◆ operator/=()

Dtk_pnt& Dtk_pnt::operator/= ( double  )

◆ operator=()

Dtk_pnt& Dtk_pnt::operator= ( const Dtk_pnt s)

◆ operator[]() [1/2]

double& Dtk_pnt::operator[] ( Dtk_Size_t  i)

access to a specified coordinate of the Dtk_pnt

  • i = 0 => X coordinate
  • i = 1 => Y coordinate
  • i = 2 => Z coordinate
41  {
42  Pdtk_Assert( i < 3 );
43  return _Coords[ i ];
44  }

◆ operator[]() [2/2]

const double& Dtk_pnt::operator[] ( Dtk_Size_t  i) const

access to a specified coordinate of the Dtk_pnt.

Warning
You can't modify the returned value.
  • i = 0 => X coordinate
  • i = 1 => Y coordinate
  • i = 2 => Z coordinate
51  {
52  Pdtk_Assert( i < 3 );
53  return _Coords[ i ];
54  }

◆ PostMultiplied()

Dtk_pnt Dtk_pnt::PostMultiplied ( const CDtk_3dMat &  matrix) const

◆ PostMultiply()

void Dtk_pnt::PostMultiply ( const CDtk_3dMat &  matrix)

◆ ProcessDistance()

static Dtk_Double64 Dtk_pnt::ProcessDistance ( const Dtk_pnt inPoint1,
const Dtk_pnt inPoint2 
)
static
201  {
202  Dtk_Double64 dist = 0.0;
203  Dtk_Size_t i;
204 
205  for( i = 0; i < 3; i++ )
206  dist += ( inPoint1[ i ] - inPoint2[ i ] ) * ( inPoint1[ i ] - inPoint2[ i ] );
207 
208  return static_cast< Dtk_Double64 >( sqrt( dist ) );
209  }

◆ ProcessMiddlePoint()

static void Dtk_pnt::ProcessMiddlePoint ( const Dtk_pnt inPntA,
const Dtk_pnt inPntB,
Dtk_pnt outMiddlePnt 
)
static
195  {
196  for( Dtk_Size_t i = 0; i < 3; i++ )
197  outMiddlePnt[ i ] = ( inPntA[ i ] + inPntB[ i ] ) / 2.0;
198  }

◆ Project() [1/4]

double Dtk_pnt::Project ( const Dtk_dir zdir,
double  d 
)

◆ Project() [2/4]

double Dtk_pnt::Project ( const Dtk_dir zdir,
double  d,
const Dtk_dir zPrj 
)

◆ Project() [3/4]

double Dtk_pnt::Project ( const Dtk_pnt org,
const Dtk_dir zdir 
)

◆ Project() [4/4]

double Dtk_pnt::Project ( const Dtk_pnt org,
const Dtk_dir zdir,
const Dtk_dir zPrj 
)

◆ Projected() [1/4]

Dtk_pnt Dtk_pnt::Projected ( const Dtk_dir zdir,
double  d 
) const
295 {
296  Dtk_pnt tmp = *this;
297  tmp.Project( zdir, d );
298  return tmp;
299 }

◆ Projected() [2/4]

Dtk_pnt Dtk_pnt::Projected ( const Dtk_dir zdir,
double  d,
const Dtk_dir zPrj 
) const
288 {
289  Dtk_pnt tmp = *this;
290  tmp.Project( zdir, d, zprj );
291  return tmp;
292 }

◆ Projected() [3/4]

Dtk_pnt Dtk_pnt::Projected ( const Dtk_pnt org,
const Dtk_dir zdir 
) const
281 {
282  Dtk_pnt tmp = *this;
283  tmp.Project( org, zdir );
284  return tmp;
285 }

◆ Projected() [4/4]

Dtk_pnt Dtk_pnt::Projected ( const Dtk_pnt org,
const Dtk_dir zdir,
const Dtk_dir zPrj 
) const
274 {
275  Dtk_pnt tmp = *this;
276  tmp.Project( org, zdir, zprj );
277  return tmp;
278 }

◆ ProjectedOnLine()

Dtk_pnt Dtk_pnt::ProjectedOnLine ( const Dtk_pnt org,
const Dtk_dir dir 
) const
302 {
303  Dtk_pnt tmp = *this;
304  tmp.ProjectOnLine( org, dir );
305  return tmp;
306 }

◆ ProjectOnLine()

void Dtk_pnt::ProjectOnLine ( const Dtk_pnt org,
const Dtk_dir dir 
)

◆ Rotate() [1/2]

void Dtk_pnt::Rotate ( const Dtk_dir dir,
double  angle,
const Dtk_pnt center 
)

◆ Rotate() [2/2]

void Dtk_pnt::Rotate ( const Dtk_pnt p0,
const CDtk_3dMat &  matrix 
)

◆ Rotated() [1/2]

Dtk_pnt Dtk_pnt::Rotated ( const Dtk_dir dir,
double  angle,
const Dtk_pnt center 
) const

◆ Rotated() [2/2]

Dtk_pnt Dtk_pnt::Rotated ( const Dtk_pnt p0,
const CDtk_3dMat &  matrix 
) const

◆ Scale()

void Dtk_pnt::Scale ( const Dtk_pnt p0,
double  s 
)

◆ Scaled()

Dtk_pnt Dtk_pnt::Scaled ( const Dtk_pnt p0,
double  s 
) const

◆ SetXYZ()

void Dtk_pnt::SetXYZ ( const Dtk_Double64 inX,
const Dtk_Double64 inY,
const Dtk_Double64 inZ 
)

Sets the 3 coordinates of the class.

88  {
89  _Coords[ 0 ] = inX;
90  _Coords[ 1 ] = inY;
91  _Coords[ 2 ] = inZ;
92  }

◆ Solve() [1/2]

double Dtk_pnt::Solve ( const CDtk_3dMat &  matrix,
const Dtk_dir col3 
)

◆ Solve() [2/2]

double Dtk_pnt::Solve ( const Dtk_dir col0,
const Dtk_dir col1,
const Dtk_dir col2,
const Dtk_dir col3 
)

◆ Symetrised()

Dtk_pnt Dtk_pnt::Symetrised ( const Dtk_pnt opl,
const Dtk_dir zpl 
) const

◆ Symetry() [1/2]

void Dtk_pnt::Symetry ( const Dtk_dir zpl)

◆ Symetry() [2/2]

void Dtk_pnt::Symetry ( const Dtk_pnt opl,
const Dtk_dir zpl 
)

◆ Transform()

void Dtk_pnt::Transform ( const CDtk_3dMat &  matrix)

◆ Transformed()

Dtk_pnt Dtk_pnt::Transformed ( const CDtk_3dMat &  matrix) const

◆ Translate() [1/2]

void Dtk_pnt::Translate ( const Dtk_dir dir)

◆ Translate() [2/2]

void Dtk_pnt::Translate ( const Dtk_pnt p0,
const Dtk_pnt p1 
)

◆ Translated() [1/2]

Dtk_pnt Dtk_pnt::Translated ( const Dtk_dir dir) const

◆ Translated() [2/2]

Dtk_pnt Dtk_pnt::Translated ( const Dtk_pnt p0,
const Dtk_pnt p1 
) const

◆ x() [1/2]

double& Dtk_pnt::x ( )

access to x coordinate of the Dtk_pnt.

57 { return _Coords[ 0 ]; }

◆ x() [2/2]

const double& Dtk_pnt::x ( ) const

access to x coordinate of the Dtk_pnt.

Warning
You can't modify the returned value.
61 { return _Coords[ 0 ]; }

◆ y() [1/2]

double& Dtk_pnt::y ( )

access to y coordinate of the Dtk_pnt.

64 { return _Coords[ 1 ]; }

◆ y() [2/2]

const double& Dtk_pnt::y ( ) const

access to y coordinate of the Dtk_pnt.

Warning
You can't modify the returned value.
68 { return _Coords[ 1 ]; }

◆ z() [1/2]

double& Dtk_pnt::z ( )

access to z coordinate of the Dtk_pnt.

71 { return _Coords[ 2 ]; }

◆ z() [2/2]

const double& Dtk_pnt::z ( ) const

access to z coordinate of the Dtk_pnt.

Warning
You can't modify the returned value.
75 { return _Coords[ 2 ]; }

Friends And Related Function Documentation

◆ Argument [1/3]

double Argument ( const Dtk_pnt O,
const Dtk_dir x,
const Dtk_dir y,
const Dtk_pnt P 
)
friend

◆ Argument [2/3]

double Argument ( const Dtk_pnt O,
const Dtk_dir x,
const Dtk_pnt P 
)
friend

◆ Argument [3/3]

double Argument ( const Dtk_pnt P)
friend

◆ operator!=

int operator!= ( const Dtk_pnt ,
const Dtk_pnt  
)
friend

test if 2 Dtk_pnt are different

Parameters
uthe first Dtk_pnt
vthe second Dtk_pnt
Returns
0 if equals != 0 else

Sample:

Dtk_pnt a(0.0,0.0,0.0);
Dtk_pnt b(15.0,0.0,0.0);
...
if(a != b)
{...}

◆ operator*

Dtk_pnt operator* ( double  ,
const Dtk_pnt  
)
friend

◆ operator+

Dtk_pnt operator+ ( const Dtk_pnt ,
const Dtk_dir  
)
friend

translate a Dtk_pnt with a Dtk_dir

Parameters
uthe point to translate
vthe translation direction
Returns
the translated point

Sample:

Dtk_pnt a(0.0,0.0,0.0);
Dtk_dir b(15.0,0.0,0.0);
c = a + b; //Now c is (15.0,0.0,0.0)

◆ operator-

Dtk_dir operator- ( const Dtk_pnt ,
const Dtk_dir  
)
friend

translate (in the opposite direction) a Dtk_pnt with a Dtk_dir

Parameters
uthe point to translate
vthe translation direction
Returns
the translated point

Sample:

Dtk_pnt a(0.0,0.0,0.0);
Dtk_dir b(15.0,0.0,0.0);
c = a - b; //Now c is (-15.0,0.0,0.0)

◆ operator/ [1/2]

Dtk_pnt operator/ ( const Dtk_pnt ,
double   
)
friend

◆ operator/ [2/2]

Dtk_pnt operator/ ( double  ,
const Dtk_pnt  
)
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  o,
const Dtk_pnt d 
)
friend

◆ operator==

int operator== ( const Dtk_pnt ,
const Dtk_pnt  
)
friend

test if 2 Dtk_pnt are equal

Parameters
uthe first Dtk_pnt
vthe second Dtk_pnt
Returns
0 if not equals != 0 else

Sample:

Dtk_pnt a(0.0,0.0,0.0);
Dtk_pnt b(15.0,0.0,0.0);
...
if(a == b)
{...}

Field Documentation

◆ _Coords

double Dtk_pnt::_Coords[3]
protected
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:712
Dtk_pnt::Multiplied
Dtk_pnt Multiplied(const CDtk_3dMat &matrix) const
Dtk_pnt::ProjectOnLine
void ProjectOnLine(const Dtk_pnt &org, const Dtk_dir &dir)
Dtk_pnt::Project
double Project(const Dtk_pnt &org, const Dtk_dir &zdir, const Dtk_dir &zPrj)
Dtk_pnt::Dtk_pnt
Dtk_pnt()
default constructor
Dtk_Double64
double Dtk_Double64
Definition: define.h:699
Pdtk_Assert
#define Pdtk_Assert(X)
Definition: define.h:742
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:22
Dtk_pnt::Multiply
void Multiply(const CDtk_3dMat &matrix)
Dtk_pnt::_Coords
double _Coords[3]
Definition: dtk_pnt.hpp:24
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:15