ScorePrimitiveShapeVisitor.h
Go to the documentation of this file.
1 #ifndef SCOREPRIMITIVESHAPEVISITOR_HEADER
2 #define SCOREPRIMITIVESHAPEVISITOR_HEADER
3 #include "ConePrimitiveShape.h"
5 #include "PlanePrimitiveShape.h"
7 #include "SpherePrimitiveShape.h"
8 #include "TorusPrimitiveShape.h"
10 #include <MiscLib/RefCountPtr.h>
11 #include <MiscLib/RefCounted.h>
12 
13 template <class PointCompT, class OctreeT>
15 {
16 public:
17  typedef PointCompT PointCompatibilityFunc;
18  typedef OctreeT OctreeType;
20 
21  ScorePrimitiveShapeVisitorImpl(float distThresh, float normalThresh) :
22  m_pointComp(distThresh, normalThresh)
23  {
24  }
25 
26  void
27  SetOctree(const OctreeT& oct)
28  {
29  m_oct = &oct;
30  }
31 
32  const OctreeT&
33  GetOctree() const
34  {
35  return *m_oct;
36  }
37 
40  {
41  return m_indices;
42  }
43 
44  void
46  {
47  m_indices = indices;
48  }
49 
50  void
52  {
53  m_shapeIndex = &shapeIndex;
54  }
55 
58  {
59  return *m_shapeIndex;
60  }
61 
62  template <class ShapeT>
63  void
64  Visit(const ShapeT& primShape)
65  {
66  //if(!m_indices)
67  // m_indices.New< IndicesType >();
68  //m_upperBound = 0;
69  //m_sampled = 0;
70  m_oct->Score(primShape.Internal(), /*1,*/ this);
71  }
72 
73  template <class ShapeT, class OctT>
74  void
75  operator()(const ShapeT& shape, const OctT& oct, size_t i)
76  {
77  if ((*m_shapeIndex)[i] != -1)
78  {
79  return;
80  }
81  if (m_pointComp(shape, oct, i))
82  {
83  m_indices->push_back(i);
84  }
85  }
86 
87  float
88  Epsilon() const
89  {
90  return m_pointComp.DistanceThresh();
91  }
92 
93  //size_t &UpperBound() { return m_upperBound; }
94  //size_t &SampledPoints() { return m_sampled; }
96  PointCompFunc() const
97  {
98  return m_pointComp;
99  }
100 
101 private:
102  PointCompatibilityFunc m_pointComp;
103  const OctreeT* m_oct;
104  /*MiscLib::RefCountPtr<*/ IndicesType /*>*/* m_indices;
105  const MiscLib::Vector<int>* m_shapeIndex;
106  //size_t m_upperBound;
107  //size_t m_sampled;
108 };
109 
110 template <class PointCompT, class OctreeT>
112  public PrimitiveShapeVisitorShell<ScorePrimitiveShapeVisitorImpl<PointCompT, OctreeT>>
113 {
114 public:
115  ScorePrimitiveShapeVisitor(float distThresh, float normalThresh) :
117  distThresh,
118  normalThresh)
119  {
120  }
121 };
122 
123 #endif
ScorePrimitiveShapeVisitorImpl::GetIndices
IndicesType * GetIndices()
Definition: ScorePrimitiveShapeVisitor.h:39
ScorePrimitiveShapeVisitor::ScorePrimitiveShapeVisitor
ScorePrimitiveShapeVisitor(float distThresh, float normalThresh)
Definition: ScorePrimitiveShapeVisitor.h:115
ScorePrimitiveShapeVisitorImpl::Visit
void Visit(const ShapeT &primShape)
Definition: ScorePrimitiveShapeVisitor.h:64
SpherePrimitiveShape.h
ScorePrimitiveShapeVisitorImpl::PointCompatibilityFunc
PointCompT PointCompatibilityFunc
Definition: ScorePrimitiveShapeVisitor.h:17
MiscLib::RefCounted
Definition: RefCounted.h:10
RefCounted.h
PlanePrimitiveShape.h
MiscLib::Vector::push_back
void push_back(const T &v)
Definition: Vector.h:354
TorusPrimitiveShape.h
ScorePrimitiveShapeVisitorImpl::SetShapeIndex
void SetShapeIndex(const MiscLib::Vector< int > &shapeIndex)
Definition: ScorePrimitiveShapeVisitor.h:51
ScorePrimitiveShapeVisitorImpl
Definition: ScorePrimitiveShapeVisitor.h:14
MiscLib::Vector< int >
PrimitiveShapeVisitor.h
ScorePrimitiveShapeVisitorImpl::operator()
void operator()(const ShapeT &shape, const OctT &oct, size_t i)
Definition: ScorePrimitiveShapeVisitor.h:75
NoShrinkVector.h
RefCountPtr.h
pcl::graph::indices
pcl::PointIndices::Ptr indices(const PCG &g)
Retrieve the indices of the points of the point cloud stored in a point cloud graph that actually bel...
Definition: point_cloud_graph.h:717
ScorePrimitiveShapeVisitorImpl::Epsilon
float Epsilon() const
Definition: ScorePrimitiveShapeVisitor.h:88
PrimitiveShapeVisitor
Definition: PrimitiveShapeVisitor.h:14
ScorePrimitiveShapeVisitorImpl::ScorePrimitiveShapeVisitorImpl
ScorePrimitiveShapeVisitorImpl(float distThresh, float normalThresh)
Definition: ScorePrimitiveShapeVisitor.h:21
ScorePrimitiveShapeVisitorImpl::SetIndices
void SetIndices(IndicesType *indices)
Definition: ScorePrimitiveShapeVisitor.h:45
CylinderPrimitiveShape.h
ScorePrimitiveShapeVisitorImpl::GetShapeIndex
const MiscLib::Vector< int > & GetShapeIndex()
Definition: ScorePrimitiveShapeVisitor.h:57
PrimitiveShapeVisitorShell
Definition: PrimitiveShapeVisitor.h:29
ScorePrimitiveShapeVisitorImpl::SetOctree
void SetOctree(const OctreeT &oct)
Definition: ScorePrimitiveShapeVisitor.h:27
ScorePrimitiveShapeVisitor
Definition: ScorePrimitiveShapeVisitor.h:111
ScorePrimitiveShapeVisitorImpl::GetOctree
const OctreeT & GetOctree() const
Definition: ScorePrimitiveShapeVisitor.h:33
ConePrimitiveShape.h
ScorePrimitiveShapeVisitorImpl::IndicesType
MiscLib::RefCounted< MiscLib::Vector< size_t > > IndicesType
Definition: ScorePrimitiveShapeVisitor.h:19
ScorePrimitiveShapeVisitorImpl::PointCompFunc
const PointCompatibilityFunc & PointCompFunc() const
Definition: ScorePrimitiveShapeVisitor.h:96
ScorePrimitiveShapeVisitorImpl::OctreeType
OctreeT OctreeType
Definition: ScorePrimitiveShapeVisitor.h:18