Robotics Library  0.7.0
Body.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009, Markus Rickert
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
25 //
26 
27 #ifndef RL_SG_BODY_H
28 #define RL_SG_BODY_H
29 
30 #include <string>
31 #include <vector>
32 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
33 #include <Inventor/VRMLnodes/SoVRMLShape.h>
34 #include <rl/math/Transform.h>
35 #include <rl/math/Vector.h>
36 
37 namespace rl
38 {
39  namespace sg
40  {
41  class Model;
42  class Shape;
43 
44  class Body
45  {
46  public:
47  typedef ::std::vector<Shape*>::iterator Iterator;
48 
49  Body(Model* model);
50 
51  virtual ~Body();
52 
53  virtual void add(Shape* shape);
54 
55  Iterator begin();
56 
57  virtual Shape* create(::SoVRMLShape* shape) = 0;
58 
59  Iterator end();
60 
61  void getBoundingBoxPoints(const ::rl::math::Transform& frame, ::std::vector< ::rl::math::Vector3>& p) const;
62 
63  Model* getModel() const;
64 
65  virtual ::std::string getName() const;
66 
67  ::std::size_t getNumShapes() const;
68 
69  void getPoints(const ::rl::math::Transform& frame, ::std::vector< ::rl::math::Vector3>& p) const;
70 
71  Shape* getShape(const ::std::size_t& i) const;
72 
73  virtual void getFrame(::rl::math::Transform& frame) = 0;
74 
75  virtual void remove(Shape* shape);
76 
77  virtual void setFrame(const ::rl::math::Transform& frame) = 0;
78 
79  virtual void setName(const ::std::string& name);
80 
82 
84 
86 
87  ::std::vector< ::rl::math::Vector3> points;
88 
89  protected:
91 
92  ::std::vector<Shape*> shapes;
93 
94  private:
95  ::std::string name;
96  };
97  }
98 }
99 
100 #endif // RL_SG_BODY_H
rl::sg::Body::shapes
::std::vector< Shape * > shapes
Definition: Body.h:92
rl::sg::Body::~Body
virtual ~Body()
Definition: Body.cpp:53
rl::math::Transform
::Eigen::Transform< Real, 3, ::Eigen::Affine > Transform
Rigid transformation in 3D.
Definition: Transform.h:46
rl::sg::Body::getPoints
void getPoints(const ::rl::math::Transform &frame, ::std::vector< ::rl::math::Vector3 > &p) const
Definition: Body.cpp:112
rl::sg::Body::getFrame
virtual void getFrame(::rl::math::Transform &frame)=0
rl::math::Vector3
::Eigen::Matrix< Real, 3, 1 > Vector3
Definition: Vector.h:46
rl::sg::Body::getNumShapes
::std::size_t getNumShapes() const
Definition: Body.cpp:106
rl::sg::Body::model
Model * model
Definition: Body.h:90
rl::sg::Body::getBoundingBoxPoints
void getBoundingBoxPoints(const ::rl::math::Transform &frame, ::std::vector< ::rl::math::Vector3 > &p) const
Definition: Body.cpp:76
rl::sg::Body::points
::std::vector< ::rl::math::Vector3 > points
Definition: Body.h:87
rl::sg::Body::create
virtual Shape * create(::SoVRMLShape *shape)=0
rl::sg::Body::getName
virtual ::std::string getName() const
Definition: Body.cpp:100
rl::sg::Body::end
Iterator end()
Definition: Body.cpp:70
rl::sg::Body
Definition: Body.h:45
rl::sg::Body::max
::rl::math::Vector3 max
Definition: Body.h:83
Vector.h
rl::sg::Body::name
::std::string name
Definition: Body.h:95
rl::sg::Model
Definition: Model.h:43
rl::sg::Body::center
::rl::math::Vector3 center
Definition: Body.h:81
rl::sg::Body::getModel
Model * getModel() const
Definition: Body.cpp:95
rl::sg::Body::getShape
Shape * getShape(const ::std::size_t &i) const
Definition: Body.cpp:123
rl::sg::Body::setName
virtual void setName(const ::std::string &name)
Definition: Body.cpp:140
rl::sg::Body::remove
virtual void remove(Shape *shape)
Definition: Body.cpp:129
rl::sg::Body::setFrame
virtual void setFrame(const ::rl::math::Transform &frame)=0
rl::sg::Body::add
virtual void add(Shape *shape)
Definition: Body.cpp:58
rl::sg::Body::min
::rl::math::Vector3 min
Definition: Body.h:85
Transform.h
rl::sg::Body::begin
Iterator begin()
Definition: Body.cpp:64
rl::sg::Shape
Definition: Shape.h:41
rl::sg::Body::Body
Body(Model *model)
Definition: Body.cpp:42
rl::sg::Body::Iterator
::std::vector< Shape * >::iterator Iterator
Definition: Body.h:47
rl
Robotics Library.
Definition: AnalogInput.cpp:30