TorusPrimitiveShape.cpp
Go to the documentation of this file.
1 #include "TorusPrimitiveShape.h"
3 #include <MiscLib/Performance.h>
4 #include <sstream>
5 #include "ConePrimitiveShape.h"
7 #include "SpherePrimitiveShape.h"
8 #include "PlanePrimitiveShape.h"
10 
12  : m_torus(torus)
13  , m_parametrization(m_torus)
14 {}
15 
18  , m_torus(tps.m_torus)
19  , m_parametrization(tps.m_parametrization)
20 {
21  m_parametrization.Shape(m_torus);
22 }
23 
25 {
26  return 4;
27 }
28 
30 {
31  return new TorusPrimitiveShape(*this);
32 }
33 
34 float TorusPrimitiveShape::Distance(const Vec3f& p) const
35 {
36  return m_torus.Distance(p);
37 }
38 
40 {
41  return m_torus.SignedDistance(p);
42 }
43 
45  const Vec3f& n) const
46 {
47  Vec3f normal;
48  m_torus.Normal(p, &normal);
49  return n.dot(normal);
50 }
51 
53  const Vec3f& n, std::pair< float, float >* dn) const
54 {
55  Vec3f normal;
56  dn->first = m_torus.DistanceAndNormal(p, &normal);
57  dn->second = n.dot(normal);
58 }
59 
60 void TorusPrimitiveShape::Project(const Vec3f& p, Vec3f* pp) const
61 {
62  m_torus.Project(p, pp);
63 }
64 
65 void TorusPrimitiveShape::Normal(const Vec3f& p, Vec3f* n) const
66 {
67  m_torus.Normal(p, n);
68 }
69 
70 unsigned int TorusPrimitiveShape::ConfidenceTests(unsigned int numTests,
71  float epsilon, float normalThresh, float rms, const PointCloud& pc,
73 {
74  return BasePrimitiveShape::ConfidenceTests< Torus >(numTests, epsilon,
75  normalThresh, rms, pc, indices);
76 }
77 
78 void TorusPrimitiveShape::Description(std::string* s) const
79 {
80  std::ostringstream ostr;
81  ostr << "Torus (minor=" << m_torus.MinorRadius()
82  << " major=" << m_torus.MajorRadius() << ")";
83  *s = ostr.str();
84  // *s = "Torus";
85 }
86 
87 bool TorusPrimitiveShape::Fit(const PointCloud& pc, float epsilon,
88  float normalThresh,
91 {
92  Torus fit = m_torus;
93  if (fit.LeastSquaresFit(pc, begin, end))
94  {
95  m_torus = fit;
96  m_parametrization.Shape(m_torus);
97  return true;
98  }
99  return false;
100 }
101 
103  float normalThresh, MiscLib::Vector< size_t >::const_iterator begin,
105  std::pair< size_t, float >* score) const
106 {
107  Torus fit = m_torus;
108  if (fit.LeastSquaresFit(pc, begin, end))
109  {
110  score->first = -1;
111  return new TorusPrimitiveShape(fit);
112  }
113  score->first = 0;
114  return NULL;
115 }
116 
118 {
119  return new TorusLevMarFunc(m_torus);
120 }
121 
122 void TorusPrimitiveShape::Serialize(std::ostream* o, bool binary) const
123 {
124  if (binary)
125  {
126  const char id = 4;
127  (*o) << id;
128  }
129  else
130  {
131  (*o) << "4" << " ";
132  }
133  m_torus.Serialize(binary, o);
134  m_parametrization.Serialize(o, binary);
135  if (!binary)
136  {
137  *o << std::endl;
138  }
139 }
140 
141 void TorusPrimitiveShape::Deserialize(std::istream* i, bool binary)
142 {
143  m_torus.Init(binary, i);
144  m_parametrization.Shape(m_torus);
145  m_parametrization.Deserialize(i, binary);
146 }
147 
149 {
150  return m_torus.SerializedSize() + m_parametrization.SerializedSize() + 1;
151 }
152 
153 void TorusPrimitiveShape::Transform(float scale, const Vec3f& translate)
154 {
155  m_torus.Transform(scale, translate);
156 }
157 
159 {
160  visitor->Visit(*this);
161 }
162 
165  MiscLib::Vector< size_t >::const_iterator end, float distThresh,
167 {
168  // sample the bounding box in parameter space at 25 locations
169  // these points are used to estimate the other shapes
170  // if the shapes succeed the suggestion is returned
171  MiscLib::Vector< Vec3f > samples(2 * 25);
172  float uStep = (m_extBbox.Max()[0] - m_extBbox.Min()[0]) / 4;
173  float vStep = (m_extBbox.Max()[1] - m_extBbox.Min()[1]) / 4;
174  float u = m_extBbox.Min()[0];
175  for (unsigned int i = 0; i < 5; ++i, u += uStep)
176  {
177  float v = m_extBbox.Min()[1];
178  for (unsigned int j = 0; j < 5; ++j, v += vStep)
179  {
180  float bmpu;
181  if (m_torus.MajorRadius() < m_torus.MinorRadius() * 2)
182  {
183  bmpu = u * (m_torus.MajorRadius() + m_torus.MinorRadius());
184  }
185  else
186  {
187  bmpu = u * m_torus.MajorRadius();
188  }
189  InSpace(bmpu, v * m_torus.MinorRadius(), &samples[i * 5 + j],
190  &samples[i * 5 + j + 25]);
191  }
192  }
193  size_t c = samples.size() / 2;
194  // now check all the shape types
195  Cone cone;
196  if (cone.InitAverage(samples))
197  {
198  cone.LeastSquaresFit(samples.begin(), samples.begin() + c);
199  bool failed = false;
200  for (size_t i = 0; i < c; ++i)
201  if (cone.Distance(samples[i]) > distThresh)
202  {
203  failed = true;
204  break;
205  }
206  if (!failed)
207  {
208  suggestions->push_back(new ConePrimitiveShape(cone));
209  suggestions->back()->Release();
210  }
211  }
212  Cylinder cylinder;
213  if (cylinder.InitAverage(samples))
214  {
215  cylinder.LeastSquaresFit(samples.begin(), samples.begin() + c);
216  bool failed = false;
217  for (size_t i = 0; i < c; ++i)
218  if (cylinder.Distance(samples[i]) > distThresh)
219  {
220  failed = true;
221  break;
222  }
223  if (!failed)
224  {
225  suggestions->push_back(new CylinderPrimitiveShape(cylinder));
226  suggestions->back()->Release();
227  }
228  }
229  Sphere sphere;
230  if (sphere.Init(samples))
231  {
232  sphere.LeastSquaresFit(samples.begin(), samples.begin() + c);
233  bool failed = false;
234  for (size_t i = 0; i < c; ++i)
235  if (sphere.Distance(samples[i]) > distThresh)
236  {
237  failed = true;
238  break;
239  }
240  if (!failed)
241  {
242  suggestions->push_back(new SpherePrimitiveShape(sphere));
243  suggestions->back()->Release();
244  }
245  }
246  Plane plane;
247  if (plane.LeastSquaresFit(samples.begin(), samples.begin() + c))
248  {
249  bool failed = false;
250  for (size_t i = 0; i < c; ++i)
251  if (plane.Distance(samples[i]) > distThresh)
252  {
253  failed = true;
254  break;
255  }
256  if (!failed)
257  {
258  suggestions->push_back(new PlanePrimitiveShape(plane));
259  suggestions->back()->Release();
260  }
261  }
262  /*// although theoretically possible, we never suggest a cone since a misclassification
263  // of a cone as a torus is extremley seldom
264  // The parametrization is given as major arclength and minor arclength
265  float radialMajor = m_extBbox.Max()[0] - m_extBbox.Min()[0];
266  float radialMinor = m_extBbox.Max()[1] - m_extBbox.Min()[1];
267  float lengthMajor = radialMajor * m_torus.MajorRadius();
268  float lengthMinor = radialMinor * m_torus.MinorRadius();
269  float meanRadius = (m_torus.MajorRadius() + m_torus.MinorRadius()) / 2;
270  // suggest a cylinder if either of the two radii can be replaced by
271  // a non curved direction
272  // we suggest a cylinder if the major radius causes an error less than distThresh
273  // this tests if the major radius can be replaced
274  float radiusDiffMajor = (m_torus.MajorRadius() - (std::cos(radialMajor / 2)
275  * m_torus.MajorRadius())) / 2;
276  if(radiusDiffMajor < distThresh)
277  {
278  // construct the cylinder
279  // the axis of the cylinder is given
280  float majorCenter = (m_extBbox.Max()[0] - m_extBbox.Min()[0]) / 2
281  * m_torus.MajorRadius();
282  Vec3f pos, normal, cyAxisDir;
283  InSpace(majorCenter, M_PI * m_torus.MinorRadius(), &pos, &normal);
284  cyAxisDir = normal.cross(m_torus.AxisDirection());
285  cyAxisDir.normalize();
286  pos -= (m_torus.MinorRadius() - radiusDiffMajor) * normal;
287  Cylinder cylinder(cyAxisDir, pos, m_torus.MinorRadius());
288  suggestions->push_back(new CylinderPrimitiveShape(cylinder));
289  suggestions->back()->Release();
290  }
291  // now test if the minor radius can be replaced
292  float radiusDiffMinor = (m_torus.MinorRadius() - (std::cos(radialMinor / 2)
293  * m_torus.MinorRadius())) / 2;
294  if(radiusDiffMinor < distThresh)
295  {
296  // if the minor radius is replaced
297  }
298  // we suggest a sphere if the torus is apple shaped
299  if(m_torus.IsAppleShaped())
300  {
301  Sphere sphere(m_torus.Center(),
302  (m_torus.MajorRadius() + m_torus.MinorRadius()) / 2);
303  suggestions->push_back(new SpherePrimitiveShape(sphere));
304  suggestions->back()->Release();
305  }
306  // we can also suggest a sphere if the error introduced by a common radius
307  // for minor and major does not introduce an error
308  //else if()
309  //{
310  //}
311  // we suggest a plane if both major and minor radius cause ony small error
312  float radiusDiffMinor = (m_torus.MinorRadius() - (std::cos(radialMinor / 2)
313  * m_torus.MinorRadius())) / 2;
314  if(radiusDiffMajor < distThresh && radiusDiffMinor < distThresh)
315  {
316  GfxTL::Vector2Df paramCenter;
317  m_extBbox.Center(&paramCenter);
318  Vec3f pos, normal;
319  InSpace(paramCenter[0] * m_torus.MajorRadius(),
320  paramCenter[1] * m_torus.MinorRadius(), &pos, &normal);
321  Plane plane(pos, normal);
322  suggestions->push_back(new PlanePrimitiveShape(plane));
323  suggestions->back()->Release();
324  }*/
325 }
326 
328  size_t begin, size_t end, float epsilon)
329 {
330  m_parametrization.Optimize(GfxTL::IndexIterate(IndexIterator(begin), pc.begin()),
331  GfxTL::IndexIterate(IndexIterator(end), pc.begin()), epsilon);
332 }
333 
334 bool TorusPrimitiveShape::Similar(float tolerance,
335  const TorusPrimitiveShape& shape) const
336 {
337  return m_torus.MajorRadius() <= (1.f + tolerance) * shape.m_torus.MajorRadius()
338  && (1.f + tolerance) * m_torus.MajorRadius() >= shape.m_torus.MajorRadius()
339  && m_torus.MinorRadius() <= (1.f + tolerance) * shape.m_torus.MinorRadius()
340  && (1.f + tolerance) * m_torus.MinorRadius() >= shape.m_torus.MinorRadius();
341 }
342 
344  std::pair< float, float >* param) const
345 {
346  m_parametrization.Parameters(p, param);
347 }
348 
354  MiscLib::Vector< std::pair< float, float > >* bmpParams) const
355 {
356  ParametersImpl(begin, end, bmpParams);
357 }
358 
364  MiscLib::Vector< std::pair< float, float > >* bmpParams) const
365 {
366  ParametersImpl(begin, end, bmpParams);
367 }
368 
369 bool TorusPrimitiveShape::InSpace(float u, float v, Vec3f* p, Vec3f* n) const
370 {
371  return m_parametrization.InSpace(u, v, p, n);
372 }
373 
376  MiscLib::Vector< std::pair< float, float > >* params,
377  size_t* uextent, size_t* vextent)
378 {
379  *uextent = std::ceil((bbox->Max()[0] - bbox->Min()[0]) / epsilon);
380  *vextent = std::ceil((bbox->Max()[1] - bbox->Min()[1]) / epsilon);
381 }
382 
383 void TorusPrimitiveShape::InBitmap(const std::pair< float, float >& param,
384  float epsilon, const GfxTL::AABox< GfxTL::Vector2Df >& bbox,
385  size_t uextent, size_t vextent,
386  std::pair< int, int >* inBmp) const
387 {
388  inBmp->first = std::floor((param.first - bbox.Min()[0]) / epsilon);
389  inBmp->second = std::floor((param.second - bbox.Min()[1]) / epsilon);
390 }
391 
394  float epsilon, bool* uwrap, bool* vwrap) const
395 {
396  m_parametrization.WrapBitmap(bbox, epsilon, uwrap, vwrap);
397 }
398 
400  float epsilon, size_t uextent, size_t vextent,
401  MiscLib::Vector< int >* componentImg,
402  MiscLib::Vector< std::pair< int, size_t > >* labels) const
403 {
404  m_parametrization.WrapComponents(bbox, epsilon, uextent, vextent,
405  componentImg, labels);
406 }
407 
410  const MiscLib::Vector< int >& componentsImg, size_t uextent,
411  size_t vextent, float epsilon, int label)
412 {}
413 
414 bool TorusPrimitiveShape::InSpace(size_t u, size_t v, float epsilon,
415  const GfxTL::AABox< GfxTL::Vector2Df >& bbox, size_t uextent,
416  size_t vextent, Vec3f* p, Vec3f* n) const
417 {
418  return m_parametrization.InSpace((u + .5f) * epsilon + bbox.Min()[0],
419  (v + .5f) * epsilon + bbox.Min()[1], p, n);
420 }
GfxTL::IndexedIterator
Definition: IndexedIterator.h:8
TorusPrimitiveShape::SignedDistance
float SignedDistance(const Vec3f &p) const
Definition: TorusPrimitiveShape.cpp:39
PrimitiveShapeVisitor::Visit
virtual void Visit(const PlanePrimitiveShape &plane)=0
TorusPrimitiveShape::Visit
void Visit(PrimitiveShapeVisitor *visitor) const
Definition: TorusPrimitiveShape.cpp:158
TorusPrimitiveShape::SerializedSize
size_t SerializedSize() const
Definition: TorusPrimitiveShape.cpp:148
LevMarFunc< float >
GfxTL::AABox::Max
Point & Max()
Definition: AABox.hpp:74
SpherePrimitiveShape.h
MiscLib::Vector::begin
T * begin()
Definition: Vector.h:460
PlanePrimitiveShape.h
Torus::MinorRadius
const float MinorRadius() const
Definition: Torus.h:42
Vec3f
Definition: basic.h:16
Performance.h
TorusPrimitiveShape::Normal
void Normal(const Vec3f &p, Vec3f *n) const
Definition: TorusPrimitiveShape.cpp:65
TorusPrimitiveShape.h
Sphere::Distance
float Distance(const Vec3f &p) const
Definition: Sphere.h:219
TorusPrimitiveShape::NormalDeviation
float NormalDeviation(const Vec3f &p, const Vec3f &n) const
Definition: TorusPrimitiveShape.cpp:44
Cone::Distance
float Distance(const Vec3f &p) const
Definition: Cone.h:219
Torus::SignedDistance
float SignedDistance(const Vec3f &p) const
Definition: Torus.h:178
Plane::LeastSquaresFit
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
Definition: Plane.cpp:179
Torus::LeastSquaresFit
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
Definition: Torus.cpp:539
Torus
Definition: Torus.h:18
BitmapPrimitiveShape
Definition: BitmapPrimitiveShape.h:30
TorusPrimitiveShape
Definition: TorusPrimitiveShape.h:12
TorusPrimitiveShape::Fit
bool Fit(const PointCloud &pc, float epsilon, float normalThresh, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
Definition: TorusPrimitiveShape.cpp:87
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
PrimitiveShape
PrimtiveShape is a shape primitive in conjunction with a parametrization.
Definition: PrimitiveShape.h:32
LowStretchTorusParametrization::InSpace
bool InSpace(float u, float v, Vec3f *p) const
Definition: LowStretchTorusParametrization.h:78
LowStretchTorusParametrization::Parameters
void Parameters(const Vec3f &p, std::pair< float, float > *param) const
Definition: LowStretchTorusParametrization.h:52
LowStretchTorusParametrization::WrapComponents
void WrapComponents(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, size_t uextent, size_t vextent, MiscLib::Vector< int > *componentImg, MiscLib::Vector< std::pair< int, size_t > > *labels) const
Definition: LowStretchTorusParametrization.cpp:19
LowStretchTorusParametrization::Optimize
void Optimize(IteratorT begin, IteratorT end, float epsilon)
Definition: LowStretchTorusParametrization.h:126
TorusPrimitiveShape::WrapBitmap
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
Definition: TorusPrimitiveShape.cpp:392
TorusPrimitiveShape::Project
void Project(const Vec3f &p, Vec3f *pp) const
Definition: TorusPrimitiveShape.cpp:60
MiscLib::Vector< size_t >
LowStretchTorusParametrization::Deserialize
void Deserialize(std::istream *i, bool binary)
Definition: LowStretchTorusParametrization.cpp:161
TorusPrimitiveShape::SignedDistanceFunc
LevMarFunc< float > * SignedDistanceFunc() const
Definition: TorusPrimitiveShape.cpp:117
Torus::Normal
void Normal(const Vec3f &p, Vec3f *n) const
Definition: Torus.h:115
Torus::Distance
float Distance(const Vec3f &p) const
Definition: Torus.h:87
PrimitiveShapeVisitor.h
ConePrimitiveShape
class DLL_LINKAGE ConePrimitiveShape
Definition: PrimitiveShapeVisitor.h:11
Cylinder::Distance
float Distance(const Vec3f &p) const
Definition: Cylinder.h:180
MiscLib::Vector< Point >::const_iterator
const typedef Point * const_iterator
Definition: Vector.h:26
TorusPrimitiveShape::SuggestSimplifications
void SuggestSimplifications(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end, float distThresh, MiscLib::Vector< MiscLib::RefCountPtr< PrimitiveShape > > *suggestions) const
Definition: TorusPrimitiveShape.cpp:163
CylinderPrimitiveShape
class DLL_LINKAGE CylinderPrimitiveShape
Definition: PrimitiveShapeVisitor.h:10
MiscLib::Vector::size
size_type size() const
Definition: Vector.h:212
Torus::Transform
void Transform(float scale, const Vec3f &translate)
Definition: Torus.cpp:372
TorusPrimitiveShape::BitmapExtent
void BitmapExtent(float epsilon, GfxTL::AABox< GfxTL::Vector2Df > *bbox, MiscLib::Vector< std::pair< float, float > > *params, size_t *uextent, size_t *vextent)
Definition: TorusPrimitiveShape.cpp:374
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
Plane::Distance
float Distance(const Vec3f &pos) const
Definition: Plane.h:34
Cylinder::LeastSquaresFit
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
Definition: Cylinder.cpp:422
Cone
Definition: Cone.h:22
Torus::DistanceAndNormal
float DistanceAndNormal(const Vec3f &p, Vec3f *n) const
Definition: Torus.h:141
PrimitiveShapeVisitor
Definition: PrimitiveShapeVisitor.h:14
MiscLib::performance_t
clock_t performance_t
Definition: Performance.h:27
Cylinder::InitAverage
bool InitAverage(const MiscLib::Vector< Vec3f > &samples)
Definition: Cylinder.cpp:93
CylinderPrimitiveShape.h
SpherePrimitiveShape
class DLL_LINKAGE SpherePrimitiveShape
Definition: PrimitiveShapeVisitor.h:9
GfxTL::IndexIterate
IndexedIterator< IndexIteratorT, IteratorT > IndexIterate(IndexIteratorT idxIt, IteratorT it)
Definition: IndexedIterator.h:154
TorusLevMarFunc
Definition: TorusPrimitiveShape.h:129
TorusPrimitiveShape::Deserialize
void Deserialize(std::istream *i, bool binary)
Definition: TorusPrimitiveShape.cpp:141
BitmapPrimitiveShape::m_extBbox
GfxTL::AABox< GfxTL::Vector2Df > m_extBbox
Definition: BitmapPrimitiveShape.h:98
Torus::Serialize
void Serialize(bool binary, std::ostream *o) const
Definition: Torus.cpp:575
TorusPrimitiveShape::Description
void Description(std::string *s) const
Definition: TorusPrimitiveShape.cpp:78
LowStretchTorusParametrization::Serialize
void Serialize(std::ostream *o, bool binary) const
Definition: LowStretchTorusParametrization.cpp:145
Cone::InitAverage
bool InitAverage(const MiscLib::Vector< Vec3f > &samples)
Definition: Cone.cpp:98
MiscLib::RefCountPtr< PrimitiveShape >
TorusPrimitiveShape::DistanceAndNormalDeviation
void DistanceAndNormalDeviation(const Vec3f &p, const Vec3f &n, std::pair< float, float > *dn) const
Definition: TorusPrimitiveShape.cpp:52
TorusPrimitiveShape::Distance
float Distance(const Vec3f &p) const
Definition: TorusPrimitiveShape.cpp:34
LowStretchTorusParametrization::SerializedSize
static size_t SerializedSize()
Definition: LowStretchTorusParametrization.cpp:140
Sphere::Init
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition: Sphere.cpp:172
TorusPrimitiveShape::LSFit
PrimitiveShape * LSFit(const PointCloud &pc, float epsilon, float normalThresh, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end, std::pair< size_t, float > *score) const
Definition: TorusPrimitiveShape.cpp:102
TorusPrimitiveShape::InBitmap
void InBitmap(const std::pair< float, float > &param, float epsilon, const GfxTL::AABox< GfxTL::Vector2Df > &bbox, size_t uextent, size_t vextent, std::pair< int, int > *inBmp) const
Definition: TorusPrimitiveShape.cpp:383
PointCloud
Definition: PointCloud.h:69
TorusPrimitiveShape::Transform
void Transform(float scale, const Vec3f &translate)
Definition: TorusPrimitiveShape.cpp:153
Torus::Project
void Project(const Vec3f &p, Vec3f *pp) const
Definition: Torus.h:243
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
Vec3f::dot
float dot(const Vec3f &v) const
Definition: basic.h:92
TorusPrimitiveShape::InSpace
bool InSpace(float u, float v, Vec3f *p, Vec3f *n) const
Definition: TorusPrimitiveShape.cpp:369
TorusPrimitiveShape::WrapComponents
void WrapComponents(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, size_t uextent, size_t vextent, MiscLib::Vector< int > *componentImg, MiscLib::Vector< std::pair< int, size_t > > *labels) const
Definition: TorusPrimitiveShape.cpp:399
GfxTL::AABox::Min
Point & Min()
Definition: AABox.hpp:62
Torus::Init
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition: Torus.cpp:64
LowStretchTorusParametrization::WrapBitmap
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
Definition: LowStretchTorusParametrization.h:26
TorusPrimitiveShape::Clone
PrimitiveShape * Clone() const
Definition: TorusPrimitiveShape.cpp:29
Plane
Definition: Plane.h:16
Torus::SerializedSize
static size_t SerializedSize()
Definition: Torus.cpp:592
TorusPrimitiveShape::ConfidenceTests
unsigned int ConfidenceTests(unsigned int numTests, float epsilon, float normalThresh, float rms, const PointCloud &pc, const MiscLib::Vector< size_t > &indices) const
Definition: TorusPrimitiveShape.cpp:70
TorusPrimitiveShape::Similar
bool Similar(float tolerance, const TorusPrimitiveShape &shape) const
Definition: TorusPrimitiveShape.cpp:334
TorusPrimitiveShape::Parameters
void Parameters(const Vec3f &p, std::pair< float, float > *param) const
Definition: TorusPrimitiveShape.cpp:343
Sphere
Definition: Sphere.h:27
Torus::MajorRadius
const float MajorRadius() const
Definition: Torus.h:46
totalTime_torusConnected
MiscLib::performance_t totalTime_torusConnected
Sphere::LeastSquaresFit
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
Definition: Sphere.cpp:389
pc
Introduction Thank you for taking interest in our work and downloading this software This library implements the algorithm described in the paper R R R Klein Efficient RANSAC for Point Cloud Shape in Computer Graphics Blackwell June If you use this software you should cite the aforementioned paper in any resulting publication Please send comments or bug reports to Ruwen Roland BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Example usage This section shows how to use the library to detect the shapes in a point cloud PointCloud pc
Definition: ReadMe.txt:68
Cylinder
Definition: Cylinder.h:20
TorusPrimitiveShape::OptimizeParametrization
void OptimizeParametrization(const PointCloud &pc, size_t begin, size_t end, float epsilon)
Definition: TorusPrimitiveShape.cpp:327
TorusPrimitiveShape::Identifier
size_t Identifier() const
Definition: TorusPrimitiveShape.cpp:24
ConePrimitiveShape.h
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
IndexIterator
Definition: IndexIterator.h:9
GfxTL::AABox
Definition: AABox.h:18
PlanePrimitiveShape
class DLL_LINKAGE PlanePrimitiveShape
Definition: PrimitiveShapeVisitor.h:8
TorusPrimitiveShape::SetExtent
void SetExtent(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, const MiscLib::Vector< int > &componentsImg, size_t uextent, size_t vextent, float epsilon, int label)
Definition: TorusPrimitiveShape.cpp:408
TorusPrimitiveShape::Serialize
void Serialize(std::ostream *o, bool binary=true) const
This is the one and only serialization function It stores all the parameters of the shape as well as ...
Definition: TorusPrimitiveShape.cpp:122
TorusPrimitiveShape::TorusPrimitiveShape
TorusPrimitiveShape()
Definition: TorusPrimitiveShape.h:17
Cone::LeastSquaresFit
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
Definition: Cone.cpp:667
LowStretchTorusParametrization::Shape
void Shape(const Torus &torus)
Definition: LowStretchTorusParametrization.cpp:12