MIRA
Geometry.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef _MIRA_MODEL_GEOMETRY_H_
48 #define _MIRA_MODEL_GEOMETRY_H_
49 
50 #include <transform/Pose.h>
51 
52 #include <geometry/Rect.h>
53 #include <geometry/Polygon.h>
54 
56 
57 namespace mira { namespace model {
58 
60 
67 {
69 public:
70 
71  virtual ~Geometry() {}
72 
73 public:
74 
82  virtual Polygon2f getFootprint(const RigidTransform3f& origin) const = 0;
83 
90  virtual Box3f getBoundingBox(const RigidTransform3f& origin) const = 0;
91 
92 };
93 
95 typedef boost::shared_ptr<Geometry> GeometryPtr;
96 
98 
104 {
106 public:
107 
108  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
109 
110  template<typename Reflector>
111  void reflect(Reflector& r)
112  {
113  r.property("Size", size, "The size of the box");
114  }
115 
117  virtual Polygon2f getFootprint(const RigidTransform3f& origin) const;
119  virtual Box3f getBoundingBox(const RigidTransform3f& origin) const;
120 
122 };
123 
124 typedef boost::shared_ptr<Box> BoxPtr;
125 
127 
135 {
137 public:
138  template<typename Reflector>
139  void reflect(Reflector& r)
140  {
141  r.property("Radius", radius, "The radius of the cone");
142  r.property("Length", length, "The length of the cone");
143  }
144 
146  virtual Polygon2f getFootprint(const RigidTransform3f& origin) const;
148  virtual Box3f getBoundingBox(const RigidTransform3f& origin) const;
149 
150  float radius;
151  float length;
152 };
153 
154 typedef boost::shared_ptr<Cone> ConePtr;
155 
157 
164 {
166 public:
167  template<typename Reflector>
168  void reflect(Reflector& r)
169  {
170  r.property("Radius", radius, "The radius of the cylinder");
171  r.property("Length", length, "The length of the cylinder");
172  }
173 
175  virtual Polygon2f getFootprint(const RigidTransform3f& origin) const;
177  virtual Box3f getBoundingBox(const RigidTransform3f& origin) const;
178 
179  float radius;
180  float length;
181 };
182 
183 typedef boost::shared_ptr<Cylinder> CylinderPtr;
184 
186 
192 {
194 public:
195  template<typename Reflector>
196  void reflect(Reflector& r)
197  {
198  r.property("Radius", radius, "The radius of the sphere");
199  }
200 
202  virtual Polygon2f getFootprint(const RigidTransform3f& origin) const;
204  virtual Box3f getBoundingBox(const RigidTransform3f& origin) const;
205 
206  float radius;
207 };
208 
209 typedef boost::shared_ptr<Sphere> SpherePtr;
210 
212 
218 {
220 public:
221  template<typename Reflector>
222  void reflect(Reflector& r)
223  {
224  r.property("Filename", filename, "The filename of the mesh");
225  r.property("Scale", scale, "The scale factor of the mesh", 1.0f);
226  }
227 
229  virtual Polygon2f getFootprint(const RigidTransform3f& origin) const;
231  virtual Box3f getBoundingBox(const RigidTransform3f& origin) const;
232 
233  std::string filename;
234  float scale;
235 };
236 
237 typedef boost::shared_ptr<Mesh> MeshPtr;
238 
240 
246 {
248 public:
249  template<typename Reflector>
250  void reflect(Reflector& r)
251  {
252  r.member("Polygon", polygon, "The polygon geometry");
253  }
254 
256  virtual Polygon2f getFootprint(const RigidTransform3f& origin) const;
262  virtual Box3f getBoundingBox(const RigidTransform3f& origin) const;
263 
265 };
266 
267 typedef boost::shared_ptr<Polygon> PolygonPtr;
268 
270 
271 }}
272 
273 #endif
void reflect(Reflector &r)
Definition: Geometry.h:250
void reflect(Reflector &r)
Definition: Geometry.h:196
Size3f size
The size of the box.
Definition: Geometry.h:121
boost::shared_ptr< Box > BoxPtr
Definition: Geometry.h:124
Cone representation The origin of the cone is located at the center of its base circle.
Definition: Geometry.h:134
float length
The length of the cone.
Definition: Geometry.h:151
virtual ~Geometry()
Definition: Geometry.h:71
float radius
The radius of the cone.
Definition: Geometry.h:150
float radius
The radius of the cylinder.
Definition: Geometry.h:179
void reflect(Reflector &r)
Definition: Geometry.h:168
#define MIRA_ABSTRACT_OBJECT(classIdentifier)
Polygon representation The vertices of the polygon are given relative to its origin.
Definition: Geometry.h:245
Base class for all geometric representations of a rigid model part (link).
Definition: Geometry.h:66
boost::shared_ptr< Cylinder > CylinderPtr
Definition: Geometry.h:183
Spherical representation The origin of the sphere is at its center.
Definition: Geometry.h:191
RigidModel export macro declaration.
boost::shared_ptr< Polygon > PolygonPtr
Definition: Geometry.h:267
float scale
The scale factor of the mesh.
Definition: Geometry.h:234
boost::shared_ptr< Geometry > GeometryPtr
pointer to a geometric representation
Definition: Geometry.h:95
#define MIRA_OBJECT(classIdentifier)
float length
The length of the cylinder.
Definition: Geometry.h:180
boost::shared_ptr< Mesh > MeshPtr
Definition: Geometry.h:237
EIGEN_MAKE_ALIGNED_OPERATOR_NEW void reflect(Reflector &r)
Definition: Geometry.h:111
Cylinder representation The origin is in the center of the cylinder.
Definition: Geometry.h:163
void reflect(Reflector &r)
Definition: Geometry.h:139
#define MIRA_RIGID_MODEL_EXPORT
Definition: RigidModelExports.h:61
boost::shared_ptr< Cone > ConePtr
Definition: Geometry.h:154
Polygon2f polygon
The polygon geometry.
Definition: Geometry.h:264
boost::shared_ptr< Sphere > SpherePtr
Definition: Geometry.h:209
boost::geometry::model::ring< Point2f > Polygon2f
void reflect(Reflector &r)
Definition: Geometry.h:222
Box representation The box is axis aligned and its origin is at the center of the box...
Definition: Geometry.h:103
Mesh representation The vertices of the mesh are given relative to its origin.
Definition: Geometry.h:217
std::string filename
The filename of the mesh.
Definition: Geometry.h:233
float radius
The radius of the sphere.
Definition: Geometry.h:206