Box.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 _BOX_HH_
18 #define _BOX_HH_
19 
20 #include <iostream>
21 #include "gazebo/math/Vector3.hh"
22 #include "gazebo/util/system.hh"
23 
24 namespace gazebo
25 {
26  namespace math
27  {
30 
34  {
36  public: Box();
37 
42  public: Box(const Vector3 &_vec1, const Vector3 &_vec2);
43 
46  public: Box(const Box &_b);
47 
49  public: virtual ~Box();
50 
53  public: double GetXLength() const;
54 
57  public: double GetYLength() const;
58 
61  public: double GetZLength() const;
62 
65  public: math::Vector3 GetSize() const;
66 
69  public: math::Vector3 GetCenter() const;
70 
73  public: void Merge(const Box &_box);
74 
78  public: Box &operator =(const Box &_b);
79 
83  public: Box operator+(const Box &_b) const;
84 
88  public: const Box &operator+=(const Box &_b);
89 
93  public: bool operator==(const Box &_b) const;
94 
98  public: Box operator-(const Vector3 &_v);
99 
104  public: friend std::ostream &operator<<(std::ostream &_out,
105  const gazebo::math::Box &_b)
106  {
107  _out << "Min[" << _b.min << "] Max[" << _b.max << "]";
108 
109  return _out;
110  }
111 
113  public: Vector3 min;
114 
116  public: Vector3 max;
117 
119  private: enum Extent {EXTENT_NULL, EXTENT_FINITE};
120 
123  private: Extent extent;
124  };
126  }
127 }
128 
129 #endif
130 
131 
132 
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
Mathematical representation of a box and related functions.
Definition: Box.hh:33
Vector3 min
Minimum corner of the box.
Definition: Box.hh:113
friend std::ostream & operator<<(std::ostream &_out, const gazebo::math::Box &_b)
Output operator.
Definition: Box.hh:104
Vector3 max
Maximum corner of the box.
Definition: Box.hh:116
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48