All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
ignition::math::Plane< T > Class Template Reference

A plane and related functions. More...

#include <ignition/math/Plane.hh>

Public Types

enum  PlaneSide { NEGATIVE_SIDE = 0, POSITIVE_SIDE = 1, NO_SIDE = 2, BOTH_SIDE = 3 }
 Enum used to indicate a side of the plane, no side, or both sides for entities on the plane. More...
 

Public Member Functions

 Plane ()
 Constructor. More...
 
 Plane (const Vector3< T > &_normal, T _offset=0.0)
 Constructor from a normal and a distance. More...
 
 Plane (const Vector3< T > &_normal, const Vector2< T > &_size, T _offset)
 Constructor. More...
 
virtual ~Plane ()
 Destructor. More...
 
Distance (const Vector3< T > &_point) const
 The distance to the plane from the given point. More...
 
Distance (const Vector3< T > &_origin, const Vector3< T > &_dir) const
 Get distance to the plane give an origin and direction. More...
 
const Vector3< T > & Normal () const
 Get the plane offset. More...
 
Vector3< T > & Normal ()
 Get the plane offset. More...
 
Offset () const
 Get the plane offset. More...
 
Plane< T > & operator= (const Plane< T > &_p)
 Equal operator. More...
 
void Set (const Vector3< T > &_normal, T _offset)
 Set the plane. More...
 
void Set (const Vector3< T > &_normal, const Vector2< T > &_size, T _offset)
 Set the plane. More...
 
PlaneSide Side (const Vector3< T > &_point) const
 The side of the plane a point is on. More...
 
PlaneSide Side (const math::Box &_box) const
 The side of the plane a box is on. More...
 
const Vector2< T > & Size () const
 Get the plane size. More...
 
Vector2< T > & Size ()
 Get the plane size. More...
 

Detailed Description

template<typename T>
class ignition::math::Plane< T >

A plane and related functions.

Member Enumeration Documentation

template<typename T>
enum ignition::math::Plane::PlaneSide

Enum used to indicate a side of the plane, no side, or both sides for entities on the plane.

See Also
Side
Enumerator
NEGATIVE_SIDE 

Negative side of the plane.

This is the side that is opposite the normal.

POSITIVE_SIDE 

Positive side of the plane.

This is the side that has the normal vector.

NO_SIDE 

On the plane.

BOTH_SIDE 

On both sides of the plane.

Constructor & Destructor Documentation

template<typename T>
ignition::math::Plane< T >::Plane ( )
inline

Constructor.

template<typename T>
ignition::math::Plane< T >::Plane ( const Vector3< T > &  _normal,
_offset = 0.0 
)
inline

Constructor from a normal and a distance.

Parameters
[in]_normalThe plane normal
[in]_offsetOffset along the normal
template<typename T>
ignition::math::Plane< T >::Plane ( const Vector3< T > &  _normal,
const Vector2< T > &  _size,
_offset 
)
inline

Constructor.

Parameters
[in]_normalThe plane normal
[in]_sizeSize of the plane
[in]_offsetOffset along the normal

References ignition::math::Plane< T >::Set().

template<typename T>
virtual ignition::math::Plane< T >::~Plane ( )
inlinevirtual

Destructor.

Member Function Documentation

template<typename T>
T ignition::math::Plane< T >::Distance ( const Vector3< T > &  _point) const
inline

The distance to the plane from the given point.

The distance can be negative, which indicates the point is on the negative side of the plane.

Parameters
[in]_point3D point to calculate distance from.
Returns
Distance from the point to the plane.
See Also
Side

Referenced by ignition::math::Plane< T >::Side().

template<typename T>
T ignition::math::Plane< T >::Distance ( const Vector3< T > &  _origin,
const Vector3< T > &  _dir 
) const
inline

Get distance to the plane give an origin and direction.

Parameters
[in]_originthe origin
[in]_dira direction
Returns
the shortest distance

References ignition::math::Vector3< T >::Dot().

template<typename T>
const Vector3<T>& ignition::math::Plane< T >::Normal ( ) const
inline

Get the plane offset.

template<typename T>
Vector3<T>& ignition::math::Plane< T >::Normal ( )
inline

Get the plane offset.

template<typename T>
T ignition::math::Plane< T >::Offset ( ) const
inline

Get the plane offset.

template<typename T>
Plane<T>& ignition::math::Plane< T >::operator= ( const Plane< T > &  _p)
inline

Equal operator.

Parameters
_panother plane
Returns
itself
template<typename T>
void ignition::math::Plane< T >::Set ( const Vector3< T > &  _normal,
_offset 
)
inline

Set the plane.

Parameters
[in]_normalThe plane normal
[in]_offsetOffset along the normal

Referenced by ignition::math::Plane< T >::Plane().

template<typename T>
void ignition::math::Plane< T >::Set ( const Vector3< T > &  _normal,
const Vector2< T > &  _size,
_offset 
)
inline

Set the plane.

Parameters
[in]_normalThe plane normal
[in]_sizeSize of the plane
[in]_offsetOffset along the normal
template<typename T>
PlaneSide ignition::math::Plane< T >::Side ( const Vector3< T > &  _point) const
inline

The side of the plane a point is on.

Parameters
[in]_pointThe 3D point to check.
Returns
Plane::NEGATIVE_SIDE if the distance from the point to the plane is negative, Plane::POSITIVE_SIDE if the distance from the point to the plane is positive, or Plane::NO_SIDE if the point is on the plane.

References ignition::math::Plane< T >::Distance(), ignition::math::Plane< T >::NEGATIVE_SIDE, ignition::math::Plane< T >::NO_SIDE, and ignition::math::Plane< T >::POSITIVE_SIDE.

template<typename T>
PlaneSide ignition::math::Plane< T >::Side ( const math::Box _box) const
inline

The side of the plane a box is on.

Parameters
[in]_boxThe 3D box to check.
Returns
Plane::NEGATIVE_SIDE if the distance from the box to the plane is negative, Plane::POSITIVE_SIDE if the distance from the box to the plane is positive, or Plane::BOTH_SIDE if the box is on the plane.

References ignition::math::Plane< T >::BOTH_SIDE, ignition::math::Box::Center(), ignition::math::Plane< T >::Distance(), ignition::math::Plane< T >::NEGATIVE_SIDE, ignition::math::Plane< T >::POSITIVE_SIDE, and ignition::math::Box::Size().

template<typename T>
const Vector2<T>& ignition::math::Plane< T >::Size ( ) const
inline

Get the plane size.

template<typename T>
Vector2<T>& ignition::math::Plane< T >::Size ( )
inline

Get the plane size.


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