molecular
Public Types | Public Member Functions | List of all members
molecular::util::Plane Class Reference

Plane in Hesse normal form. More...

#include <Plane.h>

Public Types

enum  IntersectStatus { kOutside, kInside, kIntersect }
 Return type of Check() More...
 

Public Member Functions

 Plane ()
 Default plane. Spans XY plane, points towards +Z. More...
 
 Plane (const Vector3 &normal, float distance)
 Construct from normal and distance, normal as Vector3. More...
 
 Plane (float n0, float n1, float n2, float d)
 Construct from normal and distance, normal as individual components. More...
 
 Plane (const Vector3 &p0, const Vector3 &p1, const Vector3 &p2)
 Construct plane passing through three points. More...
 
float GetDistance (const Vector3 &point) const
 Get distance of point to plane. More...
 
IntersectStatus Check (const Vector3 &point) const
 Check point. More...
 
IntersectStatus Check (const Vector3 &center, float radius) const
 Check sphere. More...
 
IntersectStatus Check (const AxisAlignedBox &box) const
 Check AABB. More...
 
void Normalize ()
 Scale normal and vector so that normal has unit length. More...
 
const Vector3GetNormal () const
 
float GetDistance () const
 
void SetDistance (float distance)
 
template<class InputIterator , class OutputIterator >
OutputIterator ClipPolygon (InputIterator inputBegin, InputIterator inputEnd, OutputIterator destBegin)
 Clip polygon by plane. More...
 
Vector3 IntersectionPoint (const Vector3 &p0, const Vector3 &p1)
 Get point where line intersects with plane. More...
 

Detailed Description

Plane in Hesse normal form.

Member Enumeration Documentation

Return type of Check()

Enumerator
kOutside 
kInside 
kIntersect 

Constructor & Destructor Documentation

molecular::util::Plane::Plane ( )
inline

Default plane. Spans XY plane, points towards +Z.

molecular::util::Plane::Plane ( const Vector3 normal,
float  distance 
)
inline

Construct from normal and distance, normal as Vector3.

molecular::util::Plane::Plane ( float  n0,
float  n1,
float  n2,
float  d 
)
inline

Construct from normal and distance, normal as individual components.

molecular::util::Plane::Plane ( const Vector3 p0,
const Vector3 p1,
const Vector3 p2 
)
inline

Construct plane passing through three points.

Normal is positive for the side on which the points are defined CCW.

Member Function Documentation

IntersectStatus molecular::util::Plane::Check ( const Vector3 point) const
inline

Check point.

Never returns kIntersect, obviously.

IntersectStatus molecular::util::Plane::Check ( const Vector3 center,
float  radius 
) const
inline

Check sphere.

IntersectStatus molecular::util::Plane::Check ( const AxisAlignedBox box) const
inline

Check AABB.

template<class InputIterator , class OutputIterator >
OutputIterator molecular::util::Plane::ClipPolygon ( InputIterator  inputBegin,
InputIterator  inputEnd,
OutputIterator  destBegin 
)

Clip polygon by plane.

Output range must have space for one more point than input range.

Returns
Iterator to end of new output range. Equal to destBegin if entire polygon lies on the negative side of the plane, e.g. no polygon remains after clipping.
float molecular::util::Plane::GetDistance ( const Vector3 point) const
inline

Get distance of point to plane.

float molecular::util::Plane::GetDistance ( ) const
inline
const Vector3& molecular::util::Plane::GetNormal ( ) const
inline
Vector3 molecular::util::Plane::IntersectionPoint ( const Vector3 p0,
const Vector3 p1 
)
inline

Get point where line intersects with plane.

Line is given by two endpoints.

Parameters
p0One endpoint of the line.
p1The other endpoint of the line.
void molecular::util::Plane::Normalize ( )
inline

Scale normal and vector so that normal has unit length.

Values describes the same plane before and after normalization.

void molecular::util::Plane::SetDistance ( float  distance)
inline

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