Mathematical representation of a frustum and related functions. 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. 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 Box &_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. More... | |
math::Angle | FOV () const |
Get the horizontal field of view. More... | |
double | Near () const |
Get the near distance. 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. More... | |
void | SetFOV (const math::Angle &_fov) |
Set the horizontal field of view. More... | |
void | SetNear (const double _near) |
Set the near distance. More... | |
void | SetPose (const Pose3d &_pose) |
Set the pose of the frustum. More... | |
Mathematical representation of a frustum and related functions.
This is also known as a view frustum.
ignition::math::Frustum::Frustum | ( | ) |
Default constructor.
With the following default values:
ignition::math::Frustum::Frustum | ( | const double | _near, |
const double | _far, | ||
const math::Angle & | _fov, | ||
const double | _aspectRatio, | ||
const math::Pose3d & | _pose = math::Pose3d::Zero |
||
) |
Constructor.
[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). |
ignition::math::Frustum::Frustum | ( | const Frustum & | _p | ) |
Copy Constructor.
[in] | _p | Frustum to copy. |
|
virtual |
Destructor.
double ignition::math::Frustum::AspectRatio | ( | ) | const |
Get the aspect ratio, which is the width divided by height of the near or far planes.
bool ignition::math::Frustum::Contains | ( | const Box & | _b | ) | const |
Check if a box lies inside the pyramid frustum.
[in] | _b | Box to check. |
bool ignition::math::Frustum::Contains | ( | const Vector3d & | _p | ) | const |
Check if a point lies inside the pyramid frustum.
[in] | _p | Point to check. |
double ignition::math::Frustum::Far | ( | ) | const |
Get the far distance.
This is the distance from the frustum's vertex to the farthest plane.
math::Angle ignition::math::Frustum::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.
double ignition::math::Frustum::Near | ( | ) | const |
Get the near distance.
This is the distance from the frustum's vertex to the closest plane.
Planed ignition::math::Frustum::Plane | ( | const FrustumPlane | _plane | ) | const |
Pose3d ignition::math::Frustum::Pose | ( | ) | const |
void ignition::math::Frustum::SetAspectRatio | ( | const double | _aspectRatio | ) |
Set the aspect ratio, which is the width divided by height of the near or far planes.
[in] | _aspectRatio | The frustum's aspect ratio. |
void ignition::math::Frustum::SetFar | ( | const double | _far | ) |
Set the far distance.
This is the distance from the frustum's vertex to the farthest plane.
[in] | _far | Far distance. |
void ignition::math::Frustum::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.
[in] | _fov | The field of view. |
void ignition::math::Frustum::SetNear | ( | const double | _near | ) |
Set the near distance.
This is the distance from the frustum's vertex to the closest plane.
[in] | _near | Near distance. |
void ignition::math::Frustum::SetPose | ( | const Pose3d & | _pose | ) |