All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Box.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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 
41  public: Box(const Vector3 &_min, const Vector3 &_max);
42 
45  public: Box(const Box &_b);
46 
48  public: virtual ~Box();
49 
52  public: double GetXLength() const;
53 
56  public: double GetYLength() const;
57 
60  public: double GetZLength() const;
61 
64  public: math::Vector3 GetSize() const;
65 
68  public: math::Vector3 GetCenter() const;
69 
72  public: void Merge(const Box &_box);
73 
77  public: Box &operator =(const Box &_b);
78 
82  public: Box operator+(const Box &_b) const;
83 
87  public: const Box &operator+=(const Box &_b);
88 
92  public: bool operator==(const Box &_b) const;
93 
97  public: Box operator-(const Vector3 &_v);
98 
103  public: friend std::ostream &operator<<(std::ostream &_out,
104  const gazebo::math::Box &_b)
105  {
106  _out << "Min[" << _b.min << "] Max[" << _b.max << "]";
107 
108  return _out;
109  }
110 
112  public: Vector3 min;
113 
115  public: Vector3 max;
116 
118  private: enum Extent {EXTENT_NULL, EXTENT_FINITE};
119 
122  private: Extent extent;
123  };
125  }
126 }
127 
128 #endif
129 
130 
131