Ocular Engine
|
#include <Plane.hpp>
Public Member Functions | |
Plane (Vector3f const &point, Vector3f const &normal) | |
Plane (Point3f const &a, Point3f const &b, Point3f const &c) | |
void | setPoint (Vector3f const &point) |
void | setNormal (Vector3f const &normal) |
Vector3f const & | getPoint () const |
Vector3f const & | getNormal () const |
float | getSignedDistance (Vector3f const &point) const |
Vector3f | getClosest (Vector3f const &point) const |
void | normalize () |
Plane | getNormalized () const |
bool | intersects (Ray const &ray) const |
bool | intersects (Ray const &ray, Vector3f &point, float &distance) const |
bool | intersects (BoundsSphere const &bounds, IntersectionType *result=nullptr) const |
bool | intersects (BoundsAABB const &bounds, IntersectionType *result=nullptr) const |
bool | intersects (BoundsOBB const &bounds, IntersectionType *result=nullptr) const |
Static Public Member Functions | |
static Vector3f | GetIntersectionPoint (Plane const &a, Plane const &b, Plane const &c) |
An infinite 3D plane represented in point-normal form.
Creates a new plane from the given point and normal.
[in] | point | A point on the plane to intersect with. |
[in] | normal | The direction of the plane. |
Creates a new plane from three points.
The given points must all lie on the plane and be given in a counter-clockwise order.
The point of the plane is set to 'b'.
The normal is set to (b - a) x (c - a) normalized.
[in] | a | The first point on the plane |
[in] | b | The second point on the plane |
[in] | c | The third point on the plane |
Calculates the point on the plane that is closest to the specified point.
[in] | point |
|
static |
Calculates and returns the point at which three planes intersect.
[in] | a | |
[in] | b | |
[in] | c |
Vector3f const & Ocular::Math::Plane::getNormal | ( | ) | const |
Vector3f const & Ocular::Math::Plane::getPoint | ( | ) | const |
float Ocular::Math::Plane::getSignedDistance | ( | Vector3f const & | point | ) | const |
Calculates the signed distance from the point to the plane.
The result is positive if the point is outside of the plane (in plane's positive half-space i.e. direction of normal).
The result is negative if the point is inside of the plane.
The result is 0 if the point is on the plane.
[in] | point |
bool Ocular::Math::Plane::intersects | ( | Ray const & | ray | ) | const |
Performs an intersection test on a ray and plane.
Note that this operation is actually a line-plane intersection. The line begins at ray origin and extends RAY_LINE_LENGTH.
[in] | ) |
Performs an intersection test on a ray and plane.
Note that this operation is actually a line-plane intersection. The line begins at ray origin and extends RAY_LINE_LENGTH.
[in] | ray | |
[out] | point | The point that the ray and AABB intersect, if they intersect. |
[out] | distance | The distance from the ray origin to the point of intersection |
bool Ocular::Math::Plane::intersects | ( | BoundsSphere const & | bounds, |
IntersectionType * | result = nullptr |
||
) | const |
Performs an intersection test on a plane and sphere.
If the result is Inside, then the sphere is located entirely within the plane's positive half space.
If the result is Outside, then the sphere is located entirely outside the plane's positive half space.
The positive half space of the plane is the direction that the plane is facing, as described by it's normal.
As an example, say we have the plane defined as:
Point: (0.0, 0.0, 0.0) Normal: (0.0, 1.0, 0.0)
The plane is 'facing up' along the world origin.
If the intersection test returns Outside, then the AABB is entirely in the +y world space.
If the intersection test returns Inside, then the AABB is entirely in the -y world space.
[in] | bounds | |
[out] | result | Detailed intersection result. |
bool Ocular::Math::Plane::intersects | ( | BoundsAABB const & | bounds, |
IntersectionType * | result = nullptr |
||
) | const |
Performs an intersection test on a plane and AABB.
If the result is Inside, then the AABB is located entirely within the plane's positive half space.
If the result is Outside, then the AABB is located entirely outside the plane's positive half space.
The positive half space of the plane is the direction that the plane is facing, as described by it's normal.
As an example, say we have the plane defined as:
Point: (0.0, 0.0, 0.0) Normal: (0.0, 1.0, 0.0)
The plane is 'facing up' along the world origin.
If the intersection test returns Outside, then the AABB is entirely in the +y world space.
If the intersection test returns Inside, then the AABB is entirely in the -y world space.
[in] | bounds | |
[out] | result | Detailed intersection result. |
bool Ocular::Math::Plane::intersects | ( | BoundsOBB const & | bounds, |
IntersectionType * | result = nullptr |
||
) | const |
Performs an intersection test on a plane and OBB.
If the result is Inside, then the OBB is located entirely within the plane's positive half space.
If the result is Outside, then the OBB is located entirely outside the plane's positive half space.
The positive half space of the plane is the direction that the plane is facing, as described by it's normal.
As an example, say we have the plane defined as:
Point: (0.0, 0.0, 0.0) Normal: (0.0, 1.0, 0.0)
The plane is 'facing up' along the world origin.
If the intersection test returns Outside, then the OBB is entirely in the +y world space.
If the intersection test returns Inside, then the OBB is entirely in the -y world space.
[in] | bounds | |
[in] | plane | |
[out] | result | Detailed intersection result. |
void Ocular::Math::Plane::setNormal | ( | Vector3f const & | normal | ) |
[in] | normal | The direction of the plane. |
void Ocular::Math::Plane::setPoint | ( | Vector3f const & | point | ) |
[in] | point | A point on the plane to intersect with. |