CylinderPrimitiveShape.cpp
Go to the documentation of this file.
2 #include "ScoreComputer.h"
4 #include <limits>
5 #ifndef _USE_MATH_DEFINES
6 #define _USE_MATH_DEFINES
7 #endif
8 #include <cmath>
9 #include <GfxTL/NullClass.h>
10 #include <iostream>
11 #include <algorithm>
12 #include <MiscLib/Performance.h>
13 #include "TorusPrimitiveShape.h"
14 #include "ConePrimitiveShape.h"
15 #include "SpherePrimitiveShape.h"
16 #include "PlanePrimitiveShape.h"
18 
20 {}
21 
23  : m_cylinder(cylinder)
24 {}
25 
27 {
28  return 2;
29 }
30 
32 {
33  return new CylinderPrimitiveShape(*this);
34 }
35 
36 bool CylinderPrimitiveShape::Init(const Vec3f& pointA, const Vec3f& pointB,
37  const Vec3f& normalA, const Vec3f& normalB)
38 {
39  return m_cylinder.Init(pointA, pointB, normalA, normalB);
40 }
41 
43 {
44  return m_cylinder.Distance(p);
45 }
46 
48 {
49  return m_cylinder.SignedDistance(p);
50 }
51 
53  const Vec3f& n) const
54 {
55  Vec3f normal;
56  m_cylinder.Normal(p, &normal);
57  return n.dot(normal);
58 }
59 
61  const Vec3f& p, const Vec3f& n, std::pair< float, float >* dn) const
62 {
63  Vec3f normal;
64  dn->first = m_cylinder.DistanceAndNormal(p, &normal);
65  dn->second = n.dot(normal);
66 }
67 
68 void CylinderPrimitiveShape::Project(const Vec3f& p, Vec3f* pp) const
69 {
70  m_cylinder.Project(p, pp);
71 }
72 
73 void CylinderPrimitiveShape::Normal(const Vec3f& p, Vec3f* n) const
74 {
75  m_cylinder.Normal(p, n);
76 }
77 
78 unsigned int CylinderPrimitiveShape::ConfidenceTests(unsigned int numTests,
79  float epsilon, float normalThresh, float rms, const PointCloud& pc,
81 {
82  return BasePrimitiveShape::ConfidenceTests< Cylinder >(numTests, epsilon,
83  normalThresh, rms, pc, indices);
84 }
85 
86 void CylinderPrimitiveShape::Description(std::string* s) const
87 {
88  *s = "Cylinder";
89 }
90 
91 bool CylinderPrimitiveShape::Fit(const PointCloud& pc, float epsilon,
92  float normalThresh, MiscLib::Vector< size_t >::const_iterator begin,
94 
95 {
96  Cylinder fit = m_cylinder;
97  if (fit.LeastSquaresFit(pc, begin, end))
98  {
99  m_cylinder = fit;
100  return true;
101  }
102  return false;
103 }
104 
106  float epsilon, float normalThresh,
109  std::pair< size_t, float >* score) const
110 {
111  Cylinder fit = m_cylinder;
112  if (fit.LeastSquaresFit(pc, begin, end))
113  {
114  score->first = -1;
115  return new CylinderPrimitiveShape(fit);
116  }
117  score->first = 0;
118  return NULL;
119 }
120 
122 {
123  return new CylinderLevMarFunc(m_cylinder);
124 }
125 
126 void CylinderPrimitiveShape::Serialize(std::ostream* o, bool binary) const
127 {
128  if (binary)
129  {
130  const char id = 2;
131  (*o) << id;
132  }
133  else
134  {
135  (*o) << "2" << " ";
136  }
137  m_cylinder.Serialize(binary, o);
138  if (!binary)
139  {
140  *o << std::endl;
141  }
142 }
143 
145 {
146  return m_cylinder.SerializedSize() + 1;
147 }
148 
149 void CylinderPrimitiveShape::Transform(float scale, const Vec3f& translate)
150 {
151  m_cylinder.Transform(scale, translate);
152 }
153 
155  const GfxTL::MatrixXX< 3, 3, float >& rot, const GfxTL::Vector3Df& trans)
156 {
157  m_cylinder.Transform(rot, trans);
158 }
159 
161 {
162  visitor->Visit(*this);
163 }
164 
167  MiscLib::Vector< size_t >::const_iterator end, float distThresh,
169 {
170  // sample the bounding box in parameter space at 25 locations
171  // these points are used to estimate the other shapes
172  // if the shapes succeed the suggestion is returned
173  MiscLib::Vector< Vec3f > samples(2 * 25);
174  float uStep = (m_extBbox.Max()[0] - m_extBbox.Min()[0]) / 4;
175  float vStep = (m_extBbox.Max()[1] - m_extBbox.Min()[1]) / 4;
176  float u = m_extBbox.Min()[0];
177  for (unsigned int i = 0; i < 5; ++i, u += uStep)
178  {
179  float v = m_extBbox.Min()[1];
180  for (unsigned int j = 0; j < 5; ++j, v += vStep)
181  InSpace(u, v * m_cylinder.Radius(), &samples[i * 5 + j],
182  &samples[i * 5 + j + 25]);
183  }
184  size_t c = samples.size() / 2;
185  // now check all the shape types
186  Sphere sphere;
187  if (sphere.Init(samples))
188  {
189  sphere.LeastSquaresFit(samples.begin(), samples.begin() + c);
190  bool failed = false;
191  for (size_t i = 0; i < c; ++i)
192  if (sphere.Distance(samples[i]) > distThresh)
193  {
194  failed = true;
195  break;
196  }
197  if (!failed)
198  {
199  suggestions->push_back(new SpherePrimitiveShape(sphere));
200  suggestions->back()->Release();
201  }
202  }
203  Plane plane;
204  if (plane.LeastSquaresFit(samples.begin(), samples.begin() + c))
205  {
206  bool failed = false;
207  for (size_t i = 0; i < c; ++i)
208  if (plane.Distance(samples[i]) > distThresh)
209  {
210  failed = true;
211  break;
212  }
213  if (!failed)
214  {
215  suggestions->push_back(new PlanePrimitiveShape(plane));
216  suggestions->back()->Release();
217  }
218  }
219  /*// We suggest a sphere if a curvature of radius along the height
220  // does not introduce too large an error
221  float length = m_extBbox.Max()[0] - m_extBbox.Min()[0];
222  float meanLength = (m_extBbox.Max()[0] + m_extBbox.Min()[0]) / 2;
223  float radiusDiff = (std::sqrt(m_cylinder.Radius() * m_cylinder.Radius()
224  + length * length / 4) - m_cylinder.Radius()) / 2;
225  float radialExtent = m_extBbox.Max()[1] - m_extBbox.Min()[1];
226  if(radiusDiff < distThresh)
227  {
228  // the center of the sphere is given as the point on the axis
229  // with the height of the mean length
230  Vec3f center = meanLength * m_cylinder.AxisDirection()
231  + m_cylinder.AxisPosition();
232  Sphere sphere(center, m_cylinder.Radius() + radiusDiff);
233  suggestions->push_back(new SpherePrimitiveShape(sphere));
234  suggestions->back()->Release();
235  }
236 
237  // We suggest a plane if the mean radius causes only a small error
238  // for this we need the angular extent in the curved direction of the cone
239  radiusDiff = (m_cylinder.Radius() - std::cos(radialExtent / 2)
240  * m_cylinder.Radius()) / 2;
241  if(radiusDiff < distThresh)
242  {
243  GfxTL::Vector2Df bboxCenter;
244  m_extBbox.Center(&bboxCenter);
245  Vec3f pos, normal;
246  InSpace(bboxCenter[0], bboxCenter[1] * m_cylinder.Radius(),
247  &pos, &normal);
248  // offset position
249  pos -= radiusDiff * normal;
250  Plane plane(pos, normal);
251  suggestions->push_back(new PlanePrimitiveShape(plane));
252  suggestions->back()->Release();
253  }*/
254 }
255 
256 bool CylinderPrimitiveShape::Similar(float tolerance,
257  const CylinderPrimitiveShape& shape) const
258 {
259  return m_cylinder.Radius() <= (1.f + tolerance) * shape.m_cylinder.Radius()
260  && (1.f + tolerance) * m_cylinder.Radius() >= shape.m_cylinder.Radius();
261 }
262 
264 {
265  return m_extBbox.Max()[0] - m_extBbox.Min()[0];
266 }
267 
269 {
270  return m_extBbox.Min()[0];
271 }
272 
274 {
275  return m_extBbox.Max()[0];
276 }
277 
279  std::pair< float, float >* param) const
280 {
281  m_cylinder.Parameters(p, param);
282  // convert angle to arc length
283  param->second *= m_cylinder.Radius();
284 }
285 
291  MiscLib::Vector< std::pair< float, float > >* bmpParams) const
292 {
293  ParametersImpl(begin, end, bmpParams);
294 }
295 
301  MiscLib::Vector< std::pair< float, float > >* bmpParams) const
302 {
303  ParametersImpl(begin, end, bmpParams);
304 }
305 
308  MiscLib::Vector< std::pair< float, float > >* params,
309  size_t* uextent, size_t* vextent)
310 {
311  *uextent = size_t(std::ceil(
312  (bbox->Max()[0] - bbox->Min()[0]) / epsilon));
313  *vextent = size_t(std::ceil((bbox->Max()[1] - bbox->Min()[1]) / epsilon));
314  if ((*vextent) * (*uextent) > 1e6)
315  {
316  // try to reparameterize
317  if (bbox->Min()[1] > epsilon && bbox->Max()[1] < 2 * M_PI * m_cylinder.Radius() - epsilon)
318  {
319  return; // there is no wrapping -> we can't do anything
320  }
321  MiscLib::Vector< float > angularParams(params->size());
322  for (size_t i = 0; i < params->size(); ++i)
323  {
324  angularParams[i] = (*params)[i].second;
325  }
326  std::sort(angularParams.begin(), angularParams.end());
327  // try to find a large gap
328  float maxGap = 0;
329  float lower, upper;
330  for (size_t i = 1; i < angularParams.size(); ++i)
331  {
332  float gap = angularParams[i] - angularParams[i - 1];
333  if (gap > maxGap)
334  {
335  maxGap = gap;
336  lower = angularParams[i - 1];
337  upper = angularParams[i];
338  }
339  }
340  if (maxGap > epsilon)
341  {
342  // reparameterize with new angular cut
343  float newCut = (lower + upper) / 2.f;
344  m_cylinder.RotateAngularDirection(newCut / m_cylinder.Radius());
345  bbox->Min()[1] = std::numeric_limits< float >::infinity();
346  bbox->Max()[1] = -std::numeric_limits< float >::infinity();
347  for (size_t i = 0; i < params->size(); ++i)
348  {
349  (*params)[i].second -= newCut;
350  if ((*params)[i].second < 0)
351  {
352  (*params)[i].second = 2 * M_PI * m_cylinder.Radius() + (*params)[i].second;
353  }
354  if ((*params)[i].second < bbox->Min()[1])
355  {
356  bbox->Min()[1] = (*params)[i].second;
357  }
358  if ((*params)[i].second > bbox->Max()[1])
359  {
360  bbox->Max()[1] = (*params)[i].second;
361  }
362  }
363  *vextent = size_t(std::ceil((bbox->Max()[1] - bbox->Min()[1]) / epsilon));
364  }
365  }
366 }
367 
368 void CylinderPrimitiveShape::InBitmap(const std::pair< float, float >& param,
369  float epsilon, const GfxTL::AABox< GfxTL::Vector2Df >& bbox,
370  size_t uextent, size_t vextent, std::pair< int, int >* inBmp) const
371 {
372  // convert the parameters to bitmap coordinates
373  inBmp->first = std::floor((param.first - bbox.Min()[0]) / epsilon);
374  inBmp->second = std::floor((param.second - bbox.Min()[1]) / epsilon);
375 }
377  const GfxTL::AABox< GfxTL::Vector2Df >& bbox, float epsilon, bool* uwrap,
378  bool* vwrap) const
379 {
380  *uwrap = false;
381  if (bbox.Max()[1] - bbox.Min()[1]
382  >= 2 * M_PI * m_cylinder.Radius() - 2 * epsilon)
383  {
384  *vwrap = true; // wrap around angular component
385  }
386  else
387  {
388  *vwrap = false;
389  }
390 }
391 
393  float epsilon, size_t uextent, size_t vextent, MiscLib::Vector< char >* bmp) const
394 {
395  // wraps the bitmpap around the v-axis
396  // note: we do not check, if the cylinder is really wrapped around !
397  // Use WrapBitmap for this check
398  for (int i = 0; i < uextent; i++)
399  {
400  char t = (*bmp)[i];
401  bmp->push_back(t);
402  }
403 }
404 
406  const GfxTL::AABox< GfxTL::Vector2Df >& extBbox,
407  const MiscLib::Vector< int >& componentsImg, size_t uextent,
408  size_t vextent, float epsilon, int label)
409 {
410  if (extBbox.Min()[1] * m_cylinder.Radius() <= epsilon
411  && extBbox.Max()[1] * m_cylinder.Radius()
412  >= 2 * M_PI * m_cylinder.Radius() - epsilon)
413  {
414  // component has been cut along angular direction
415  // run from both sides to find both ends
416  size_t row = 0, j = 0;
417  for (; j < vextent; ++j)
418  {
419  bool found = false;
420  for (size_t i = 0; i < uextent; ++i)
421  {
422  if (componentsImg[row + i] == label)
423  {
424  found = true;
425  break;
426  }
427  }
428  if (!found)
429  {
430  break;
431  }
432  row += uextent;
433  }
434  size_t maxj = j;
435  if (maxj == vextent) // cylinder is complete
436  {
437  m_clip = false;
438  return;
439  }
440  row = (vextent - 1) * uextent, j = 0;
441  for (; j < vextent; ++j)
442  {
443  bool found = false;
444  for (size_t i = 0; i < uextent; ++i)
445  {
446  if (componentsImg[row + i] == label)
447  {
448  found = true;
449  break;
450  }
451  }
452  if (!found)
453  {
454  break;
455  }
456  row -= uextent;
457  }
458  size_t minj = j;
459  // convert min and max to angular parameters
460  m_minPhi = minj * epsilon / m_cylinder.Radius() + extBbox.Min()[1];
461  m_maxPhi = maxj * epsilon / m_cylinder.Radius() + extBbox.Min()[1];
462  }
463  else
464  {
465  m_minPhi = extBbox.Min()[1];
466  m_maxPhi = extBbox.Max()[1];
467  }
468  m_clip = true;
469 }
470 
471 bool CylinderPrimitiveShape::InSpace(float u, float v, Vec3f* p, Vec3f* n) const
472 {
474  q.RotationRad(v / m_cylinder.Radius(), m_cylinder.AxisDirection()[0],
475  m_cylinder.AxisDirection()[1], m_cylinder.AxisDirection()[2]);
476  Vec3f vvec;
477  q.Rotate(m_cylinder.AngularDirection(), &vvec);
478  *p = u * m_cylinder.AxisDirection() + m_cylinder.Radius() * vvec
479  + m_cylinder.AxisPosition();
480  *n = vvec;
481  return true;
482 }
483 
484 bool CylinderPrimitiveShape::InSpace(size_t u, size_t v, float epsilon,
485  const GfxTL::AABox< GfxTL::Vector2Df >& bbox, size_t uextent,
486  size_t vextent, Vec3f* p, Vec3f* n) const
487 {
489  q.RotationRad((bbox.Min()[1] + epsilon * (v + .5f)) / m_cylinder.Radius(),
490  m_cylinder.AxisDirection()[0],
491  m_cylinder.AxisDirection()[1],
492  m_cylinder.AxisDirection()[2]);
493  Vec3f vvec;
494  q.Rotate(m_cylinder.AngularDirection(), &vvec);
495  *p = (bbox.Min()[0] + epsilon * (u + .5f)) * m_cylinder.AxisDirection() +
496  m_cylinder.Radius() * vvec + m_cylinder.AxisPosition();
497  *n = vvec;
498  return true;
499 }
GfxTL::IndexedIterator
Definition: IndexedIterator.h:8
PrimitiveShapeVisitor::Visit
virtual void Visit(const PlanePrimitiveShape &plane)=0
Cylinder::Radius
float Radius() const
Definition: Cylinder.cpp:309
LevMarFunc< float >
GfxTL::VectorXD
Definition: MatrixXX.h:21
GfxTL::AABox::Max
Point & Max()
Definition: AABox.hpp:74
SpherePrimitiveShape.h
MiscLib::Vector::begin
T * begin()
Definition: Vector.h:460
CylinderLevMarFunc
Definition: CylinderPrimitiveShape.h:134
PlanePrimitiveShape.h
Vec3f
Definition: basic.h:16
MiscLib::Vector::push_back
void push_back(const T &v)
Definition: Vector.h:346
Cylinder::SerializedSize
static size_t SerializedSize()
Definition: Cylinder.cpp:465
Performance.h
Cylinder::RotateAngularDirection
void RotateAngularDirection(float radians)
Definition: Cylinder.cpp:344
Cylinder::Serialize
void Serialize(bool binary, std::ostream *o) const
Definition: Cylinder.cpp:447
TorusPrimitiveShape.h
Sphere::Distance
float Distance(const Vec3f &p) const
Definition: Sphere.h:219
Cylinder::SignedDistance
float SignedDistance(const Vec3f &p) const
Definition: Cylinder.h:209
CylinderPrimitiveShape::Clone
PrimitiveShape * Clone() const
Definition: CylinderPrimitiveShape.cpp:31
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
Cylinder::AxisPosition
const Vec3f & AxisPosition() const
Definition: Cylinder.cpp:329
CylinderPrimitiveShape::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: CylinderPrimitiveShape.cpp:105
Cylinder::Parameters
void Parameters(const Vec3f &p, std::pair< float, float > *param) const
Definition: Cylinder.cpp:289
CylinderPrimitiveShape::MinHeight
float MinHeight() const
Definition: CylinderPrimitiveShape.cpp:268
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
PrimitiveShape
PrimtiveShape is a shape primitive in conjunction with a parametrization.
Definition: PrimitiveShape.h:32
CylinderPrimitiveShape::Normal
void Normal(const Vec3f &p, Vec3f *n) const
Definition: CylinderPrimitiveShape.cpp:73
GfxTL::Quaternion
Definition: VectorXD.h:707
GfxTL::MatrixXX
Definition: MatrixXX.h:25
CylinderPrimitiveShape::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: CylinderPrimitiveShape.cpp:405
CylinderPrimitiveShape::MaxHeight
float MaxHeight() const
Definition: CylinderPrimitiveShape.cpp:273
MiscLib::Vector< size_t >
PrimitiveShapeVisitor.h
Cylinder::Distance
float Distance(const Vec3f &p) const
Definition: Cylinder.h:180
CylinderPrimitiveShape::Init
bool Init(const Vec3f &pointA, const Vec3f &pointB, const Vec3f &normalA, const Vec3f &normalB)
Definition: CylinderPrimitiveShape.cpp:36
MiscLib::Vector< Point >::const_iterator
const typedef Point * const_iterator
Definition: Vector.h:26
CylinderPrimitiveShape::Transform
void Transform(float scale, const Vec3f &translate)
Definition: CylinderPrimitiveShape.cpp:149
Cylinder::AxisDirection
const Vec3f & AxisDirection() const
Definition: Cylinder.cpp:319
CylinderPrimitiveShape::SignedDistanceFunc
LevMarFunc< float > * SignedDistanceFunc() const
Definition: CylinderPrimitiveShape.cpp:121
CylinderPrimitiveShape::CylinderPrimitiveShape
CylinderPrimitiveShape()
Definition: CylinderPrimitiveShape.cpp:19
CylinderPrimitiveShape::PreWrapBitmap
void PreWrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, size_t uextent, size_t vextent, MiscLib::Vector< char > *bmp) const
Definition: CylinderPrimitiveShape.cpp:392
CylinderPrimitiveShape::Height
float Height() const
Definition: CylinderPrimitiveShape.cpp:263
CylinderPrimitiveShape::Similar
bool Similar(float tolerance, const CylinderPrimitiveShape &shape) const
Definition: CylinderPrimitiveShape.cpp:256
MiscLib::Vector::size
size_type size() const
Definition: Vector.h:212
CylinderPrimitiveShape::InSpace
bool InSpace(float u, float v, Vec3f *p, Vec3f *n) const
Definition: CylinderPrimitiveShape.cpp:471
M_PI
#define M_PI
Definition: MathTools.h:17
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
CylinderPrimitiveShape::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: CylinderPrimitiveShape.cpp:91
Plane::Distance
float Distance(const Vec3f &pos) const
Definition: Plane.h:34
CylinderPrimitiveShape::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: CylinderPrimitiveShape.cpp:368
CylinderPrimitiveShape
Definition: CylinderPrimitiveShape.h:11
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
Cylinder::Project
void Project(const Vec3f &p, Vec3f *pp) const
Definition: Cylinder.cpp:279
CylinderPrimitiveShape::Project
void Project(const Vec3f &p, Vec3f *pp) const
Definition: CylinderPrimitiveShape.cpp:68
PrimitiveShapeVisitor
Definition: PrimitiveShapeVisitor.h:14
MiscLib::performance_t
clock_t performance_t
Definition: Performance.h:27
CylinderPrimitiveShape::SerializedSize
size_t SerializedSize() const
Definition: CylinderPrimitiveShape.cpp:144
CylinderPrimitiveShape.h
SpherePrimitiveShape
class DLL_LINKAGE SpherePrimitiveShape
Definition: PrimitiveShapeVisitor.h:9
MiscLib::Vector::end
T * end()
Definition: Vector.h:470
BitmapPrimitiveShape::m_extBbox
GfxTL::AABox< GfxTL::Vector2Df > m_extBbox
Definition: BitmapPrimitiveShape.h:98
Cylinder::AngularDirection
const Vec3f AngularDirection() const
Definition: Cylinder.cpp:339
MiscLib::RefCountPtr< PrimitiveShape >
q
#define q
Cylinder::Transform
void Transform(float scale, const Vec3f &translate)
Definition: Cylinder.cpp:499
Sphere::Init
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition: Sphere.cpp:172
CylinderPrimitiveShape::Description
void Description(std::string *s) const
Definition: CylinderPrimitiveShape.cpp:86
CylinderPrimitiveShape::NormalDeviation
float NormalDeviation(const Vec3f &p, const Vec3f &n) const
Definition: CylinderPrimitiveShape.cpp:52
PointCloud
Definition: PointCloud.h:69
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
CylinderPrimitiveShape::DistanceAndNormalDeviation
void DistanceAndNormalDeviation(const Vec3f &p, const Vec3f &n, std::pair< float, float > *dn) const
Definition: CylinderPrimitiveShape.cpp:60
Vec3f::dot
float dot(const Vec3f &v) const
Definition: basic.h:92
CylinderPrimitiveShape::Visit
void Visit(PrimitiveShapeVisitor *visitor) const
Definition: CylinderPrimitiveShape.cpp:160
GfxTL::AABox::Min
Point & Min()
Definition: AABox.hpp:62
totalTime_cylinderConnected
MiscLib::performance_t totalTime_cylinderConnected
NullClass.h
CylinderPrimitiveShape::ConfidenceTests
unsigned int ConfidenceTests(unsigned int numTests, float epsilon, float normalThresh, float rms, const PointCloud &pc, const MiscLib::Vector< size_t > &indices) const
Definition: CylinderPrimitiveShape.cpp:78
Plane
Definition: Plane.h:16
ScoreComputer.h
Sphere
Definition: Sphere.h:27
CylinderPrimitiveShape::Identifier
size_t Identifier() const
Definition: CylinderPrimitiveShape.cpp:26
CylinderPrimitiveShape::SignedDistance
float SignedDistance(const Vec3f &p) const
Definition: CylinderPrimitiveShape.cpp:47
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
CylinderPrimitiveShape::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: CylinderPrimitiveShape.cpp:126
CylinderPrimitiveShape::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: CylinderPrimitiveShape.cpp:165
Cylinder
Definition: Cylinder.h:20
Cylinder::DistanceAndNormal
float DistanceAndNormal(const Vec3f &p, Vec3f *normal) const
Definition: Cylinder.h:196
ConePrimitiveShape.h
CylinderPrimitiveShape::WrapBitmap
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
Definition: CylinderPrimitiveShape.cpp:376
CylinderPrimitiveShape::Distance
float Distance(const Vec3f &p) const
Definition: CylinderPrimitiveShape.cpp:42
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
Cylinder::Init
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition: Cylinder.cpp:37
Cylinder::Normal
void Normal(const Vec3f &p, Vec3f *normal) const
Definition: Cylinder.h:188
CylinderPrimitiveShape::Parameters
void Parameters(const Vec3f &p, std::pair< float, float > *param) const
Definition: CylinderPrimitiveShape.cpp:278
CylinderPrimitiveShape::BitmapExtent
void BitmapExtent(float epsilon, GfxTL::AABox< GfxTL::Vector2Df > *bbox, MiscLib::Vector< std::pair< float, float > > *params, size_t *uextent, size_t *vextent)
Definition: CylinderPrimitiveShape.cpp:306