Gazebo Math

API Reference

7.4.0
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#include <gz/utils/ImplPtr.hh>
26
27namespace gz
28{
29 namespace math
30 {
31 // Inline bracket to help doxygen filtering.
32 inline namespace GZ_MATH_VERSION_NAMESPACE {
33
36 class GZ_MATH_VISIBLE Frustum
37 {
39 public: enum FrustumPlane
40 {
42 FRUSTUM_PLANE_NEAR = 0,
43
45 FRUSTUM_PLANE_FAR = 1,
46
48 FRUSTUM_PLANE_LEFT = 2,
49
51 FRUSTUM_PLANE_RIGHT = 3,
52
54 FRUSTUM_PLANE_TOP = 4,
55
57 FRUSTUM_PLANE_BOTTOM = 5
58 };
59
67 public: Frustum();
68
81 public: Frustum(double _near,
82 double _far,
83 const math::Angle &_fov,
84 double _aspectRatio,
85 const math::Pose3d &_pose = math::Pose3d::Zero);
86
91 public: double Near() const;
92
97 public: void SetNear(double _near);
98
103 public: double Far() const;
104
109 public: void SetFar(double _far);
110
116 public: math::Angle FOV() const;
117
123 public: void SetFOV(const math::Angle &_fov);
124
129 public: double AspectRatio() const;
130
135 public: void SetAspectRatio(double _aspectRatio);
136
140 public: Planed Plane(const FrustumPlane _plane) const;
141
145 public: bool Contains(const AxisAlignedBox &_b) const;
146
150 public: bool Contains(const Vector3d &_p) const;
151
155 public: Pose3d Pose() const;
156
160 public: void SetPose(const Pose3d &_pose);
161
164 private: void ComputePlanes();
165
167 GZ_UTILS_IMPL_PTR(dataPtr)
168 };
169 }
170 }
171}
172#endif