|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Static Public Attributes
gameplay::Plane Class Reference

`#include <Plane.h>`

List of all members.

## Public Member Functions

| Plane ()
| Plane (const Vector3 &normal, float distance)
| Plane (float normalX, float normalY, float normalZ, float distance)
| Plane (const Plane &copy)
| ~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

## Detailed Description

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).

## Constructor & Destructor Documentation

gameplay::Plane::Plane | ( |  | ) |

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.

Parameters:

  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.

Parameters:

  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.

Parameters:

  copy | The plane to copy.

gameplay::Plane::~Plane | ( |  | ) |

Destructor.

## Member Function Documentation

float gameplay::Plane::distance | ( | const Vector3 & | point | ) | const

Calculates the distance from this plane to the specified point.

Parameters:

  point | The point to calculate distance to.

float gameplay::Plane::getDistance | ( |  | ) | const

Gets the plane's distance to the origin along its normal.

Returns:
  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.

Returns:
  normal The plane's normal.

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.

Parameters:

  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.

Parameters:

  sphere | The bounding sphere to test intersection with.

Returns:
  Plane::INTERSECTS_BACK if the specified bounding object is in the negative half-space of this plane, Plane::INTERSECTS_FRONT if it is in the positive half-space of this plane, and Plane::INTERSECTS_INTERSECTING if it intersects this plane.

float gameplay::Plane::intersects | ( | const BoundingBox & | box | ) | const

Tests whether this plane intersects the specified bounding box.

Parameters:

  box | The bounding box to test intersection with.

Returns:
  Plane::INTERSECTS_BACK if the specified bounding object is in the negative half-space of this plane, Plane::INTERSECTS_FRONT if it is in the positive half-space of this plane, and Plane::INTERSECTS_INTERSECTING if it intersects this plane.

float gameplay::Plane::intersects | ( | const Frustum & | frustum | ) | const

Tests whether this plane intersects the specified frustum.

Parameters:

  frustum | The frustum to test intersection with.

Returns:
  Plane::INTERSECTS_BACK if the specified frustum is in the negative half-space of this plane, Plane::INTERSECTS_FRONT if it is in the positive half-space of this plane, and Plane::INTERSECTS_INTERSECTING if it intersects this plane.

float gameplay::Plane::intersects | ( | const Plane & | plane | ) | const

Tests whether this plane intersects the specified plane.

Parameters:

  plane | The plane to test intersection with.

Returns:
  Plane::INTERSECTS_BACK if the specified plane is in the negative half-space of this plane, Plane::INTERSECTS_FRONT if it is in the positive half-space of this plane, and Plane::INTERSECTS_INTERSECTING if it intersects this plane.

float gameplay::Plane::intersects | ( | const Ray & | ray | ) | const

Tests whether this plane intersects the specified ray.

Parameters:

  ray | The ray to test intersection with.

Returns:
  Plane::INTERSECTS_BACK if the specified ray is in the negative half-space of this plane, Plane::INTERSECTS_FRONT if it is in the positive half-space of this plane, and Plane::INTERSECTS_INTERSECTING if it intersects this plane.

bool gameplay::Plane::isParallel | ( | const Plane & | plane | ) | const

Determines whether the given plane is parallel to this plane.

Parameters:

  plane | The plane to test.

Returns:
  true if the given plane is parallel to this plane; false otherwise.

Plane& gameplay::Plane::operator*= | ( | const Matrix & | matrix | ) | `[inline]`

Transforms this plane by the given matrix.

Parameters:

  matrix | The matrix to transform by.

Returns:
  This plane, after the transformation occurs.

void gameplay::Plane::set | ( | const Vector3 & | normal,
|  | float | distance
| ) |  |

Sets this plane to the specified values.

Parameters:

  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.

Parameters:

  plane | The plane to copy.

void gameplay::Plane::setDistance | ( | float | distance | ) |

Sets the plane's distance to the origin along its normal.

Parameters:

  distance | The new distance.

void gameplay::Plane::setNormal | ( | const Vector3 & | normal | ) |

Sets the plane's normal to the given vector.

Parameters:

  normal | The new normal vector.

void gameplay::Plane::setNormal | ( | float | x,
|  | float | y,
|  | float | z
| ) |  |

Sets the plane's normal.

Parameters:

  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.

Parameters:

  matrix | The transformation matrix to transform by.

## Member Data Documentation

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.

All Classes Functions Variables Typedefs Enumerations Enumerator