Box.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 GAZEBO_MATH_BOX_HH_
18 #define GAZEBO_MATH_BOX_HH_
19 
20 #include <iostream>
21 #include <ignition/math/Box.hh>
22 
23 #include "gazebo/math/Vector3.hh"
24 #include "gazebo/util/system.hh"
25 
26 #ifndef _WIN32
27  #pragma GCC diagnostic push
28  #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
29 #endif
30 
31 namespace gazebo
32 {
33  namespace math
34  {
37 
40  // cppcheck-suppress noConstructor
41  class GZ_MATH_VISIBLE Box
42  {
44  public: Box() GAZEBO_DEPRECATED(8.0);
45 
50  public: Box(const Vector3 &_vec1, const Vector3 &_vec2)
51  GAZEBO_DEPRECATED(8.0);
52 
55  public: Box(const ignition::math::Box &_box) GAZEBO_DEPRECATED(8.0);
56 
59  public: Box(const Box &_b) GAZEBO_DEPRECATED(8.0);
60 
62  public: virtual ~Box();
63 
66  public: double GetXLength() const;
67 
70  public: double GetYLength() const;
71 
74  public: double GetZLength() const;
75 
78  public: math::Vector3 GetSize() const;
79 
82  public: math::Vector3 GetCenter() const;
83 
86  public: void Merge(const Box &_box);
87 
90  public: ignition::math::Box Ign() const;
91 
95  public: Box &operator=(const ignition::math::Box &_b);
96 
100  public: Box &operator =(const Box &_b);
101 
105  public: Box operator+(const Box &_b) const;
106 
110  public: const Box &operator+=(const Box &_b);
111 
115  public: bool operator==(const Box &_b) const;
116 
120  public: Box operator-(const Vector3 &_v);
121 
125  public: bool Contains(const math::Vector3 &_p) const;
126 
131  public: friend std::ostream &operator<<(std::ostream &_out,
132  const gazebo::math::Box &_b)
133  {
134  _out << "Min[" << _b.min << "] Max[" << _b.max << "]";
135 
136  return _out;
137  }
138 
140  public: Vector3 min;
141 
143  public: Vector3 max;
144 
146  private: enum Extent {EXTENT_NULL, EXTENT_FINITE};
147 
150  private: Extent extent;
151  };
153  }
154 }
155 
156 #ifndef _WIN32
157  #pragma GCC diagnostic pop
158 #endif
159 #endif
160 
161 
162 
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
Mathematical representation of a box and related functions.
Definition: Box.hh:41
static const double GAZEBO_DEPRECATED(8.0) MAX_D
Double maximum value. This value will be similar to 1.79769e+308.
Definition: Helpers.hh:140
friend std::ostream & operator<<(std::ostream &_out, const gazebo::math::Box &_b)
Output operator.
Definition: Box.hh:131
Vector3 min
Minimum corner of the box.
Definition: Box.hh:140
Vector3 max
Maximum corner of the box.
Definition: Box.hh:143
bool const T & _b
Definition: Helpers.hh:258