Ignition Math

API Reference

4.0.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/Plane.hh>
21 #include <ignition/math/Angle.hh>
22 #include <ignition/math/Pose3.hh>
23 #include <ignition/math/config.hh>
24 
25 namespace ignition
26 {
27  namespace math
28  {
29  // Inline bracket to help doxygen filtering.
30  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
31  //
32  // Forward declaration of private data
33  class FrustumPrivate;
34 
37  class IGNITION_MATH_VISIBLE Frustum
38  {
40  public: enum FrustumPlane
41  {
43  FRUSTUM_PLANE_NEAR = 0,
44 
46  FRUSTUM_PLANE_FAR = 1,
47 
49  FRUSTUM_PLANE_LEFT = 2,
50 
52  FRUSTUM_PLANE_RIGHT = 3,
53 
55  FRUSTUM_PLANE_TOP = 4,
56 
58  FRUSTUM_PLANE_BOTTOM = 5
59  };
60 
68  public: Frustum();
69 
82  public: Frustum(const double _near,
83  const double _far,
84  const math::Angle &_fov,
85  const double _aspectRatio,
86  const math::Pose3d &_pose = math::Pose3d::Zero);
87 
90  public: Frustum(const Frustum &_p);
91 
93  public: virtual ~Frustum();
94 
99  public: double Near() const;
100 
105  public: void SetNear(const double _near);
106 
111  public: double Far() const;
112 
117  public: void SetFar(const double _far);
118 
124  public: math::Angle FOV() const;
125 
131  public: void SetFOV(const math::Angle &_fov);
132 
137  public: double AspectRatio() const;
138 
143  public: void SetAspectRatio(const double _aspectRatio);
144 
148  public: Planed Plane(const FrustumPlane _plane) const;
149 
153  public: bool Contains(const Box &_b) const;
154 
158  public: bool Contains(const Vector3d &_p) const;
159 
163  public: Pose3d Pose() const;
164 
168  public: void SetPose(const Pose3d &_pose);
169 
173  public: Frustum &operator=(const Frustum &_f);
174 
177  private: void ComputePlanes();
178 
181  private: FrustumPrivate *dataPtr;
182  };
183  }
184  }
185 }
186 #endif
An angle and related functions.
Definition: Angle.hh:48
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 box and related functions.
Definition: Box.hh:39
Mathematical representation of a frustum and related functions. This is also known as a view frustum...
Definition: Frustum.hh:37
FrustumPlane
Planes that define the boundaries of the frustum.
Definition: Frustum.hh:40
The Vector3 class represents the generic vector containing 3 elements. Since it&#39;s commonly used to ke...
Definition: Vector3.hh:40
Definition: Angle.hh:39