Struct TPlane

Struct Documentation

struct TPlane

3D Plane, represented by its equation \(Ax+By+Cz+D=0\)

Public Functions

TPlane() = default

Fast default constructor (uninitialized coefficients).

inline constexpr TPlane(double A, double B, double C, double D)

Constructor from plane coefficients

inline TPlane(const double (&vec)[4])

Constructor from an array of coefficients (A,B,C,D).

TPlane(const TPoint3D &p1, const TPoint3D &p2, const TPoint3D &p3)

Defines a plane which contains these three points.

See also

mrpt::math::getRegressionPlane()

Throws:

std::logic_error – if the points are linearly dependants.

TPlane(const TPoint3D &p1, const TVector3D &normal)

Defines a plane given a point and a normal vector (must not be unit).

Throws:

std::logic_error – if the normal vector is null

TPlane(const TPoint3D &p1, const TLine3D &r2)

Defines a plane which contains this point and this line.

Throws:

std::logic_error – if the point is inside the line.

TPlane(const TLine3D &r1, const TLine3D &r2)

Defines a plane which contains the two lines.

Throws:

std::logic_error – if the lines do not cross.

double evaluatePoint(const TPoint3D &point) const

Evaluate a point in the plane’s equation

bool contains(const TPoint3D &point) const

Check whether a point is contained into the plane.

inline bool contains(const TSegment3D &segment) const

Check whether a segment is fully contained into the plane.

bool contains(const TLine3D &line) const

Check whether a line is fully contained into the plane.

double distance(const TPoint3D &point) const

Absolute distance to 3D point

double signedDistance(const TPoint3D &point) const

Signed distance (positive on the normal vector side) to 3D point.

Note

(New in MRPT 2.4.9)

double distance(const TLine3D &line) const

Distance to 3D line. Will be zero if the line is not parallel to the plane.

TVector3D getNormalVector() const

Get plane’s normal vector

void unitarize()

Unitarize normal vector.

void getAsPose3D(mrpt::math::TPose3D &outPose) const
void getAsPose3DForcingOrigin(const TPoint3D &center, TPose3D &pose) const
TPose3D getAsPose3DForcingOrigin(const TPoint3D &center) const
TVector3D getUnitaryNormalVector() const

Get normal vector

std::string asString() const

Returns “[A, B, C, D]”

Note

[New in MRPT 2.1.0]

Public Members

std::array<double, 4> coefs{{.0, .0, .0, .0}}

Plane coefficients, stored as an array: \(\left[A,B,C,D\right]\)

Public Static Functions

static inline TPlane From3Points(const TPoint3D &p1, const TPoint3D &p2, const TPoint3D &p3)

See also

mrpt::math::getRegressionPlane()

Note

[New in MRPT 2.1.0]

static inline TPlane FromPointAndNormal(const TPoint3D &p1, const TVector3D &normal)

Note

[New in MRPT 2.1.0]

static inline TPlane FromPointAndLine(const TPoint3D &p1, const TLine3D &r)

Defines a plane which contains this point and this line.

Note

[New in MRPT 2.1.0]

Throws:

std::logic_error – if the point is inside the line.

static inline TPlane FromTwoLines(const TLine3D &r1, const TLine3D &r2)

Defines a plane which contains the two lines.

Throws:

std::logic_error – if the lines do not cross.