Struct TLine2D
Defined in File TLine2D.h
Struct Documentation
-
struct TLine2D
2D line without bounds, represented by its equation \(Ax+By+C=0\).
See also
Public Functions
-
TLine2D(const TPoint2D &p1, const TPoint2D &p2)
Constructor from two points, through which the line will pass.
See also
mrpt::math::getRegressionLine()
- Throws:
logic_error – if both points are the same
-
explicit TLine2D(const TSegment2D &s)
Constructor from a segment
-
TLine2D() = default
Fast default constructor. Initializes to undefined values.
-
inline constexpr TLine2D(double A, double B, double C)
Constructor from line’s coefficients
-
explicit TLine2D(const TLine3D &l)
Construction from 3D object, discarding the Z.
- Throws:
std::logic_error – if the line is normal to the XY plane.
-
double signedDistance(const TPoint2D &point) const
Distance with sign from a given point (sign indicates side).
-
void getNormalVector(double (&vector)[2]) const
Get line’s normal vector.
-
void unitarize()
Unitarize line’s normal vector.
-
inline void getUnitaryNormalVector(double (&vector)[2])
Get line’s normal vector after unitarizing line.
-
void getDirectorVector(double (&vector)[2]) const
Get line’s director vector.
-
inline void getUnitaryDirectorVector(double (&vector)[2])
Unitarize line and then get director vector.
-
std::string asString() const
Returns “[A, B, C]”
Note
[New in MRPT 2.1.0]
Note
Do not inherit from mrpt::Stringifyable to avoid virtual class table and keeping the class trivially-copiable.
Public Members
-
std::array<double, 3> coefs{{0, 0, 0}}
Line coefficients, stored as an array: \(\left[A,B,C\right]\)
-
TLine2D(const TPoint2D &p1, const TPoint2D &p2)