ImFusion SDK 4.3
Plane Class Reference

#include <ImFusion/Core/Geometry/Plane.h>

Class representing an oriented plane in 3D space defined by a base point and a normal direction. More...

Detailed Description

Class representing an oriented plane in 3D space defined by a base point and a normal direction.

Unless stated otherwise, all operations that involve comparisons use the same tolerance epsilon as vec3::isApprox (which is 1e-12).

See also
Intersections between geometry primitives can be computed using the sets of free functions Geometry::intersection() and Geometry::intersects().

Public Member Functions

 Plane (const vec3 &point, const vec3 &normal)
 Construct plane from point and normal, the latter will be normalized.
 
 Plane (const Rectangle &rect)
 Construct plane by extending a rectangle. User is responsible for the rectangle being valid.
 
vec4 hesseNormalForm () const
 Returns [normal, d] with d >= 0 such that for any point p its distance to the plane is given by abs(p.dot(normal) - d).
 
vec4 computerVisionNormalForm () const
 Returns cvnf = [normal, d] such that for any point p its distance to the plane is given by abs(p.dot(normal) + d), in terser notation: abs(p.homogeneous().dot(cvnf)).
 
const vec3 & point () const
 
const vec3 & normal () const
 
bool isApprox (const Plane &other)
 Comparison using the same epsilon as Eigen::isApprox.
 
bool isEquivalent (const Plane &other, bool considerOrientation=false)
 Returns if both Plane objects describe the same geometrical objects.
 
vec3 closestPoint (const vec3 &p) const
 Returns the point on the plane closest to p.
 
double distanceToPoint (const vec3 &p) const
 Returns the L2 distance between p and the closest point on the plane.
 
double signedDistanceToPoint (const vec3 &p) const
 Returns the dot product of the vector from the plane towards p and the plane normal.
 
bool includesPoint (const vec3 &p) const
 Returns if p sits on the plane.
 

Static Public Member Functions

static Plane fromComputerVisionNormalForm (const vec4 &cvnf)
 Construct plane from normal form, see computerVisionNormalForm() for details.
 
bool operator== (const Plane &) const
 Exact comparisons of Plane instances based on the point() and normal().
 
bool operator!= (const Plane &) const
 

Constructor & Destructor Documentation

◆ Plane()

Plane ( const vec3 & point,
const vec3 & normal )

Construct plane from point and normal, the latter will be normalized.

Passing something that cannot be normalized will invalidate the plane (does not intersect, distance to anything is NAN).

Member Function Documentation

◆ hesseNormalForm()

vec4 hesseNormalForm ( ) const

Returns [normal, d] with d >= 0 such that for any point p its distance to the plane is given by abs(p.dot(normal) - d).

Note
By definition the d component of the Hesse Normal Form is always positive. This means that the sign of the normal component may be flipped wrt. the plane's normal effectively flipping the orientation of the plane. Use computerVisionNormalForm() as alternative representation where the normal component always equals normal().

◆ computerVisionNormalForm()

vec4 computerVisionNormalForm ( ) const

Returns cvnf = [normal, d] such that for any point p its distance to the plane is given by abs(p.dot(normal) + d), in terser notation: abs(p.homogeneous().dot(cvnf)).

Note
This form differs from hesseNormalForm() in that the normal component always has the same sign as normal() and the d component may be negative. Therefore, this form maintains the orientation of the plane enabling you to easily determine if a point is on its front or back side. Also, please note the slight difference in the distance computation formula above: this form requires adding the d component while the hesseNormalForm() requires subtracting it.

◆ operator==()

bool operator== ( const Plane & ) const

Exact comparisons of Plane instances based on the point() and normal().

If you instead want to check if the represented geometric structures are the same, use isEquivalent().

◆ isEquivalent()

bool isEquivalent ( const Plane & other,
bool considerOrientation = false )

Returns if both Plane objects describe the same geometrical objects.

Note that unlike all other comparisons provided here this allows anti-parallel normals and using different points to define the same position.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close