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 
23 namespace gazebo
24 {
25  namespace math
26  {
29 
32  class Box
33  {
35  public: Box();
36 
40  public: Box(const Vector3 &_min, const Vector3 &_max);
41 
44  public: Box(const Box &_b);
45 
47  public: virtual ~Box();
48 
51  public: double GetXLength() const;
52 
55  public: double GetYLength() const;
56 
59  public: double GetZLength() const;
60 
63  public: math::Vector3 GetSize() const;
64 
67  public: math::Vector3 GetCenter() const;
68 
71  public: void Merge(const Box &_box);
72 
76  public: Box &operator =(const Box &_b);
77 
81  public: Box operator+(const Box &_b) const;
82 
86  public: const Box &operator+=(const Box &_b);
87 
91  public: bool operator==(const Box &_b);
92 
96  public: Box operator-(const Vector3 &_v);
97 
102  public: friend std::ostream &operator<<(std::ostream &_out,
103  const gazebo::math::Box &_b)
104  {
105  _out << "Min[" << _b.min << "] Max[" << _b.max << "]";
106 
107  return _out;
108  }
109 
111  public: Vector3 min;
112 
114  public: Vector3 max;
115 
117  private: enum Extent {EXTENT_NULL, EXTENT_FINITE};
118 
121  private: Extent extent;
122  };
124  }
125 }
126 
127 #endif
128 
129 
130