ScorePrimitiveShapeVisitor.h
Go to the documentation of this file.
1 #ifndef SCOREPRIMITIVESHAPEVISITOR_HEADER
2 #define SCOREPRIMITIVESHAPEVISITOR_HEADER
4 #include <MiscLib/RefCounted.h>
5 #include <MiscLib/RefCountPtr.h>
7 #include "PlanePrimitiveShape.h"
8 #include "SpherePrimitiveShape.h"
10 #include "ConePrimitiveShape.h"
11 #include "TorusPrimitiveShape.h"
12 
13 template< class PointCompT, class OctreeT >
15  : public PrimitiveShapeVisitor
16 {
17 public:
18  typedef PointCompT PointCompatibilityFunc;
19  typedef OctreeT OctreeType;
22  float normalThresh) : m_pointComp(distThresh, normalThresh) {}
23  void SetOctree(const OctreeT& oct)
24  {
25  m_oct = &oct;
26  }
27  const OctreeT& GetOctree() const
28  {
29  return *m_oct;
30  }
32  {
33  return m_indices;
34  }
36  {
37  m_indices = indices;
38  }
39  void SetShapeIndex(const MiscLib::Vector< int >& shapeIndex)
40  {
41  m_shapeIndex = &shapeIndex;
42  }
44  {
45  return *m_shapeIndex;
46  }
47  template< class ShapeT >
48  void Visit(const ShapeT& primShape)
49  {
50  //if(!m_indices)
51  // m_indices.New< IndicesType >();
52  //m_upperBound = 0;
53  //m_sampled = 0;
54  m_oct->Score(primShape.Internal(), /*1,*/ this);
55  }
56  template< class ShapeT, class OctT >
57  void operator()(const ShapeT& shape, const OctT& oct, size_t i)
58  {
59  if ((*m_shapeIndex)[i] != -1)
60  {
61  return;
62  }
63  if (m_pointComp(shape, oct, i))
64  {
65  m_indices->push_back(i);
66  }
67  }
68  float Epsilon() const
69  {
70  return m_pointComp.DistanceThresh();
71  }
72  //size_t &UpperBound() { return m_upperBound; }
73  //size_t &SampledPoints() { return m_sampled; }
75  {
76  return m_pointComp;
77  }
78 
79 private:
80  PointCompatibilityFunc m_pointComp;
81  const OctreeT* m_oct;
82  /*MiscLib::RefCountPtr<*/ IndicesType /*>*/ *m_indices;
83  const MiscLib::Vector< int >* m_shapeIndex;
84  //size_t m_upperBound;
85  //size_t m_sampled;
86 };
87 
88 template< class PointCompT, class OctreeT >
90  : public PrimitiveShapeVisitorShell< ScorePrimitiveShapeVisitorImpl< PointCompT, OctreeT > >
91 {
92 public:
93  ScorePrimitiveShapeVisitor(float distThresh,
94  float normalThresh) : PrimitiveShapeVisitorShell <
95  ScorePrimitiveShapeVisitorImpl< PointCompT, OctreeT > > (
96  distThresh, normalThresh) {}
97 };
98 
99 #endif
ScorePrimitiveShapeVisitorImpl::GetIndices
IndicesType * GetIndices()
Definition: ScorePrimitiveShapeVisitor.h:31
ScorePrimitiveShapeVisitor::ScorePrimitiveShapeVisitor
ScorePrimitiveShapeVisitor(float distThresh, float normalThresh)
Definition: ScorePrimitiveShapeVisitor.h:93
ScorePrimitiveShapeVisitorImpl::Visit
void Visit(const ShapeT &primShape)
Definition: ScorePrimitiveShapeVisitor.h:48
SpherePrimitiveShape.h
ScorePrimitiveShapeVisitorImpl::PointCompatibilityFunc
PointCompT PointCompatibilityFunc
Definition: ScorePrimitiveShapeVisitor.h:18
MiscLib::RefCounted
Definition: RefCounted.h:10
RefCounted.h
PlanePrimitiveShape.h
MiscLib::Vector::push_back
void push_back(const T &v)
Definition: Vector.h:346
TorusPrimitiveShape.h
ScorePrimitiveShapeVisitorImpl::SetShapeIndex
void SetShapeIndex(const MiscLib::Vector< int > &shapeIndex)
Definition: ScorePrimitiveShapeVisitor.h:39
ScorePrimitiveShapeVisitorImpl
Definition: ScorePrimitiveShapeVisitor.h:14
MiscLib::Vector< int >
ScorePrimitiveShapeVisitorImpl::GetShapeIndex
const MiscLib::Vector< int > & GetShapeIndex()
Definition: ScorePrimitiveShapeVisitor.h:43
PrimitiveShapeVisitor.h
ScorePrimitiveShapeVisitorImpl::operator()
void operator()(const ShapeT &shape, const OctT &oct, size_t i)
Definition: ScorePrimitiveShapeVisitor.h:57
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:737
ScorePrimitiveShapeVisitorImpl::Epsilon
float Epsilon() const
Definition: ScorePrimitiveShapeVisitor.h:68
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:35
CylinderPrimitiveShape.h
PrimitiveShapeVisitorShell
Definition: PrimitiveShapeVisitor.h:26
ScorePrimitiveShapeVisitorImpl::SetOctree
void SetOctree(const OctreeT &oct)
Definition: ScorePrimitiveShapeVisitor.h:23
ScorePrimitiveShapeVisitor
Definition: ScorePrimitiveShapeVisitor.h:89
ScorePrimitiveShapeVisitorImpl::GetOctree
const OctreeT & GetOctree() const
Definition: ScorePrimitiveShapeVisitor.h:27
ConePrimitiveShape.h
ScorePrimitiveShapeVisitorImpl::IndicesType
MiscLib::RefCounted< MiscLib::Vector< size_t > > IndicesType
Definition: ScorePrimitiveShapeVisitor.h:20
ScorePrimitiveShapeVisitorImpl::PointCompFunc
const PointCompatibilityFunc & PointCompFunc() const
Definition: ScorePrimitiveShapeVisitor.h:74
ScorePrimitiveShapeVisitorImpl::OctreeType
OctreeT OctreeType
Definition: ScorePrimitiveShapeVisitor.h:19