Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Public Attributes | List of all members
om::math::Plane2D< T > Class Template Reference

A class that represents a plane in 2D space. More...

#include <omPlane2D.h>

Public Member Functions

 Plane2D ()
 Create a plane in 2D space with the normal pointing along the positive Y axis with offset = 0. More...
 
 Plane2D (const VectorND< T, 2 > &planeNormal, T planeOffset)
 Create a plane in 2D space with the specified normal and offset from the origin. More...
 
 Plane2D (const VectorND< T, 2 > &p1, const VectorND< T, 2 > &p2)
 Create a plane in 2D space from two points in that plane. More...
 
getDistanceTo (const VectorND< T, 2 > &point) const
 Get the perpendicular distance from the specified point to the plane. More...
 
getSignedDistanceTo (const VectorND< T, 2 > &point) const
 Get the perpendicular distance from the specified point to the plane. More...
 
VectorND< T, 2 > getProjection (const VectorND< T, 2 > &point) const
 Return the projection of the given point onto the plane. More...
 
VectorND< T, 2 > getProjectionNormalized (const VectorND< T, 2 > &point) const
 Return the projection of the given point onto the plane. More...
 
VectorND< T, 2 > getReflection (const VectorND< T, 2 > &point) const
 Get the reflection of a point over the plane. More...
 
VectorND< T, 2 > getReflectionNormalized (const VectorND< T, 2 > &point) const
 Get the reflection of a point over the plane. More...
 
Plane2D normalize () const
 Normalize the plane's normal vector and correct the offset to match. More...
 
Plane2D operator- () const
 Return the plane with the opposite normal vector and offset. More...
 

Public Attributes

VectorND< T, 2 > normal
 A vector perpendicular to the plane. More...
 
offset
 The distance that the plane is offset from the origin. More...
 

Detailed Description

template<typename T>
class om::math::Plane2D< T >

A class that represents a plane in 2D space.

It uses the normal and offset plane representation as it is the most universally useful in computational mathematics, especially relating to graphics and geometry.

Constructor & Destructor Documentation

template<typename T >
om::math::Plane2D< T >::Plane2D ( )
inline

Create a plane in 2D space with the normal pointing along the positive Y axis with offset = 0.

template<typename T >
om::math::Plane2D< T >::Plane2D ( const VectorND< T, 2 > &  planeNormal,
planeOffset 
)
inline

Create a plane in 2D space with the specified normal and offset from the origin.

template<typename T >
om::math::Plane2D< T >::Plane2D ( const VectorND< T, 2 > &  p1,
const VectorND< T, 2 > &  p2 
)
inline

Create a plane in 2D space from two points in that plane.

Member Function Documentation

template<typename T >
T om::math::Plane2D< T >::getDistanceTo ( const VectorND< T, 2 > &  point) const
inline

Get the perpendicular distance from the specified point to the plane.

template<typename T >
T om::math::Plane2D< T >::getSignedDistanceTo ( const VectorND< T, 2 > &  point) const
inline

Get the perpendicular distance from the specified point to the plane.

template<typename T >
VectorND<T,2> om::math::Plane2D< T >::getProjection ( const VectorND< T, 2 > &  point) const
inline

Return the projection of the given point onto the plane.

template<typename T >
VectorND<T,2> om::math::Plane2D< T >::getProjectionNormalized ( const VectorND< T, 2 > &  point) const
inline

Return the projection of the given point onto the plane.

The plane is assumed to have a normal vector of unit length. This results in a significantly faster function, however the results are meaningless if the precondition is not met.

template<typename T >
VectorND<T,2> om::math::Plane2D< T >::getReflection ( const VectorND< T, 2 > &  point) const
inline

Get the reflection of a point over the plane.

template<typename T >
VectorND<T,2> om::math::Plane2D< T >::getReflectionNormalized ( const VectorND< T, 2 > &  point) const
inline

Get the reflection of a point over the plane.

template<typename T >
Plane2D om::math::Plane2D< T >::normalize ( ) const
inline

Normalize the plane's normal vector and correct the offset to match.

template<typename T >
Plane2D om::math::Plane2D< T >::operator- ( ) const
inline

Return the plane with the opposite normal vector and offset.

This plane is mathematically the same as the original plane.

Member Data Documentation

template<typename T >
VectorND<T,2> om::math::Plane2D< T >::normal

A vector perpendicular to the plane.

template<typename T >
T om::math::Plane2D< T >::offset

The distance that the plane is offset from the origin.


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