Box.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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_BOX_HH_
18 #define _GAZEBO_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 namespace gazebo
27 {
28  namespace math
29  {
32 
36  {
38  public: Box();
39 
40 
45  public: Box(const Vector3 &_vec1, const Vector3 &_vec2);
46 
49  public: Box(const ignition::math::Box &_box);
50 
53  public: Box(const Box &_b);
54 
56  public: virtual ~Box();
57 
60  public: double GetXLength() const;
61 
64  public: double GetYLength() const;
65 
68  public: double GetZLength() const;
69 
72  public: math::Vector3 GetSize() const;
73 
76  public: math::Vector3 GetCenter() const;
77 
80  public: void Merge(const Box &_box);
81 
84  public: ignition::math::Box Ign() const;
85 
89  public: Box &operator=(const ignition::math::Box &_b);
90 
94  public: Box &operator =(const Box &_b);
95 
99  public: Box operator+(const Box &_b) const;
100 
104  public: const Box &operator+=(const Box &_b);
105 
109  public: bool operator==(const Box &_b) const;
110 
114  public: Box operator-(const Vector3 &_v);
115 
119  public: bool Contains(const math::Vector3 &_p) const;
120 
125  public: friend std::ostream &operator<<(std::ostream &_out,
126  const gazebo::math::Box &_b)
127  {
128  _out << "Min[" << _b.min << "] Max[" << _b.max << "]";
129 
130  return _out;
131  }
132 
134  public: Vector3 min;
135 
137  public: Vector3 max;
138 
140  private: enum Extent {EXTENT_NULL, EXTENT_FINITE};
141 
144  private: Extent extent;
145  };
147  }
148 }
149 
150 #endif
151 
152 
153 
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Mathematical representation of a box and related functions.
Definition: Box.hh:35
Vector3 min
Minimum corner of the box.
Definition: Box.hh:134
friend std::ostream & operator<<(std::ostream &_out, const gazebo::math::Box &_b)
Output operator.
Definition: Box.hh:125
#define GZ_MATH_VISIBLE
Definition: system.hh:134
Vector3 max
Maximum corner of the box.
Definition: Box.hh:137