| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csPlane2 Class Reference
[Geometry utilities]

A plane in 2D space. More...

`#include <csgeom/plane2.h>`

List of all members.

## Public Member Functions
float & | A ()
| Return the A component of this plane.
float | A () const
| Return the A component of this plane.
float & | B ()
| Return the B component of this plane.
float | B () const
| Return the B component of this plane.
float & | C ()
| Return the C component of this plane.
float | C () const
| Return the C component of this plane.
float | Classify (const csVector2 &pt) const
| Classify the given vector with regards to this plane.
| csPlane2 (const csSegment2 &s)
| Initialize the plane given a segment.
| csPlane2 (const csVector2 &v1, const csVector2 &v2)
| Initialize the plane given two vectors.
| csPlane2 (float a, float b, float c=0)
| Initialize the plane.
| csPlane2 (const csVector2 &plane_norm, float c=0)
| Initialize the plane.
| csPlane2 ()
| Initialize to the xy plane.
float | Distance (const csVector2 &pt) const
| Compute the distance from the given vector to this plane.
csVector2 | GetNormal () const
| Return the normal vector of this plane (const version).
void | Invert ()
| Reverses the direction of the plane while maintianing the plane itself.
csVector2 & | Normal ()
| Return the normal vector of this plane.
void | Normalize ()
| Normalizes the plane equation so that 'norm' is a unit vector.
void | Set (float a, float b, float c)
| Set the value of the four plane components.
void | Set (const csSegment2 &s)
| Initialize the plane given a segment.
void | Set (const csVector2 &v1, const csVector2 &v2)
| Initialize the plane given two vectors.
float | SquaredDistance (const csVector2 &pt) const
| Compute the squared distance between the given vector and this plane.
## Static Public Member Functions
static float | Classify (float A, float B, float C, const csVector2 &pt)
| Classify a vector with regards to three plane components.
## Public Attributes
float | CC
| The C component of the plane.
csVector2 | norm
| The normal vector (or the (A,B) components).

## Detailed Description

A plane in 2D space.

The plane is given by the equation AAx + BBy + CC = 0, Where (AA,BB) is given by the vector 'norm'.

Definition at line 48 of file plane2.h.

## Constructor & Destructor Documentation

csPlane2::csPlane2 | ( |  | ) | `[inline]`

Initialize to the xy plane.

Definition at line 58 of file plane2.h.

csPlane2::csPlane2 | ( | const csVector2 & | plane_norm,
|  | float | c = `0` |
| ) |  |  | `[inline]`

Initialize the plane.

Definition at line 61 of file plane2.h.

csPlane2::csPlane2 | ( | float | a,
|  | float | b,
|  | float | c = `0` |
| ) |  |  | `[inline]`

Initialize the plane.

Definition at line 65 of file plane2.h.

csPlane2::csPlane2 | ( | const csVector2 & | v1,
|  | const csVector2 & | v2 |
| ) |  |  | `[inline]`

Initialize the plane given two vectors.

Definition at line 82 of file plane2.h.

References Set().

csPlane2::csPlane2 | ( | const csSegment2 & | s | ) | `[inline]`

Initialize the plane given a segment.

Definition at line 88 of file plane2.h.

References Set().

## Member Function Documentation

float& csPlane2::A | ( |  | ) | `[inline]`

Return the A component of this plane.

Definition at line 107 of file plane2.h.

References norm, and csVector2::x.

float csPlane2::A | ( |  | ) | const`[inline]`

Return the A component of this plane.

Definition at line 100 of file plane2.h.

References norm, and csVector2::x.

float& csPlane2::B | ( |  | ) | `[inline]`

Return the B component of this plane.

Definition at line 109 of file plane2.h.

References norm, and csVector2::y.

float csPlane2::B | ( |  | ) | const`[inline]`

Return the B component of this plane.

Definition at line 102 of file plane2.h.

References norm, and csVector2::y.

float& csPlane2::C | ( |  | ) | `[inline]`

Return the C component of this plane.

Definition at line 111 of file plane2.h.

References CC.

float csPlane2::C | ( |  | ) | const`[inline]`

Return the C component of this plane.

Definition at line 104 of file plane2.h.

References CC.

static float csPlane2::Classify | ( | float | A,
|  | float | B,
|  | float | C,
|  | const csVector2 & | pt |
| ) |  |  | `[inline, static]`

Classify a vector with regards to three plane components.

Definition at line 121 of file plane2.h.

References csVector2::x, and csVector2::y.

float csPlane2::Classify | ( | const csVector2 & | pt | ) | const`[inline]`

Classify the given vector with regards to this plane.

Definition at line 118 of file plane2.h.

References CC, and norm.

Referenced by Distance(), SquaredDistance(), and csMath2::Visible().

float csPlane2::Distance | ( | const csVector2 & | pt | ) | const`[inline]`

Compute the distance from the given vector to this plane.

This function assumes that 'norm' is a unit vector. If not, the function returns distance times the magnitude of 'norm'.

Definition at line 130 of file plane2.h.

References ABS, and Classify().

csVector2 csPlane2::GetNormal | ( |  | ) | const`[inline]`

Return the normal vector of this plane (const version).

Definition at line 97 of file plane2.h.

References norm.

void csPlane2::Invert | ( |  | ) | `[inline]`

Reverses the direction of the plane while maintianing the plane itself.

Definition at line 145 of file plane2.h.

References CC, and norm.

csVector2& csPlane2::Normal | ( |  | ) | `[inline]`

Return the normal vector of this plane.

Definition at line 94 of file plane2.h.

References norm.

void csPlane2::Normalize | ( |  | ) | `[inline]`

Normalizes the plane equation so that 'norm' is a unit vector.

Definition at line 148 of file plane2.h.

References CC, csVector2::Norm(), and norm.

void csPlane2::Set | ( | float | a,
|  | float | b,
|  | float | c |
| ) |  |  | `[inline]`

Set the value of the four plane components.

Definition at line 114 of file plane2.h.

References CC, norm, csVector2::x, and csVector2::y.

void csPlane2::Set | ( | const csSegment2 & | s | ) | `[inline]`

Initialize the plane given a segment.

Definition at line 76 of file plane2.h.

References csSegment2::End(), Set(), and csSegment2::Start().

void csPlane2::Set | ( | const csVector2 & | v1,
|  | const csVector2 & | v2 |
| ) |  |  | `[inline]`

Initialize the plane given two vectors.

Definition at line 68 of file plane2.h.

References CC, norm, csVector2::x, and csVector2::y.

Referenced by csPlane2(), and Set().

float csPlane2::SquaredDistance | ( | const csVector2 & | pt | ) | const`[inline]`

Compute the squared distance between the given vector and this plane.

This function works even if the plane is not normalized. Note that the returned distance will be negative if the point is left of the plane and positive otherwise.

Definition at line 139 of file plane2.h.

References Classify(), norm, and csVector2::SquaredNorm().

## Member Data Documentation

float csPlane2::CC

The C component of the plane.

Definition at line 55 of file plane2.h.

Referenced by C(), Classify(), Invert(), Normalize(), csMath2::PlanesEqual(), csIntersect2::SegmentPlaneNoTest(), and Set().

csVector2 csPlane2::norm

The normal vector (or the (A,B) components).

Definition at line 52 of file plane2.h.

Referenced by A(), B(), Classify(), GetNormal(), Invert(), Normal(), Normalize(), csMath2::PlanesEqual(), csIntersect2::SegmentPlaneNoTest(), Set(), and SquaredDistance().

The documentation for this class was generated from the following file:

- csgeom/plane2.h