Gazebo Math

API Reference

7.4.0
gz/math/AxisAlignedBox.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 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_AXISALIGNEDBOX_HH_
18#define GZ_MATH_AXISALIGNEDBOX_HH_
19
20#include <ostream>
21#include <tuple>
22#include <gz/math/config.hh>
23#include <gz/math/Helpers.hh>
24#include <gz/math/Line3.hh>
26#include <gz/math/Material.hh>
27#include <gz/math/Vector3.hh>
28#include <gz/utils/ImplPtr.hh>
29
30namespace gz
31{
32 namespace math
33 {
34 // Inline bracket to help doxygen filtering.
35 inline namespace GZ_MATH_VERSION_NAMESPACE {
39 class GZ_MATH_VISIBLE AxisAlignedBox
40 {
47 public: AxisAlignedBox();
48
53 public: AxisAlignedBox(const Vector3d &_vec1, const Vector3d &_vec2);
54
63 public: AxisAlignedBox(double _vec1X, double _vec1Y, double _vec1Z,
64 double _vec2X, double _vec2Y, double _vec2Z);
65
68 public: double XLength() const;
69
72 public: double YLength() const;
73
76 public: double ZLength() const;
77
80 public: math::Vector3d Size() const;
81
84 public: math::Vector3d Center() const;
85
88 public: void Merge(const AxisAlignedBox &_box);
89
93 public: AxisAlignedBox operator+(const AxisAlignedBox &_b) const;
94
98 public: const AxisAlignedBox &operator+=(const AxisAlignedBox &_b);
99
103 public: bool operator==(const AxisAlignedBox &_b) const;
104
108 public: bool operator!=(const AxisAlignedBox &_b) const;
109
114
119
123 public: AxisAlignedBox operator-(const Vector3d &_v) const;
124
128 public: AxisAlignedBox operator+(const Vector3d &_v) const;
129
134 public: friend std::ostream &operator<<(std::ostream &_out,
135 const gz::math::AxisAlignedBox &_b)
136 {
137 _out << "Min[" << _b.Min() << "] Max[" << _b.Max() << "]";
138 return _out;
139 }
140
143 public: const Vector3d &Min() const;
144
147 public: const Vector3d &Max() const;
148
151 public: Vector3d &Min();
152
155 public: Vector3d &Max();
156
163 public: bool Intersects(const AxisAlignedBox &_box) const;
164
168 public: bool Contains(const Vector3d &_p) const;
169
176 public: bool IntersectCheck(const Vector3d &_origin, const Vector3d &_dir,
177 const double _min, const double _max) const;
178
195 const Vector3d &_origin, const Vector3d &_dir,
196 const double _min, const double _max) const;
197
216 const Vector3d &_origin, const Vector3d &_dir,
217 const double _min, const double _max) const;
218
228 const Line3d &_line) const;
229
232 public: double Volume() const;
233
240 private: bool ClipLine(const int _d, const Line3d &_line,
241 double &_low, double &_high) const;
242
244 GZ_UTILS_IMPL_PTR(dataPtr)
245 };
246 }
247 }
248}
249#endif