All Classes Namespaces Files Functions Variables Typedefs Friends Macros 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 _IGNITION_BOX_HH_
18 #define _IGNITION_BOX_HH_
19 
20 #include <iostream>
21 #include <ignition/math/Helpers.hh>
22 #include <ignition/math/Vector3.hh>
23 
24 namespace ignition
25 {
26  namespace math
27  {
31  {
33  public: Box();
34 
39  public: Box(const Vector3d &_vec1, const Vector3d &_vec2);
40 
49  public: Box(double _vec1X, double _vec1Y, double _vec1Z,
50  double _vec2X, double _vec2Y, double _vec2Z);
51 
54  public: Box(const Box &_b);
55 
57  public: virtual ~Box();
58 
61  public: double XLength() const;
62 
65  public: double YLength() const;
66 
69  public: double ZLength() const;
70 
73  public: math::Vector3d Size() const;
74 
77  public: math::Vector3d Center() const;
78 
81  public: void Merge(const Box &_box);
82 
86  public: Box &operator=(const Box &_b);
87 
91  public: Box operator+(const Box &_b) const;
92 
96  public: const Box &operator+=(const Box &_b);
97 
101  public: bool operator==(const Box &_b) const;
102 
106  public: bool operator!=(const Box &_b) const;
107 
111  public: Box operator-(const Vector3d &_v);
112 
117  public: friend std::ostream &operator<<(std::ostream &_out,
118  const ignition::math::Box &_b)
119  {
120  _out << "Min[" << _b.min << "] Max[" << _b.max << "]";
121 
122  return _out;
123  }
124 
127  public: const Vector3d &Min() const
128  {
129  return this->min;
130  }
131 
134  public: const Vector3d &Max() const
135  {
136  return this->max;
137  }
138 
141  public: Vector3d &Min()
142  {
143  return this->min;
144  }
145 
148  public: Vector3d &Max()
149  {
150  return this->max;
151  }
152 
158  public: bool Intersects(const Box &_box) const;
159 
161  private: Vector3d min;
162 
164  private: Vector3d max;
165 
167  private: enum Extent {EXTENT_NULL, EXTENT_FINITE};
168 
171  private: Extent extent;
172  };
173  }
174 }
175 #endif
const Vector3d & Max() const
Get the maximum corner.
Definition: Box.hh:134
#define IGNITION_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:346
T max(const std::vector< T > &_values)
get the maximum value of vector of values
Definition: Helpers.hh:150
Vector3d & Min()
Get a mutable version of the minimum corner.
Definition: Box.hh:141
Mathematical representation of a box and related functions.
Definition: Box.hh:30
friend std::ostream & operator<<(std::ostream &_out, const ignition::math::Box &_b)
Output operator.
Definition: Box.hh:117
const Vector3d & Min() const
Get the minimum corner.
Definition: Box.hh:127
Vector3d & Max()
Get a mutable version of the maximum corner.
Definition: Box.hh:148
T min(const std::vector< T > &_values)
get the minimum value of vector of values
Definition: Helpers.hh:163