Box.hh
00001 /*
00002  * Copyright 2011 Nate Koenig & Andrew Howard
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 #ifndef BOX_HH
00018 #define BOX_HH
00019 
00020 #include <iostream>
00021 #include "math/Vector3.hh"
00022 
00023 namespace gazebo
00024 {
00025   namespace math
00026   {
00029  
00031     class Box
00032     {
00034       public: Box();
00035 
00039       public: Box (const Vector3 &_min, const Vector3 &_max);
00040 
00043       public: Box( const Box &b );
00044 
00046       public: virtual ~Box();
00047 
00050       public: double GetXLength() const;
00051 
00054       public: double GetYLength() const;
00055 
00058       public: double GetZLength() const;
00059 
00062       public: math::Vector3 GetSize() const;
00063 
00066       public: math::Vector3 GetCenter() const;
00067 
00070       public: void Merge(const Box &_box);
00071 
00075       public: const Box &operator=( const Box &_b );
00076 
00080       public: Box operator+( const Box &_b ) const;
00081 
00085       public: const Box &operator+=( const Box &_b );
00086 
00091       public: friend std::ostream &operator<<( std::ostream &_out, 
00092                                                const gazebo::math::Box &_b )
00093       {
00094         _out << "Min[" << _b.min << "] Max[" << _b.max << "]";
00095 
00096         return _out;
00097       }
00098 
00100       public: Vector3 min;
00101 
00103       public: Vector3 max;
00104     };
00106   }
00107 }
00108 
00109 #endif