Robotics Library  0.7.0
Compound.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_MDL_COMPOUND_H
28 #define RL_MDL_COMPOUND_H
29 
30 #include <boost/graph/filtered_graph.hpp>
31 
32 #include "Model.h"
33 
34 namespace rl
35 {
36  namespace mdl
37  {
38  class Frame;
39  class Transform;
40 
41  class Compound
42  {
43  public:
45 
46  virtual ~Compound();
47 
48  void add(Frame* frame);
49 
50  void add(Transform* transform, const Frame* a, const Frame* b);
51 
52  void remove(Frame* frame);
53 
54  void remove(Transform* transform);
55 
57 
59 
61 
63 
64  protected:
65 
66  private:
67  typedef ::boost::property_map< Model::Tree, ::boost::edge_weight_t>::type EdgeWeightMapType;
68 
69  typedef ::boost::property_map< Model::Tree, ::boost::vertex_color_t>::type VertexColorMapType;
70 
71  template<typename EdgeWeightMap>
73  {
75  {
76  }
77 
78  EdgePredicate(const EdgeWeightMap& weight) :
79  weight(weight)
80  {
81  }
82 
83  template<typename Edge>
84  bool operator()(const Edge& e) const
85  {
86  return this == get(weight, e);
87  }
88 
89  EdgeWeightMap weight;
90  };
91 
92  template<typename VertexColorMap>
94  {
96  {
97  }
98 
99  VertexPredicate(const VertexColorMap& color) :
100  color(color)
101  {
102  }
103 
104  template<typename Vertex>
105  bool operator()(const Vertex& v) const
106  {
107  return this == get(color, v);
108  }
109 
110  VertexColorMap color;
111  };
112 
113  typedef ::boost::filtered_graph<Model::Tree, EdgePredicate<EdgeWeightMapType>, VertexPredicate<VertexColorMapType>> Tree;
114 
116 
118  };
119  }
120 }
121 
122 #endif // RL_MDL_COMPOUND_H
rl::mdl::Compound::~Compound
virtual ~Compound()
Definition: Compound.cpp:49
rl::math::Transform
::Eigen::Transform< Real, 3, ::Eigen::Affine > Transform
Rigid transformation in 3D.
Definition: Transform.h:46
rl::mdl::Compound::VertexPredicate::VertexPredicate
VertexPredicate()
Definition: Compound.h:95
rl::mdl::Compound::outTransform
Transform * outTransform
Definition: Compound.h:62
rl::mdl::Transform
Definition: Transform.h:43
rl::mdl::Compound::EdgePredicate
Definition: Compound.h:73
rl::mdl::Compound::add
void add(Frame *frame)
Definition: Compound.cpp:54
rl::mdl::Compound::VertexColorMapType
::boost::property_map< Model::Tree, ::boost::vertex_color_t >::type VertexColorMapType
Definition: Compound.h:69
rl::mdl::Compound::outFrame
Frame * outFrame
Definition: Compound.h:60
rl::mdl::Compound::Compound
Compound(Model *model)
Definition: Compound.cpp:35
rl::mdl::Compound::EdgePredicate::operator()
bool operator()(const Edge &e) const
Definition: Compound.h:84
rl::mdl::Compound::EdgePredicate::EdgePredicate
EdgePredicate(const EdgeWeightMap &weight)
Definition: Compound.h:78
rl::mdl::Compound::VertexPredicate::operator()
bool operator()(const Vertex &v) const
Definition: Compound.h:105
rl::mdl::Compound::EdgeWeightMapType
::boost::property_map< Model::Tree, ::boost::edge_weight_t >::type EdgeWeightMapType
Definition: Compound.h:67
rl::mdl::Compound
Definition: Compound.h:42
rl::mdl::Compound::inTransform
Transform * inTransform
Definition: Compound.h:58
rl::mdl::Compound::EdgePredicate::EdgePredicate
EdgePredicate()
Definition: Compound.h:74
rl::mdl::Model
Definition: Model.h:56
Model.h
rl::mdl::Compound::VertexPredicate
Definition: Compound.h:94
rl::mdl::Compound::remove
void remove(Frame *frame)
Definition: Compound.cpp:66
rl::mdl::Compound::inFrame
Frame * inFrame
Definition: Compound.h:56
rl::mdl::Compound::model
Model * model
Definition: Compound.h:115
rl::mdl::Compound::Tree
::boost::filtered_graph< Model::Tree, EdgePredicate< EdgeWeightMapType >, VertexPredicate< VertexColorMapType > > Tree
Definition: Compound.h:113
rl::mdl::Compound::EdgePredicate::weight
EdgeWeightMap weight
Definition: Compound.h:89
rl::mdl::Frame
Definition: Frame.h:42
rl::mdl::Compound::VertexPredicate::VertexPredicate
VertexPredicate(const VertexColorMap &color)
Definition: Compound.h:99
rl::mdl::Compound::VertexPredicate::color
VertexColorMap color
Definition: Compound.h:110
rl::mdl::Compound::tree
Tree tree
Definition: Compound.h:117
rl
Robotics Library.
Definition: AnalogInput.cpp:30