MRPT
2.0.4
|
3D line, represented by a base point and a director vector.
#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 TVector3D & | getDirectorVector () 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... | |
|
default |
Fast default constructor.
Initializes to all zeros.
Referenced by FromTwoPoints().
Constructor from two points, through which the line will pass.
std::logic_error | if 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.
|
explicit |
Constructor from 3D segment.
Definition at line 85 of file TLine3D.cpp.
References director, pBase, mrpt::math::TSegment3D::point1, mrpt::math::TSegment3D::point2, mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
|
explicit |
Constructor from 2D object.
Zeroes the z.
Definition at line 92 of file TLine3D.cpp.
References mrpt::math::TLine2D::coefs, director, mrpt::math::getEpsilon(), pBase, mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
bool TLine3D::contains | ( | const TPoint3D & | point | ) | const |
Check whether a point is inside the line.
Definition at line 39 of file TLine3D.cpp.
References director, mrpt::math::getEpsilon(), pBase, mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
Referenced by mrpt::math::intersect(), and mrpt::math::TPlane::TPlane().
double TLine3D::distance | ( | const TPoint3D & | point | ) | const |
Distance between the line and a point.
Definition at line 54 of file TLine3D.cpp.
References director, pBase, mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.
Referenced by mrpt::math::TSegment3D::distance(), and mrpt::math::distance().
|
static |
Static constructor from a point and a director vector.
Definition at line 25 of file TLine3D.cpp.
Static constructor from two points.
Definition at line 34 of file TLine3D.cpp.
References TLine3D().
void TLine3D::generate2DObject | ( | TLine2D & | l | ) | const |
Project into 2D space, discarding the Z coordinate.
std::logic_error | if the line's director vector is orthogonal to the XY plane. |
Definition at line 23 of file TLine3D.cpp.
Referenced by intersect().
|
inline |
|
inline |
Get director vector (may be NOT unitary if not set so by the user)
Definition at line 67 of file TLine3D.h.
References director.
Referenced by getUnitaryDirectorVector().
|
inline |
Unitarize and then get director vector.
Definition at line 72 of file TLine3D.h.
References getDirectorVector(), and unitarize().
void TLine3D::unitarize | ( | ) |
Unitarize director vector.
Definition at line 70 of file TLine3D.cpp.
References ASSERT_, director, mrpt::math::norm(), and mrpt::math::TPoint3D_< T >::norm().
Referenced by getUnitaryDirectorVector(), mrpt::math::intersect(), mrpt::math::project3D(), mrpt::opengl::CCylinder::traceRay(), mrpt::opengl::CEllipsoid3D::traceRay(), mrpt::opengl::CEllipsoid2D::traceRay(), and mrpt::math::traceRay().
TVector3D mrpt::math::TLine3D::director {.0, .0, .0} |
Director vector.
Definition at line 49 of file TLine3D.h.
Referenced by contains(), createFromPoseAndAxis(), mrpt::math::createFromPoseAndVector(), distance(), mrpt::math::distance(), FromPointAndDirector(), mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord(), mrpt::math::getAngle(), getDirectorVector(), mrpt::math::getRegressionLine(), mrpt::math::intersect(), intersect(), intersectInCommonLine(), mrpt::math::operator<<(), mrpt::math::operator>>(), mrpt::math::project3D(), mrpt::math::TLine2D::TLine2D(), TLine3D(), mrpt::math::TPlane::TPlane(), mrpt::opengl::CCylinder::traceRay(), mrpt::opengl::CEllipsoid3D::traceRay(), mrpt::opengl::CEllipsoid2D::traceRay(), and unitarize().
TPoint3D mrpt::math::TLine3D::pBase |
Base point.
Definition at line 47 of file TLine3D.h.
Referenced by mrpt::math::TPlane::contains(), contains(), createFromPoseAndAxis(), mrpt::math::createFromPoseAndVector(), mrpt::math::TPlane::distance(), distance(), mrpt::math::distance(), FromPointAndDirector(), mrpt::opengl::COpenGLViewport::get3DRayForPixelCoord(), mrpt::math::getRegressionLine(), mrpt::math::intersect(), intersect(), mrpt::math::operator<<(), mrpt::math::operator>>(), mrpt::math::project3D(), mrpt::math::TLine2D::TLine2D(), TLine3D(), mrpt::math::TPlane::TPlane(), mrpt::opengl::CCylinder::traceRay(), mrpt::opengl::CEllipsoid3D::traceRay(), and mrpt::opengl::CEllipsoid2D::traceRay().
Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |