Ignition Math

API Reference

6.8.0
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 IGNITION_MATH_FRUSTUM_HH_
18 #define IGNITION_MATH_FRUSTUM_HH_
19 
20 #include <ignition/math/Angle.hh>
22 #include <ignition/math/Plane.hh>
23 #include <ignition/math/Pose3.hh>
24 #include <ignition/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
The Angle class is used to simplify and clarify the use of radians and degrees measurements. A default constructed Angle instance has a value of zero radians/degrees.
Definition: Angle.hh:61
Encapsulates a position and rotation in three space.
Definition: Pose3.hh:34
A plane and related functions.
Definition: Plane.hh:35
static const Pose3< T > Zero
math::Pose3<T>(0, 0, 0, 0, 0, 0)
Definition: Pose3.hh:37
Mathematical representation of a frustum and related functions. This is also known as a view frustum...
Definition: Frustum.hh:38
FrustumPlane
Planes that define the boundaries of the frustum.
Definition: Frustum.hh:41
The Vector3 class represents the generic vector containing 3 elements. Since it&#39;s commonly used to ke...
Definition: Vector3.hh:41
Definition: Angle.hh:42
Mathematical representation of a box that is aligned along an X,Y,Z axis.
Definition: AxisAlignedBox.hh:42