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 2011 Nate Koenig
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 "math/Vector3.hh"
22 
23 namespace gazebo
24 {
25  namespace math
26  {
29 
31  class Box
32  {
34  public: Box();
35 
39  public: Box(const Vector3 &_min, const Vector3 &_max);
40 
43  public: Box(const Box &_b);
44 
46  public: virtual ~Box();
47 
50  public: double GetXLength() const;
51 
54  public: double GetYLength() const;
55 
58  public: double GetZLength() const;
59 
62  public: math::Vector3 GetSize() const;
63 
66  public: math::Vector3 GetCenter() const;
67 
70  public: void Merge(const Box &_box);
71 
75  public: Box &operator =(const Box &_b);
76 
80  public: Box operator+(const Box &_b) const;
81 
85  public: const Box &operator+=(const Box &_b);
86 
90  public: bool operator==(const Box &_b);
91 
95  public: Box operator-(const Vector3 &_v);
96 
101  public: friend std::ostream &operator<<(std::ostream &_out,
102  const gazebo::math::Box &_b)
103  {
104  _out << "Min[" << _b.min << "] Max[" << _b.max << "]";
105 
106  return _out;
107  }
108 
110  public: Vector3 min;
111 
113  public: Vector3 max;
114 
116  private: enum Extent {EXTENT_NULL, EXTENT_FINITE};
117 
120  private: Extent extent;
121  };
123  }
124 }
125 
126 #endif
127 
128 
129