Gazebo Math

API Reference

8.3.0
Box.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 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_BOX_HH_
18#define GZ_MATH_BOX_HH_
19
20#include <optional>
21#include <gz/math/config.hh>
23#include <gz/math/Material.hh>
24#include <gz/math/Plane.hh>
25#include <gz/math/Vector3.hh>
26
27#include "gz/math/detail/WellOrderedVector.hh"
28
29#include <set>
30
31namespace gz::math
32{
33 // Inline bracket to help doxygen filtering.
34 inline namespace GZ_MATH_VERSION_NAMESPACE {
37 template<typename T>
39
55 template<typename Precision>
56 class Box
57 {
59 public: Box() = default;
60
65 public: Box(const Precision _length,
66 const Precision _width,
67 const Precision _height);
68
74 public: Box(const Precision _length, const Precision _width,
75 const Precision _height,
77
85 public: explicit Box(const Vector3<Precision> &_size);
86
98
102
111
116 public: void SetSize(const Precision _length,
117 const Precision _width,
118 const Precision _height);
119
123 public: bool operator==(const Box<Precision> &_b) const;
124
128 public: bool operator!=(const Box<Precision> &_b) const;
129
132 public: const gz::math::Material &Material() const;
133
136 public: void SetMaterial(const gz::math::Material &_mat);
137
140 public: Precision Volume() const;
141
147
153 public: std::optional<Vector3<Precision>>
155
163
169
179
192 public: bool SetDensityFromMass(const Precision _mass);
193
202
209 public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
210
217 const Plane<Precision> &_plane) const;
218
221
223 private: gz::math::Material material;
224 };
225
228 typedef Box<int> Boxi;
229
233
237 } // namespace GZ_MATH_VERSION_NAMESPACE
238} // namespace gz::math
239#include "gz/math/detail/Box.hh"
240#endif // GZ_MATH_BOX_HH_