Gazebo Math

API Reference

7.4.0

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 (double _near, double _far, const math::Angle &_fov, double _aspectRatio, const math::Pose3d &_pose=math::Pose3d::Zero)
 Constructor. 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...
 
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 (double _aspectRatio)
 Set the aspect ratio, which is the width divided by height of the near or far planes. More...
 
void SetFar (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 (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.

Member Enumeration Documentation

◆ 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.

Constructor & Destructor Documentation

◆ Frustum() [1/2]

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/2]

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

Constructor.

Parameters
[in]_nearNear plane distance. This is the distance from the frustum's vertex to the closest plane
[in]_farFar plane distance. This is the distance from the frustum's vertex to the farthest plane.
[in]_fovField 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]_aspectRatioThe aspect ratio, which is the width divided by height of the near or far planes.
[in]_posePose of the frustum, which is the vertex (top of the pyramid).

Member Function Documentation

◆ 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.
See also
SetAspectRatio

◆ Contains() [1/2]

bool Contains ( const AxisAlignedBox _b) const

Check if a box lies inside the pyramid frustum.

Parameters
[in]_bBox 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]_pPoint 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.
See also
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.
See also
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.
See also
SetNear

◆ Plane()

Planed Plane ( const FrustumPlane  _plane) const

Get a plane of the frustum.

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

◆ Pose()

Pose3d Pose ( ) const

Get the pose of the frustum.

Returns
Pose of the frustum
See also
SetPose

◆ SetAspectRatio()

void SetAspectRatio ( double  _aspectRatio)

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

Parameters
[in]_aspectRatioThe frustum's aspect ratio.
See also
AspectRatio

◆ SetFar()

void SetFar ( double  _far)

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

Parameters
[in]_farFar distance.
See also
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]_fovThe field of view.
See also
FOV

◆ SetNear()

void SetNear ( double  _near)

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

Parameters
[in]_nearNear distance.
See also
Near

◆ SetPose()

void SetPose ( const Pose3d _pose)

Set the pose of the frustum.

Parameters
[in]_posePose of the frustum, top vertex.
See also
Pose

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