 # Ignition Math

## API Reference

6.9.3~pre2
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...

Plane (const Plane &_plane)
Copy constructor. More...

virtual ~Plane ()
Destructor. More...

Distance (const Vector3< T > &_point) const
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. More...

Distance (const Vector3< T > &_origin, const Vector3< T > &_dir) const
Get distance to the plane give an origin and direction. More...

std::optional< Vector3< T > > Intersection (const Vector3< T > &_point, const Vector3< T > &_gradient, const double &_tolerance=1e-6) const
Get the intersection of an infinite line with the plane, given the line's gradient and a point in parametrized space. 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::AxisAlignedBox &_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.

## ◆ PlaneSide

 enum PlaneSide

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

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.

## ◆ Plane() [1/4]

 Plane ( )
inline

Constructor.

## ◆ Plane() [2/4]

 Plane ( const Vector3< T > & _normal, T _offset = 0.0 )
inline

Constructor from a normal and a distance.

Parameters
 [in] _normal The plane normal [in] _offset Offset along the normal

## ◆ Plane() [3/4]

 Plane ( const Vector3< T > & _normal, const Vector2< T > & _size, T _offset )
inline

Constructor.

Parameters
 [in] _normal The plane normal [in] _size Size of the plane [in] _offset Offset along the normal

References Plane< T >::Set().

## ◆ Plane() [4/4]

 Plane ( const Plane< T > & _plane )
inline

Copy constructor.

Parameters
 [in] _plane Plane to copy

## ◆ ~Plane()

 virtual ~Plane ( )
inlinevirtual

Destructor.

## ◆ Distance() [1/2]

 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] _point 3D point to calculate distance from.
Returns
Distance from the point to the plane.
Side

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

## ◆ Distance() [2/2]

 T Distance ( const Vector3< T > & _origin, const Vector3< T > & _dir ) const
inline

Get distance to the plane give an origin and direction.

Parameters
 [in] _origin the origin [in] _dir a direction
Returns
the shortest distance

References Vector3< T >::Dot().

## ◆ Intersection()

 std::optional > Intersection ( const Vector3< T > & _point, const Vector3< T > & _gradient, const double & _tolerance = 1e-6 ) const
inline

Get the intersection of an infinite line with the plane, given the line's gradient and a point in parametrized space.

Parameters
 [in] _point A point that lies on the line. [in] _gradient The gradient of the line. [in] _tolerance The tolerance for determining a line is parallel to the plane. Optional, default=10^-16
Returns
The point of intersection. std::nullopt if the line is parallel to the plane (including lines on the plane).

## ◆ Normal() [1/2]

 const Vector3& Normal ( ) const
inline

Get the plane offset.

Referenced by Plane< T >::Intersection().

## ◆ Normal() [2/2]

 Vector3& Normal ( )
inline

Get the plane offset.

## ◆ Offset()

 T Offset ( ) const
inline

Get the plane offset.

Referenced by Plane< T >::Intersection().

## ◆ operator=()

 Plane& operator= ( const Plane< T > & _p )
inline

Equal operator.

Parameters
 _p another plane
Returns
itself

## ◆ Set() [1/2]

 void Set ( const Vector3< T > & _normal, T _offset )
inline

Set the plane.

Parameters
 [in] _normal The plane normal [in] _offset Offset along the normal

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

## ◆ Set() [2/2]

 void Set ( const Vector3< T > & _normal, const Vector2< T > & _size, T _offset )
inline

Set the plane.

Parameters
 [in] _normal The plane normal [in] _size Size of the plane [in] _offset Offset along the normal

## ◆ Side() [1/2]

 PlaneSide Side ( const Vector3< T > & _point ) const
inline

The side of the plane a point is on.

Parameters
 [in] _point The 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.

## ◆ Side() [2/2]

 PlaneSide Side ( const math::AxisAlignedBox & _box ) const
inline

The side of the plane a box is on.

Parameters
 [in] _box The 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.

## ◆ Size() [1/2]

 const Vector2& Size ( ) const
inline

Get the plane size.

Referenced by Plane< T >::Intersection().

## ◆ Size() [2/2]

 Vector2& Size ( )
inline

Get the plane size.

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