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. More... | |
float | getB () const |
Get the b coefficient of a plane. More... | |
float | getC () const |
Get the c coefficient of a plane. More... | |
float | getD () const |
Get the d coefficient of a plane. More... | |
float | getDistance () const |
Gets the distance between a plane and an origin. More... | |
float | getDistanceToPoint (const Vector3 point) const |
Gets the distance from a given point to a plane. More... | |
Vector3 | getNormal () const |
Gets the normal component of a plane. More... | |
Plane () | |
Default constructor. More... | |
Plane (const Vector3 normal, const float distance) | |
Constructor. More... | |
Plane (const float x, const float y, const float z, const float distance) | |
Constructor. More... | |
Vector3 | projectDirection (const Vector3 direction) const |
Project a direction vector onto a plane. More... | |
Vector3 | projectPosition (const Vector3 position) const |
Project a position vector onto a plane. More... | |
Static Public Member Functions | |
static Plane | createFromPointAndNormal (const Vector3 point, const Vector3 normal) |
Creates a plane from a point and a normal. More... | |
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.
|
inlineexplicit |
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.
float kanzi::Plane::getDistanceToPoint | ( | const Vector3 | point | ) | const |
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. |