MRPT  2.0.4
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
mrpt::math::TLine3D Struct Reference

Detailed Description

3D line, represented by a base point and a director vector.

See also
TLine2D,TSegment3D,TPlane,TPolygon3D,TPoint3D

Definition at line 19 of file TLine3D.h.

#include <mrpt/math/TLine3D.h>

Public Member Functions

 TLine3D ()=default
 Fast default constructor. More...
 
 TLine3D (const TPoint3D &p1, const TPoint3D &p2)
 Constructor from two points, through which the line will pass. More...
 
 TLine3D (const TSegment3D &s)
 Constructor from 3D segment
More...
 
 TLine3D (const TLine2D &l)
 Constructor from 2D object. More...
 
bool contains (const TPoint3D &point) const
 Check whether a point is inside the line. More...
 
double distance (const TPoint3D &point) const
 Distance between the line and a point. More...
 
void unitarize ()
 Unitarize director vector. More...
 
void getDirectorVector (double(&vector)[3]) const
 Get director vector. More...
 
const TVector3DgetDirectorVector () const
 Get director vector (may be NOT unitary if not set so by the user) More...
 
void getUnitaryDirectorVector (double(&vector)[3])
 Unitarize and then get director vector. More...
 
void generate2DObject (TLine2D &l) const
 Project into 2D space, discarding the Z coordinate. More...
 

Static Public Member Functions

static TLine3D FromPointAndDirector (const TPoint3D &basePoint, const TVector3D &directorVector)
 Static constructor from a point and a director vector. More...
 
static TLine3D FromTwoPoints (const TPoint3D &p1, const TPoint3D &p2)
 Static constructor from two points. More...
 

Public Attributes

TPoint3D pBase
 Base point. More...
 
TVector3D director {.0, .0, .0}
 Director vector. More...
 

Constructor & Destructor Documentation

◆ TLine3D() [1/4]

mrpt::math::TLine3D::TLine3D ( )
default

Fast default constructor.

Initializes to all zeros.

Referenced by FromTwoPoints().

◆ TLine3D() [2/4]

TLine3D::TLine3D ( const TPoint3D p1,
const TPoint3D p2 
)

Constructor from two points, through which the line will pass.

Exceptions
std::logic_errorif both points are the same.

Definition at line 76 of file TLine3D.cpp.

References director, mrpt::math::distance(), mrpt::math::getEpsilon(), pBase, mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.

◆ TLine3D() [3/4]

TLine3D::TLine3D ( const TSegment3D s)
explicit

◆ TLine3D() [4/4]

TLine3D::TLine3D ( const TLine2D l)
explicit

Member Function Documentation

◆ contains()

bool TLine3D::contains ( const TPoint3D point) const

◆ distance()

double TLine3D::distance ( const TPoint3D point) const

◆ FromPointAndDirector()

TLine3D TLine3D::FromPointAndDirector ( const TPoint3D basePoint,
const TVector3D directorVector 
)
static

Static constructor from a point and a director vector.

Note
[New in MRPT 2.0.4]

Definition at line 25 of file TLine3D.cpp.

References director, and pBase.

◆ FromTwoPoints()

TLine3D TLine3D::FromTwoPoints ( const TPoint3D p1,
const TPoint3D p2 
)
static

Static constructor from two points.

Note
[New in MRPT 2.0.4]

Definition at line 34 of file TLine3D.cpp.

References TLine3D().

◆ generate2DObject()

void TLine3D::generate2DObject ( TLine2D l) const

Project into 2D space, discarding the Z coordinate.

Exceptions
std::logic_errorif the line's director vector is orthogonal to the XY plane.

Definition at line 23 of file TLine3D.cpp.

Referenced by intersect().

◆ getDirectorVector() [1/2]

const TVector3D& mrpt::math::TLine3D::getDirectorVector ( ) const
inline

Get director vector (may be NOT unitary if not set so by the user)

See also
getUnitaryDirectorVector(), unitarize()

Definition at line 67 of file TLine3D.h.

References director.

Referenced by getUnitaryDirectorVector().

◆ getDirectorVector() [2/2]

void mrpt::math::TLine3D::getDirectorVector ( double(&)  vector[3]) const
inline

Get director vector.

Definition at line 61 of file TLine3D.h.

References director.

◆ getUnitaryDirectorVector()

void mrpt::math::TLine3D::getUnitaryDirectorVector ( double(&)  vector[3])
inline

Unitarize and then get director vector.

Definition at line 72 of file TLine3D.h.

References getDirectorVector(), and unitarize().

◆ unitarize()

void TLine3D::unitarize ( )

Member Data Documentation

◆ director

TVector3D mrpt::math::TLine3D::director {.0, .0, .0}

◆ pBase

TPoint3D mrpt::math::TLine3D::pBase



Page generated by Doxygen 1.8.18 for MRPT 2.0.4 at Thu Sep 24 07:14:18 UTC 2020