23 static_assert(std::is_trivially_copyable_v<TLine2D>);
51 for (
double& coef :
coefs) coef /= s;
55 vector[0] = -
coefs[1];
80 throw std::logic_error(
"Base point is not contained in the line");
87 if (p1 == p2)
throw std::logic_error(
"Both points are the same");
103 throw std::logic_error(
"Line is normal to projection plane");
void getDirectorVector(double(&vector)[2]) const
Get line's director vector.
TPoint3D pBase
Base point.
void unitarize()
Unitarize line's normal vector.
mrpt::serialization::CArchive & operator>>(mrpt::serialization::CArchive &in, CMatrixD::Ptr &pObj)
This base provides a set of functions for maths stuff.
2D segment, consisting of two points.
double evaluatePoint(const TPoint2D &point) const
Evaluate point in the line's equation.
std::array< double, 3 > director
Director vector.
void generate3DObject(TLine3D &l) const
Project into 3D space, setting the z to 0.
void getAsPose2D(TPose2D &outPose) const
double distance(const TPoint2D &point) const
Distance from a given point.
void getAsPose2DForcingOrigin(const TPoint2D &origin, TPose2D &outPose) const
TPoint2D point2
Destiny point.
TPoint2D point1
Origin point.
std::array< double, 3 > coefs
Line coefficients, stored as an array: .
Virtual base class for "archives": classes abstracting I/O streams.
double getEpsilon()
Gets the value of the geometric epsilon (default = 1e-5)
mrpt::vision::TStereoCalibResults out
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &s, const CVectorFloat &a)
bool contains(const TPoint2D &point) const
Check whether a point is inside the line.
TLine2D()=default
Fast default constructor.
double phi
Orientation (rads)
void getNormalVector(double(&vector)[2]) const
Get line's normal vector.
double signedDistance(const TPoint2D &point) const
Distance with sign from a given point (sign indicates side).
3D line, represented by a base point and a director vector.
2D line without bounds, represented by its equation .