Struct TLine3D
Defined in File TLine3D.h
Struct Documentation
-
struct TLine3D
3D line, represented by a base point and a director vector.
See also
Public Functions
-
TLine3D() = default
Fast default constructor. Initializes to all zeros.
-
TLine3D(const TPoint3D &p1, const TPoint3D &p2)
Constructor from two points, through which the line will pass.
See also
mrpt::math::getRegressionLine()
- Throws:
std::logic_error – if both points are the same.
-
explicit TLine3D(const TSegment3D &s)
Constructor from 3D segment
-
TPoint3D closestPointTo(const TPoint3D &p) const
Closest point to
palong the line. It is computed as the intersection ofthiswith the plane perpendicular tothisthat passes throughpNote
[New in MRPT 2.3.1]
-
std::optional<double> distance(const TLine3D &point, const mrpt::optional_ref<mrpt::math::TPoint3D> &outMidPoint = std::nullopt) const
Minimum distance between this and another line. The return will be std::nullopt if lines are parallel, or zero if they intersect, a positive number otherwise.
Note
New in MRPT 2.3.0
-
void unitarize()
Unitarize director vector.
-
inline void getDirectorVector(double (&vector)[3]) const
Get director vector
-
inline const TVector3D &getDirectorVector() const
Get director vector (may be NOT unitary if not set so by the user)
See also
-
inline void getUnitaryDirectorVector(double (&vector)[3])
Unitarize and then get director vector.
-
void generate2DObject(TLine2D &l) const
Project into 2D space, discarding the Z coordinate.
- Throws:
std::logic_error – if the line’s director vector is orthogonal to the XY plane.
-
std::string asString() const
Returns “P=[x,y,z] u=[ux,uy,uz]”
Note
[New in MRPT 2.1.0]
-
TLine3D() = default