23 static_assert(std::is_trivially_copyable_v<TLine2D>);
61 for (
double& coef :
coefs) coef /= s;
65 vector[0] = -
coefs[1];
90 throw std::logic_error(
"Base point is not contained in the line");
97 if (p1 == p2)
throw std::logic_error(
"Both points are the same");
113 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.
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.
TVector3D director
Director vector.
static TLine2D FromCoefficientsABC(double A, double B, double C)
Static constructor from Ax+By+C=0 coefficients.
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.
static TLine2D FromTwoPoints(const TPoint2D &p1, const TPoint2D &p2)
Static constructor from two points.
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 .