Easy3D 2.5.3
GenericPlane< FT > Class Template Reference

A 3D Plane of equation a*x + b*y + c*z + d = 0. More...

#include <easy3d/core/plane.h>

Public Types

typedef Vec< 2, FT > Point2
 
typedef Vec< 3, FT > Point3
 
typedef Vec< 3, FT > Vector3
 
typedef GenericLine< 3, FT > Line3
 
typedef GenericPlane< FT > thisclass
 

Public Member Functions

 GenericPlane (const Point3 &p1, const Point3 &p2, const Point3 &p3)
 Constructs a plane from three points p1, p2, and p3.
 
 GenericPlane (const Point3 &p, const Vector3 &n)
 Constructs a plane from a point p and the plane normal n.
 
 GenericPlane (FT a, FT b, FT c, FT d)
 Constructs a plane from its equation parameters a, b, c, and d.
 
FT a () const
 Returns plane equation parameter a.
 
FT b () const
 Returns plane equation parameter b.
 
FT c () const
 Returns plane equation parameter c.
 
FT d () const
 Returns plane equation parameter d.
 
FT & operator[] (size_t idx)
 Returns the idx_th parameter of the plane equation.
 
const FT & operator[] (size_t idx) const
 Returns the idx_th const parameter of the plane equation.
 
Vector3 normal () const
 Returns the normal of the plane.
 
Point3 point () const
 Returns a point lying on this plane. More...
 
Vector3 base1 () const
 Returns the first ortho-base defined on this plane.
 
Vector3 base2 () const
 Returns the second ortho-base defined on this plane.
 
Point2 to_2d (const Point3 &p) const
 Converts a 3D point into a 2D point relative to the local coordinate system defined by the three orthogonal vectors base1(), base2(), and normal(). More...
 
Point3 to_3d (const Point2 &p) const
 Converts a 2D point in the local coordinate system defined by the three orthogonal vectors base1(), base2(), and normal() into the 3D space. More...
 
Point3 projection (const Point3 &p) const
 The projection of a point p on this plane.
 
FT value (const Point3 &p) const
 Evaluates the plane (i.e., computes the value of a * x + b * y + c * z + d) for the given point p.
 
FT squared_distance (const Point3 &p) const
 Computes the squared distance of a point p to this plane.
 
bool intersect (const Line3 &line, Point3 &p) const
 Tests if a line intersects with this plane. Returns true if they do intersect. In this case, p stores the intersecting point. Otherwise, it returns false (i.e., they don't intersect, meaning the line is parallel to this plane). More...
 
bool intersect (const Line3 &line) const
 Tests if a line intersects with this plane. Returns true if they do intersect. Otherwise, it returns false (i.e., they don't intersect, meaning the line is parallel to this plane). More...
 
bool intersect (const Point3 &s, const Point3 &t, Point3 &p) const
 Tests if a line segment (given by its two end points s and t) intersects with this plane. Returns true if they do intersect. In this case, p stores the intersecting point. Otherwise, it returns false (i.e., they don't intersect, meaning the two end points of the line segment lie on the same side of the the plane).
 
bool intersect (const Point3 &s, const Point3 &t) const
 Tests if a line segment (given by its two end points s and t) intersects with this plane. Returns true if they do intersect. Otherwise, it returns false (i.e., they don't intersect, meaning the two end points of the line segment lie on the same side of the the plane).
 
bool intersect (const thisclass &another, Line3 &line) const
 Tests if this plane intersects with another plane. Returns true if they do intersect. In this case, line stores the intersecting line. Otherwise, it returns false (i.e., they don't intersect, meaning the two planes are parallel).
 
bool intersect (const thisclass &another) const
 Tests if this plane intersects with another plane. Returns true if they do intersect and false if they don't intersect (i.e.,the two planes are parallel).
 
int orient (const Point3 &p) const
 Determines the relative orientation of a point with respect to this plane. The return value is one of the following: More...
 
const FT * data () const
 Returns the constant memory address of the coefficients.
 
FT * data ()
 Returns the memory address of the coefficients.
 
 operator const FT * () const
 Conversion operator returning the constant memory address of the coefficients. This is very convenient to pass a plane as a parameter to functions.
 
 operator FT * ()
 Conversion operator returning the memory address of the coefficients. This is very convenient to pass a plane as a parameter to functions.
 

Detailed Description

template<typename FT>
class easy3d::GenericPlane< FT >

A 3D Plane of equation a*x + b*y + c*z + d = 0.

Member Function Documentation

◆ intersect() [1/2]

bool intersect ( const Line3 line) const
inline

Tests if a line intersects with this plane. Returns true if they do intersect. Otherwise, it returns false (i.e., they don't intersect, meaning the line is parallel to this plane).

Note
Both line and the plane are unlimited.

◆ intersect() [2/2]

bool intersect ( const Line3 line,
Point3 p 
) const
inline

Tests if a line intersects with this plane. Returns true if they do intersect. In this case, p stores the intersecting point. Otherwise, it returns false (i.e., they don't intersect, meaning the line is parallel to this plane).

Note
Both line and the plane are unlimited.

◆ orient()

int orient ( const Point3 p) const
inline

Determines the relative orientation of a point with respect to this plane. The return value is one of the following:

  • 1: p is on the positive side
  • 0: p is belonging to the plane
  • -1: p is on the negative side

◆ point()

GenericPlane< FT >::Point3 point
inline

Returns a point lying on this plane.

Note
It is a fixed point (anytime you can this function it returns the same point).

◆ to_2d()

GenericPlane< FT >::Point2 to_2d ( const Point3 p) const
inline

Converts a 3D point into a 2D point relative to the local coordinate system defined by the three orthogonal vectors base1(), base2(), and normal().

Note
After 3D->2D and then 2D->3D conversion, the resulted 3D point remains unchanged ONLY IF the input point lies on the plane. In case the original 3D point does not lie on the plane, the resulted 3D point will have coordinates equal to the projection of the input point onto the plane.

◆ to_3d()

GenericPlane< FT >::Point3 to_3d ( const Point2 p) const
inline

Converts a 2D point in the local coordinate system defined by the three orthogonal vectors base1(), base2(), and normal() into the 3D space.

Note
After 3D->2D and then 2D->3D conversion, the resulted 3D point remains unchanged ONLY IF the input point lies on the plane. In case the original 3D point does not lie on the plane, the resulted 3D point will have coordinates equal to the projection of the input point onto the plane.

The documentation for this class was generated from the following file: