Loading...
Searching...
No Matches
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
23#include <ignition/math/config.hh>
24
25namespace ignition
26{
27 namespace math
28 {
29 inline namespace IGNITION_MATH_VERSION_NAMESPACE
30 {
31 // Forward declaration of private data
32 class FrustumPrivate;
33
36 class IGNITION_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(const double _near,
82 const double _far,
83 const math::Angle &_fov,
84 const double _aspectRatio,
85 const math::Pose3d &_pose = math::Pose3d::Zero);
86
89 public: Frustum(const Frustum &_p);
90
92 public: virtual ~Frustum();
93
98 public: double Near() const;
99
104 public: void SetNear(const double _near);
105
110 public: double Far() const;
111
116 public: void SetFar(const double _far);
117
123 public: math::Angle FOV() const;
124
130 public: void SetFOV(const math::Angle &_fov);
131
136 public: double AspectRatio() const;
137
142 public: void SetAspectRatio(const double _aspectRatio);
143
147 public: Planed Plane(const FrustumPlane _plane) const;
148
152 public: bool Contains(const Box &_b) const;
153
157 public: bool Contains(const Vector3d &_p) const;
158
162 public: Pose3d Pose() const;
163
167 public: void SetPose(const Pose3d &_pose);
168
172 public: Frustum &operator=(const Frustum &_f);
173
176 private: void ComputePlanes();
177
180 private: FrustumPrivate *dataPtr;
181 };
182 }
183 }
184}
185#endif
An angle and related functions.
Definition Angle.hh:48
Mathematical representation of a box and related functions.
Definition Box.hh:39
Mathematical representation of a frustum and related functions.
Definition Frustum.hh:37
Planed Plane(const FrustumPlane _plane) const
Get a plane of the frustum.
void SetFOV(const math::Angle &_fov)
Set the horizontal field of view.
FrustumPlane
Planes that define the boundaries of the frustum.
Definition Frustum.hh:40
double AspectRatio() const
Get the aspect ratio, which is the width divided by height of the near or far planes.
void SetPose(const Pose3d &_pose)
Set the pose of the frustum.
void SetNear(const double _near)
Set the near distance.
Frustum(const double _near, const double _far, const math::Angle &_fov, const double _aspectRatio, const math::Pose3d &_pose=math::Pose3d::Zero)
Constructor.
void SetFar(const double _far)
Set the far distance.
Pose3d Pose() const
Get the pose of the frustum.
bool Contains(const Box &_b) const
Check if a box lies inside the pyramid frustum.
void SetAspectRatio(const double _aspectRatio)
Set the aspect ratio, which is the width divided by height of the near or far planes.
Frustum & operator=(const Frustum &_f)
Assignment operator.
math::Angle FOV() const
Get the horizontal field of view.
bool Contains(const Vector3d &_p) const
Check if a point lies inside the pyramid frustum.
A plane and related functions.
Definition Plane.hh:35
Encapsulates a position and rotation in three space.
Definition Pose3.hh:34
The Vector3 class represents the generic vector containing 3 elements.
Definition Vector3.hh:40
Definition Angle.hh:40