#include <Plane.h>
Public Member Functions | |
Plane () | |
Plane (const Vector3 &normal, float distance) | |
Plane (float normalX, float normalY, float normalZ, float distance) | |
Plane (const Plane ©) | |
~Plane () | |
const Vector3 & | getNormal () const |
void | setNormal (const Vector3 &normal) |
void | setNormal (float x, float y, float z) |
float | getDistance () const |
void | setDistance (float distance) |
float | distance (const Vector3 &point) const |
float | intersects (const BoundingSphere &sphere) const |
float | intersects (const BoundingBox &box) const |
float | intersects (const Frustum &frustum) const |
float | intersects (const Plane &plane) const |
float | intersects (const Ray &ray) const |
bool | isParallel (const Plane &plane) const |
void | set (const Vector3 &normal, float distance) |
void | set (const Plane &plane) |
void | transform (const Matrix &matrix) |
Plane & | operator*= (const Matrix &matrix) |
Static Public Member Functions | |
static void | intersection (const Plane &p1, const Plane &p2, const Plane &p3, Vector3 *point) |
Static Public Attributes | |
static const int | INTERSECTS_INTERSECTING = 0 |
static const int | INTERSECTS_FRONT = 1 |
static const int | INTERSECTS_BACK = -1 |
Defines a plane which is a flat surface with 2 sides.
The plane is represented as a plane using a 3D vector normal and a distance value (stored as a negative value).
Constructs a new plane with normal (0, 1, 0) and distance 0.
gameplay::Plane::Plane | ( | const Vector3 & | normal, |
float | distance | ||
) |
Constructs a new plane from the specified values.
normal | The normal vector of this plane. |
distance | The distance from this plane along its (unit) normal to the origin. |
gameplay::Plane::Plane | ( | float | normalX, |
float | normalY, | ||
float | normalZ, | ||
float | distance | ||
) |
Constructs a new plane from the specified values.
normalX | The x coordinate of the normal. |
normalY | The y coordinate of the normal. |
normalZ | The z coordinate of the normal. |
distance | The distance from this plane along its (unit) normal to the origin. |
gameplay::Plane::Plane | ( | const Plane & | copy | ) |
Constructs a new plane from the given plane.
copy | The plane to copy. |
Destructor.
float gameplay::Plane::distance | ( | const Vector3 & | point | ) | const |
Calculates the distance from this plane to the specified point.
point | The point to calculate distance to. |
float gameplay::Plane::getDistance | ( | ) | const |
Gets the plane's distance to the origin along its normal.
const Vector3& gameplay::Plane::getNormal | ( | ) | const |
Gets the plane's normal in the given vector.
static void gameplay::Plane::intersection | ( | const Plane & | p1, |
const Plane & | p2, | ||
const Plane & | p3, | ||
Vector3 * | point | ||
) | [static] |
Calculates the point of intersection of the given three planes and stores it in the given point.
p1 | The first plane. |
p2 | The second plane. |
p3 | The third plane. |
point | The point to store the point of intersection in (this is left unmodified if the planes do not all intersect or if they are all parallel along one vector and intersect along a line). |
float gameplay::Plane::intersects | ( | const BoundingSphere & | sphere | ) | const |
Tests whether this plane intersects the specified bounding sphere.
sphere | The bounding sphere to test intersection with. |
float gameplay::Plane::intersects | ( | const BoundingBox & | box | ) | const |
Tests whether this plane intersects the specified bounding box.
box | The bounding box to test intersection with. |
float gameplay::Plane::intersects | ( | const Frustum & | frustum | ) | const |
Tests whether this plane intersects the specified frustum.
frustum | The frustum to test intersection with. |
float gameplay::Plane::intersects | ( | const Plane & | plane | ) | const |
Tests whether this plane intersects the specified plane.
plane | The plane to test intersection with. |
float gameplay::Plane::intersects | ( | const Ray & | ray | ) | const |
Tests whether this plane intersects the specified ray.
ray | The ray to test intersection with. |
bool gameplay::Plane::isParallel | ( | const Plane & | plane | ) | const |
Determines whether the given plane is parallel to this plane.
plane | The plane to test. |
Transforms this plane by the given matrix.
matrix | The matrix to transform by. |
void gameplay::Plane::set | ( | const Vector3 & | normal, |
float | distance | ||
) |
Sets this plane to the specified values.
normal | The normal vector of this plane. |
distance | The distance to this plane along its normal to the origin. |
void gameplay::Plane::set | ( | const Plane & | plane | ) |
Sets this plane to the given plane.
plane | The plane to copy. |
void gameplay::Plane::setDistance | ( | float | distance | ) |
Sets the plane's distance to the origin along its normal.
distance | The new distance. |
void gameplay::Plane::setNormal | ( | const Vector3 & | normal | ) |
Sets the plane's normal to the given vector.
normal | The new normal vector. |
void gameplay::Plane::setNormal | ( | float | x, |
float | y, | ||
float | z | ||
) |
Sets the plane's normal.
x | The x coordinate of the normal. |
y | The y coordinate of the normal. |
z | The z coordinate of the normal. |
void gameplay::Plane::transform | ( | const Matrix & | matrix | ) |
Transforms this plane by the given transformation matrix.
matrix | The transformation matrix to transform by. |
const int gameplay::Plane::INTERSECTS_BACK = -1 [static] |
Represents when a 3D entity is behind (in the negative half-space of) a plane.
const int gameplay::Plane::INTERSECTS_FRONT = 1 [static] |
Represents when a 3D entity is in front of (in the positive half-space of) a plane.
const int gameplay::Plane::INTERSECTS_INTERSECTING = 0 [static] |
Represents when a 3D entity intersects a plane.