Gazebo Math

API Reference

6.15.1
gz/math/Frustum.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GZ_MATH_FRUSTUM_HH_
18 #define GZ_MATH_FRUSTUM_HH_
19 
20 #include <gz/math/Angle.hh>
22 #include <gz/math/Plane.hh>
23 #include <gz/math/Pose3.hh>
24 #include <gz/math/config.hh>
25 
26 namespace ignition
27 {
28  namespace math
29  {
30  // Inline bracket to help doxygen filtering.
31  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
32  //
33  // Forward declaration of private data
34  class FrustumPrivate;
35 
38  class IGNITION_MATH_VISIBLE Frustum
39  {
41  public: enum FrustumPlane
42  {
44  FRUSTUM_PLANE_NEAR = 0,
45 
47  FRUSTUM_PLANE_FAR = 1,
48 
50  FRUSTUM_PLANE_LEFT = 2,
51 
53  FRUSTUM_PLANE_RIGHT = 3,
54 
56  FRUSTUM_PLANE_TOP = 4,
57 
59  FRUSTUM_PLANE_BOTTOM = 5
60  };
61 
69  public: Frustum();
70 
83  public: Frustum(const double _near,
84  const double _far,
85  const math::Angle &_fov,
86  const double _aspectRatio,
87  const math::Pose3d &_pose = math::Pose3d::Zero);
88 
91  public: Frustum(const Frustum &_p);
92 
94  public: virtual ~Frustum();
95 
100  public: double Near() const;
101 
106  public: void SetNear(const double _near);
107 
112  public: double Far() const;
113 
118  public: void SetFar(const double _far);
119 
125  public: math::Angle FOV() const;
126 
132  public: void SetFOV(const math::Angle &_fov);
133 
138  public: double AspectRatio() const;
139 
144  public: void SetAspectRatio(const double _aspectRatio);
145 
149  public: Planed Plane(const FrustumPlane _plane) const;
150 
154  public: bool Contains(const AxisAlignedBox &_b) const;
155 
159  public: bool Contains(const Vector3d &_p) const;
160 
164  public: Pose3d Pose() const;
165 
169  public: void SetPose(const Pose3d &_pose);
170 
174  public: Frustum &operator=(const Frustum &_f);
175 
178  private: void ComputePlanes();
179 
182  private: FrustumPrivate *dataPtr;
183  };
184  }
185  }
186 }
187 #endif
@ FRUSTUM_PLANE_FAR
Far plane.
Definition: gz/math/Frustum.hh:47
Encapsulates a position and rotation in three space.
Definition: gz/math/Pose3.hh:34
Definition: gz/math/AdditivelySeparableScalarField3.hh:27
double AspectRatio() const
Get the aspect ratio, which is the width divided by height of the near or far planes.
double Far() const
Get the far distance. This is the distance from the frustum's vertex to the farthest plane.
Frustum()
Default constructor. With the following default values:
bool Contains(const AxisAlignedBox &_b) const
Check if a box lies inside the pyramid frustum.
@ FRUSTUM_PLANE_LEFT
Left plane.
Definition: gz/math/Frustum.hh:50
void SetNear(const double _near)
Set the near distance. This is the distance from the frustum's vertex to the closest plane.
A plane and related functions.
Definition: gz/math/Plane.hh:38
Mathematical representation of a frustum and related functions. This is also known as a view frustum.
Definition: gz/math/Frustum.hh:38
void SetFar(const double _far)
Set the far distance. This is the distance from the frustum's vertex to the farthest plane.
virtual ~Frustum()
Destructor.
@ FRUSTUM_PLANE_RIGHT
Right plane.
Definition: gz/math/Frustum.hh:53
math::Angle FOV() const
Get the horizontal field of view. The field of view is the angle between the frustum's vertex and the...
The Vector3 class represents the generic vector containing 3 elements. Since it's commonly used to ke...
Definition: gz/math/Vector3.hh:41
Frustum & operator=(const Frustum &_f)
Assignment operator. Set this frustum to the parameter.
Pose3d Pose() const
Get the pose of the frustum.
void SetAspectRatio(const double _aspectRatio)
Set the aspect ratio, which is the width divided by height of the near or far planes.
The Angle class is used to simplify and clarify the use of radians and degrees measurements....
Definition: gz/math/Angle.hh:61
@ FRUSTUM_PLANE_TOP
Top plane.
Definition: gz/math/Frustum.hh:56
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...
FrustumPlane
Planes that define the boundaries of the frustum.
Definition: gz/math/Frustum.hh:41
Planed Plane(const FrustumPlane _plane) const
Get a plane of the frustum.
Mathematical representation of a box that is aligned along an X,Y,Z axis.
Definition: gz/math/AxisAlignedBox.hh:42
@ FRUSTUM_PLANE_BOTTOM
Bottom plane.
Definition: gz/math/Frustum.hh:59
void SetPose(const Pose3d &_pose)
Set the pose of the frustum.
static const Pose3< T > Zero
math::Pose3<T>(0, 0, 0, 0, 0, 0)
Definition: gz/math/Pose3.hh:37
@ FRUSTUM_PLANE_NEAR
Near plane.
Definition: gz/math/Frustum.hh:44
double Near() const
Get the near distance. This is the distance from the frustum's vertex to the closest plane.