All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Nimble::Plane Class Reference

Plane is represented by dot(N, X) = c, where N is a unit-length normal vector, c is the plane constant and X is any point on the plane. More...

#include <Nimble/Plane.hpp>

Public Member Functions

float distanceTo (const Nimble::Vector3f &point) const
 Compute the signed distance to the plane. More...
 
bool intersect (const Nimble::Vector3f &rayO, const Nimble::Vector3f &rayD, float &rayT) const
 Does a ray intersect the plane? More...
 
 Plane (const Nimble::Vector3f &normal, float constant)
 Constructs a new plance given the plane normal and the constant.
 
 Plane (const Nimble::Vector3f &normal, const Nimble::Vector3f &point)
 Constructs a new plance given the plane normal and a point on the plane.
 

Detailed Description

Plane is represented by dot(N, X) = c, where N is a unit-length normal vector, c is the plane constant and X is any point on the plane.

User must ensure the normal vector satisfied this condition.

Member Function Documentation

float Nimble::Plane::distanceTo ( const Nimble::Vector3f point) const

Compute the signed distance to the plane.

Distance is positive if the point is on the positive side of the plane negative if vice-versa.

Parameters
pointpoint to test
Returns
Signed distance to the plane
bool Nimble::Plane::intersect ( const Nimble::Vector3f rayO,
const Nimble::Vector3f rayD,
float &  rayT 
) const

Does a ray intersect the plane?

Parameters
rayOray origin
rayDunit-length ray direction vector
rayThow far the intersection is from the ray origin
Returns
true if the ray intersects the plane, false otherwise