# Ignition Math

## API Reference

6.10.0
Frustum Class Reference

Mathematical representation of a frustum and related functions. This is also known as a view frustum. More...

#include <Frustum.hh>

## Public Types

enum  FrustumPlane {
FRUSTUM_PLANE_NEAR = 0, FRUSTUM_PLANE_FAR = 1, FRUSTUM_PLANE_LEFT = 2, FRUSTUM_PLANE_RIGHT = 3,
FRUSTUM_PLANE_TOP = 4, FRUSTUM_PLANE_BOTTOM = 5
}
Planes that define the boundaries of the frustum. More...

## Public Member Functions

Frustum ()
Default constructor. With the following default values: More...

Frustum (const double _near, const double _far, const math::Angle &_fov, const double _aspectRatio, const math::Pose3d &_pose=math::Pose3d::Zero)
Constructor. More...

Frustum (const Frustum &_p)
Copy Constructor. More...

virtual ~Frustum ()
Destructor. More...

double AspectRatio () const
Get the aspect ratio, which is the width divided by height of the near or far planes. More...

bool Contains (const AxisAlignedBox &_b) const
Check if a box lies inside the pyramid frustum. More...

bool Contains (const Vector3d &_p) const
Check if a point lies inside the pyramid frustum. More...

double Far () const
Get the far distance. This is the distance from the frustum's vertex to the farthest plane. More...

math::Angle FOV () const
Get the horizontal field of view. The field of view is the angle between the frustum's vertex and the edges of the near or far plane. This value represents the horizontal angle. More...

double Near () const
Get the near distance. This is the distance from the frustum's vertex to the closest plane. More...

Frustumoperator= (const Frustum &_f)
Assignment operator. Set this frustum to the parameter. More...

Planed Plane (const FrustumPlane _plane) const
Get a plane of the frustum. More...

Pose3d Pose () const
Get the pose of the frustum. More...

void SetAspectRatio (const double _aspectRatio)
Set the aspect ratio, which is the width divided by height of the near or far planes. More...

void SetFar (const double _far)
Set the far distance. This is the distance from the frustum's vertex to the farthest plane. More...

void SetFOV (const math::Angle &_fov)
Set the horizontal field of view. The field of view is the angle between the frustum's vertex and the edges of the near or far plane. This value represents the horizontal angle. More...

void SetNear (const double _near)
Set the near distance. This is the distance from the frustum's vertex to the closest plane. More...

void SetPose (const Pose3d &_pose)
Set the pose of the frustum. More...

## Detailed Description

Mathematical representation of a frustum and related functions. This is also known as a view frustum.

## ◆ FrustumPlane

 enum FrustumPlane

Planes that define the boundaries of the frustum.

Enumerator
FRUSTUM_PLANE_NEAR

Near plane.

FRUSTUM_PLANE_FAR

Far plane.

FRUSTUM_PLANE_LEFT

Left plane.

FRUSTUM_PLANE_RIGHT

Right plane.

FRUSTUM_PLANE_TOP

Top plane.

FRUSTUM_PLANE_BOTTOM

Bottom plane.

## ◆ Frustum() [1/3]

 Frustum ( )

Default constructor. With the following default values:

• near: 0.0
• far: 1.0
• fov: 0.78539 radians (45 degrees)
• aspect ratio: 1.0
• pose: Pose3d::Zero

## ◆ Frustum() [2/3]

 Frustum ( const double _near, const double _far, const math::Angle & _fov, const double _aspectRatio, const math::Pose3d & _pose = math::Pose3d::Zero )

Constructor.

Parameters
 [in] _near Near plane distance. This is the distance from the frustum's vertex to the closest plane [in] _far Far plane distance. This is the distance from the frustum's vertex to the farthest plane. [in] _fov Field of view. The field of view is the angle between the frustum's vertex and the edges of the near or far plane. This value represents the horizontal angle. [in] _aspectRatio The aspect ratio, which is the width divided by height of the near or far planes. [in] _pose Pose of the frustum, which is the vertex (top of the pyramid).

## ◆ Frustum() [3/3]

 Frustum ( const Frustum & _p )

Copy Constructor.

Parameters
 [in] _p Frustum to copy.

## ◆ ~Frustum()

 virtual ~Frustum ( )
virtual

Destructor.

## ◆ AspectRatio()

 double AspectRatio ( ) const

Get the aspect ratio, which is the width divided by height of the near or far planes.

Returns
The frustum's aspect ratio.
SetAspectRatio

## ◆ Contains() [1/2]

 bool Contains ( const AxisAlignedBox & _b ) const

Check if a box lies inside the pyramid frustum.

Parameters
 [in] _b Box to check.
Returns
True if the box is inside the pyramid frustum.

## ◆ Contains() [2/2]

 bool Contains ( const Vector3d & _p ) const

Check if a point lies inside the pyramid frustum.

Parameters
 [in] _p Point to check.
Returns
True if the point is inside the pyramid frustum.

## ◆ Far()

 double Far ( ) const

Get the far distance. This is the distance from the frustum's vertex to the farthest plane.

Returns
Far distance.
SetFar

## ◆ FOV()

 math::Angle FOV ( ) const

Get the horizontal field of view. The field of view is the angle between the frustum's vertex and the edges of the near or far plane. This value represents the horizontal angle.

Returns
The field of view.
SetFOV

## ◆ Near()

 double Near ( ) const

Get the near distance. This is the distance from the frustum's vertex to the closest plane.

Returns
Near distance.
SetNear

## ◆ operator=()

 Frustum& operator= ( const Frustum & _f )

Assignment operator. Set this frustum to the parameter.

Parameters
 [in] _f Frustum to copy
Returns
The new frustum.

## ◆ Plane()

 Planed Plane ( const FrustumPlane _plane ) const

Get a plane of the frustum.

Parameters
 [in] _plane The plane to return.
Returns
Plane of the frustum.

## ◆ Pose()

 Pose3d Pose ( ) const

Get the pose of the frustum.

Returns
Pose of the frustum
SetPose

## ◆ SetAspectRatio()

 void SetAspectRatio ( const double _aspectRatio )

Set the aspect ratio, which is the width divided by height of the near or far planes.

Parameters
 [in] _aspectRatio The frustum's aspect ratio.
AspectRatio

## ◆ SetFar()

 void SetFar ( const double _far )

Set the far distance. This is the distance from the frustum's vertex to the farthest plane.

Parameters
 [in] _far Far distance.
Far

## ◆ SetFOV()

 void SetFOV ( const math::Angle & _fov )

Set the horizontal field of view. The field of view is the angle between the frustum's vertex and the edges of the near or far plane. This value represents the horizontal angle.

Parameters
 [in] _fov The field of view.
FOV

## ◆ SetNear()

 void SetNear ( const double _near )

Set the near distance. This is the distance from the frustum's vertex to the closest plane.

Parameters
 [in] _near Near distance.
Near

## ◆ SetPose()

 void SetPose ( const Pose3d & _pose )

Set the pose of the frustum.

Parameters
 [in] _pose Pose of the frustum, top vertex.