ScorePrimitiveShapeVisitor.h
Go to the documentation of this file.
1#ifndef SCOREPRIMITIVESHAPEVISITOR_HEADER
2#define SCOREPRIMITIVESHAPEVISITOR_HEADER
10#include <MiscLib/RefCountPtr.h>
11#include <MiscLib/RefCounted.h>
12
13template <class PointCompT, class OctreeT>
15{
16public:
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; }
97 {
98 return m_pointComp;
99 }
100
101private:
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
110template <class PointCompT, class OctreeT>
112 public PrimitiveShapeVisitorShell<ScorePrimitiveShapeVisitorImpl<PointCompT, OctreeT>>
113{
114public:
115 ScorePrimitiveShapeVisitor(float distThresh, float normalThresh) :
117 distThresh,
118 normalThresh)
119 {
120 }
121};
122
123#endif
void operator()(const ShapeT &shape, const OctT &oct, size_t i)
const MiscLib::Vector< int > & GetShapeIndex()
MiscLib::RefCounted< MiscLib::Vector< size_t > > IndicesType
const PointCompatibilityFunc & PointCompFunc() const
ScorePrimitiveShapeVisitorImpl(float distThresh, float normalThresh)
void SetShapeIndex(const MiscLib::Vector< int > &shapeIndex)
void Visit(const ShapeT &primShape)
ScorePrimitiveShapeVisitor(float distThresh, float normalThresh)