A 3D plane. More...
#include <sceneview/plane.hpp>
Public Member Functions | |
| Plane () | |
| Construct an invalid plane with zero coefficients. | |
| Plane (float a, float b, float c, float d) | |
| Construct a plane with the specified parameters. More... | |
| Plane (const QVector3D &normal, float d) | |
| Construct a plane with the specified parameters. More... | |
| float | SignedDistance (const QVector3D &point) const |
| Computes the signed distance of a point from the plane. More... | |
| const QVector3D & | Normal () const |
Returns the plane's normal vector . | |
| float | D () const |
| Returns the plane's d parameter. | |
Static Public Member Functions | |
| static Plane | FromThreePoints (const QVector3D &p1, const QVector3D &p2, const QVector3D &p3) |
| Create a plane from three points. More... | |
A 3D plane.
The plane is represented interally as the parameters
with the plane's normal vector given as
and
.
All points
on the plane satisfy:
| sv::Plane::Plane | ( | float | a, |
| float | b, | ||
| float | c, | ||
| float | d | ||
| ) |
Construct a plane with the specified parameters.
Interally, the parameters are scaled so that
| sv::Plane::Plane | ( | const QVector3D & | normal, |
| float | d | ||
| ) |
Construct a plane with the specified parameters.
Interally, the parameters are scaled so that
|
static |
Create a plane from three points.
The plane normal vector is taken as the cross product of (p2 - p1) with (p3 - p1):
The normal vector is then scaled to be unit length, and a suitable value for d is chosen automatically.
| float sv::Plane::SignedDistance | ( | const QVector3D & | point | ) | const |
Computes the signed distance of a point from the plane.
The point has a positive distance from the plane if the vector from the plane to the point has a positive dot product with the plane's normal vector.
Specifically, this method computes:
This method can be used as a half-plane test to determine which side of the plane the point lies on. This is particularly useful for view frustum culling.
1.8.6