The equation of a plane in 3D space is defined with a normal vector (perpendicular to that plane) and a known point on the plane. More...
#include <kanzi/core/math/plane.hpp>
Public Member Functions | |
| float | getA () const |
| Gets the a coefficient of a plane. | |
| float | getB () const |
| Get the b coefficient of a plane. | |
| float | getC () const |
| Get the c coefficient of a plane. | |
| float | getD () const |
| Get the d coefficient of a plane. | |
| float | getDistance () const |
| Gets the distance between a plane and an origin. | |
| float | getDistanceToPoint (const Vector3 point) const |
| Gets the distance from a given point to a plane. | |
| Vector3 | getNormal () const |
| Gets the normal component of a plane. | |
| Plane () | |
| Default constructor. | |
| Plane (const float x, const float y, const float z, const float distance) | |
| Constructor. | |
| Plane (const Vector3 normal, const float distance) | |
| Constructor. | |
| Vector3 | projectDirection (const Vector3 direction) const |
| Project a direction vector onto a plane. | |
| Vector3 | projectPosition (const Vector3 position) const |
| Project a position vector onto a plane. | |
Static Public Member Functions | |
| static Plane | createFromPointAndNormal (const Vector3 point, const Vector3 normal) |
| Creates a plane from a point and a normal. | |
The equation of a plane in 3D space is defined with a normal vector (perpendicular to that plane) and a known point on the plane.
If the normal vector is normalized (unit length), then the constant term of the plane equation becomes the distance from the origin. For a normal vector (a, b, c), the point P1 on the plane becomes (d*a, d*b, d*c), where d is the distance from the origin. The equation of the plane can be written with the unit vector and the point on the plane in order to show the distance d is the constant term of the equation. Mathematically, a plane is defined as: a*x + b*y + c*z + d = 0, where d is the distance from origin.
|
inlineexplicit |
Default constructor.
Initializes the plane components to identity: a=0, b=0, c=0, d=0.
Constructor.
Constructs a plane from a normal vector and a distance from an origin.
| normal | The normal component of a plane. |
| distance | The distance from the origin to a plane. |
|
inlineexplicit |
Constructor.
Constructs a plane from a normal (x,y,z) and a distance from an origin.
| x | The x coefficient of a normal of a plane. |
| y | The y coefficient of a normal of a plane. |
| z | The z coefficient of a normal of a plane. |
| distance | The distance from the origin to the plane. |
|
static |
Creates a plane from a point and a normal.
The normal must be of unit length.
| point | A point on the plane that you want to create. |
| normal | A normal vector to the plane that you want to create. |
|
inline |
Gets the normal component of a plane.
|
inline |
Gets the distance between a plane and an origin.
|
inline |
Gets the a coefficient of a plane.
|
inline |
Get the b coefficient of a plane.
|
inline |
Get the c coefficient of a plane.
|
inline |
Get the d coefficient of a plane.
Gets the distance from a given point to a plane.
| point | The point vector from which to calculate the distance to a plane. |
Project a direction vector onto a plane.
| direction | The direction vector that you want to project. |
Project a position vector onto a plane.
| position | The position vector that you want to project. |