All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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  {
28  // Forward declaration of private data
29  class BoxPrivate;
30 
34  {
36  public: Box();
37 
42  public: Box(const Vector3d &_vec1, const Vector3d &_vec2);
43 
52  public: Box(double _vec1X, double _vec1Y, double _vec1Z,
53  double _vec2X, double _vec2Y, double _vec2Z);
54 
57  public: Box(const Box &_b);
58 
60  public: virtual ~Box();
61 
64  public: double XLength() const;
65 
68  public: double YLength() const;
69 
72  public: double ZLength() const;
73 
76  public: math::Vector3d Size() const;
77 
80  public: math::Vector3d Center() const;
81 
84  public: void Merge(const Box &_box);
85 
89  public: Box &operator=(const Box &_b);
90 
94  public: Box operator+(const Box &_b) const;
95 
99  public: const Box &operator+=(const Box &_b);
100 
104  public: bool operator==(const Box &_b) const;
105 
109  public: bool operator!=(const Box &_b) const;
110 
114  public: Box operator-(const Vector3d &_v);
115 
120  public: friend std::ostream &operator<<(std::ostream &_out,
121  const ignition::math::Box &_b)
122  {
123  _out << "Min[" << _b.Min() << "] Max[" << _b.Max() << "]";
124  return _out;
125  }
126 
129  public: const Vector3d &Min() const;
130 
133  public: const Vector3d &Max() const;
134 
137  public: Vector3d &Min();
138 
141  public: Vector3d &Max();
142 
148  public: bool Intersects(const Box &_box) const;
149 
153  public: bool Contains(const Vector3d &_p) const;
154 
156  private: BoxPrivate *dataPtr;
157  };
158  }
159 }
160 #endif
const Vector3d & Max() const
Get the maximum corner.
#define IGNITION_VISIBLE
Use to represent &quot;symbol visible&quot; if supported.
Definition: Helpers.hh:408
Mathematical representation of a box and related functions.
Definition: Box.hh:33
friend std::ostream & operator<<(std::ostream &_out, const ignition::math::Box &_b)
Output operator.
Definition: Box.hh:120
const Vector3d & Min() const
Get the minimum corner.
Definition: BoxPrivate.hh:28