Gazebo Math

API Reference

8.0.0~pre1
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::math
31{
32 // Inline bracket to help doxygen filtering.
33 inline namespace GZ_MATH_VERSION_NAMESPACE {
38 {
45 public: AxisAlignedBox();
46
51 public: AxisAlignedBox(const Vector3d &_vec1, const Vector3d &_vec2);
52
61 public: AxisAlignedBox(double _vec1X, double _vec1Y, double _vec1Z,
62 double _vec2X, double _vec2Y, double _vec2Z);
63
66 public: double XLength() const;
67
70 public: double YLength() const;
71
74 public: double ZLength() const;
75
78 public: math::Vector3d Size() const;
79
82 public: math::Vector3d Center() const;
83
86 public: void Merge(const AxisAlignedBox &_box);
87
92
97
101 public: bool operator==(const AxisAlignedBox &_b) const;
102
106 public: bool operator!=(const AxisAlignedBox &_b) const;
107
112
117
121 public: AxisAlignedBox operator-(const Vector3d &_v) const;
122
126 public: AxisAlignedBox operator+(const Vector3d &_v) const;
127
134 {
135 _out << "Min[" << _b.Min() << "] Max[" << _b.Max() << "]";
136 return _out;
137 }
138
141 public: const Vector3d &Min() const;
142
145 public: const Vector3d &Max() const;
146
149 public: Vector3d &Min();
150
153 public: Vector3d &Max();
154
161 public: bool Intersects(const AxisAlignedBox &_box) const;
162
166 public: bool Contains(const Vector3d &_p) const;
167
174 public: bool IntersectCheck(const Vector3d &_origin, const Vector3d &_dir,
175 const double _min, const double _max) const;
176
193 const Vector3d &_origin, const Vector3d &_dir,
194 const double _min, const double _max) const;
195
214 const Vector3d &_origin, const Vector3d &_dir,
215 const double _min, const double _max) const;
216
226 const Line3d &_line) const;
227
230 public: double Volume() const;
231
238 private: bool ClipLine(const int _d, const Line3d &_line,
239 double &_low, double &_high) const;
240
242 GZ_UTILS_IMPL_PTR(dataPtr)
243 };
244 } // namespace GZ_MATH_VERSION_NAMESPACE
245} // namespace gz::math
246#endif // GZ_MATH_AXISALIGNEDBOX_HH_