Ignition Math

API Reference

6.8.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 IGNITION_MATH_BOX_HH_
18 #define IGNITION_MATH_BOX_HH_
19 
20 #include <ignition/math/config.hh>
23 #include <ignition/math/Vector3.hh>
24 
25 namespace ignition
26 {
27  namespace math
28  {
29  // Inline bracket to help doxygen filtering.
30  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
31  //
41  template<typename Precision>
42  class Box
43  {
45  public: Box() = default;
46 
51  public: Box(const Precision _length,
52  const Precision _width,
53  const Precision _height);
54 
60  public: Box(const Precision _length, const Precision _width,
61  const Precision _height,
62  const ignition::math::Material &_mat);
63 
71  public: explicit Box(const Vector3<Precision> &_size);
72 
82  public: Box(const Vector3<Precision> &_size,
83  const ignition::math::Material &_mat);
84 
86  public: virtual ~Box() = default;
87 
90  public: math::Vector3<Precision> Size() const;
91 
99  public: void SetSize(const math::Vector3<Precision> &_size);
100 
105  public: void SetSize(const Precision _length,
106  const Precision _width,
107  const Precision _height);
108 
112  public: bool operator==(const Box<Precision> &_b) const;
113 
117  public: bool operator!=(const Box<Precision> &_b) const;
118 
121  public: const ignition::math::Material &Material() const;
122 
125  public: void SetMaterial(const ignition::math::Material &_mat);
126 
129  public: Precision Volume() const;
130 
139  public: Precision DensityFromMass(const Precision _mass) const;
140 
153  public: bool SetDensityFromMass(const Precision _mass);
154 
162  public: bool MassMatrix(MassMatrix3<Precision> &_massMat) const;
163 
166 
168  private: ignition::math::Material material;
169  };
170 
173  typedef Box<int> Boxi;
174 
177  typedef Box<double> Boxd;
178 
181  typedef Box<float> Boxf;
182  }
183  }
184 }
185 #include "ignition/math/detail/Box.hh"
186 #endif
A class for inertial information about a rigid body consisting of the scalar mass and a 3x3 symmetric...
Definition: MassMatrix3.hh:45
Contains information about a single material.
Definition: Material.hh:65
Box< double > Boxd
Box with double precision.
Definition: Box.hh:177
Box< float > Boxf
Box with float precision.
Definition: Box.hh:181
A representation of a box. All units are in meters.
Definition: Box.hh:42
Box< int > Boxi
Box with integer precision.
Definition: Box.hh:173
Definition: Angle.hh:42