Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csPlane2 Class Reference

A plane in 2D space. More...

#include <plane2.h>

List of all members.

Public Methods

 csPlane2 ()
 Initialize to the xy plane.

 csPlane2 (const csVector2 &plane_norm, float c=0)
 Initialize the plane.

 csPlane2 (float a, float b, float c=0)
 Initialize the plane.

void Set (const csVector2 &v1, const csVector2 &v2)
 Initialize the plane given two vectors.

void Set (const csSegment2 &s)
 Initialize the plane given a segment.

 csPlane2 (const csVector2 &v1, const csVector2 &v2)
 Initialize the plane given two vectors.

 csPlane2 (const csSegment2 &s)
 Initialize the plane given a segment.

csVector2Normal ()
 Return the normal vector of this plane.

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

float A () const
 Return the A component of this plane.

float B () const
 Return the B component of this plane.

float C () const
 Return the C component of this plane.

float& A ()
 Return the A component of this plane.

float& B ()
 Return the B component of this plane.

float& C ()
 Return the C component of this plane.

void Set (float a, float b, float c)
 Set the value of the four plane components.

float Classify (const csVector2 &pt) const
 Classify the given vector with regards to this plane.

float Distance (const csVector2 &pt) const
 Compute the distance from the given vector to this plane. More...

float SquaredDistance (const csVector2 &pt) const
 Compute the squared distance between the given vector and this plane. More...

void Invert ()
 Reverses the direction of the plane while maintianing the plane itself.

void Normalize ()
 Normalizes the plane equation so that 'norm' is a unit vector.


Public Attributes

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

float CC
 The C component of the plane.


Static Public Methods

float Classify (float A, float B, float C, const csVector2 &pt)
 Classify a vector with regards to three plane components.


Detailed Description

A plane in 2D space.

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


Member Function Documentation

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

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.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000