SpherePrimitiveShape.cpp
Go to the documentation of this file.
1 #include "SpherePrimitiveShape.h"
3 #include "Bitmap.h"
4 #include <GfxTL/AABox.h>
5 #include <GfxTL/NullClass.h>
6 #include <iostream>
7 #include <fstream>
8 #include <sstream>
9 #include "IndexIterator.h"
10 #include <GfxTL/KdTree.h>
14 #include <GfxTL/VectorKernel.h>
15 #include <GfxTL/NullTreeStrategy.h>
21 #include <GfxTL/L2Norm.h>
22 #include <GfxTL/NearestNeighbors.h>
23 #include <GfxTL/Mean.h>
24 #include <GfxTL/Covariance.h>
25 #include <GfxTL/IndexedIterator.h>
26 #include <GfxTL/Jacobi.h>
27 #include <MiscLib/Performance.h>
28 #include "PlanePrimitiveShape.h"
30 
32  : m_sphere(s)
33  , m_parametrization(m_sphere)
34 {}
35 
38  , m_sphere(sps.m_sphere)
39  , m_parametrization(sps.m_parametrization)
40 {
41  m_parametrization.Shape(m_sphere);
42 }
43 
45 {
46  return 1;
47 }
48 
49 bool SpherePrimitiveShape::Init(bool binary, std::istream* i)
50 {
51  // read the polygons but ignore them
52  GfxTL::AABox< GfxTL::Vector2Df > bboxUpper, bboxLower;
53  size_t upperuextent, uppervextent, loweruextent, lowervextent;
54  if (binary)
55  {
56  // read number of components
57  size_t size;
58  i->read((char*)&size, sizeof(size));
59  if (size)
60  {
61  // read upper bbox
62  i->read((char*)&bboxUpper, sizeof(bboxUpper));
63  // read upperuextent and uppervextent
64  i->read((char*)&upperuextent, sizeof(upperuextent));
65  i->read((char*)&uppervextent, sizeof(uppervextent));
66  for (size_t j = 0; j < size; ++j)
67  {
68  // read number of polys of component
69  size_t numPolys;
70  i->read((char*)&numPolys, sizeof(numPolys));
71  for (size_t k = 0; k < numPolys; ++k)
72  {
73  // read number of points in poly
74  size_t numPoints;
75  i->read((char*)&numPoints, sizeof(numPoints));
77  for (size_t l = 0; l < numPoints; ++l)
78  {
79  i->read((char*)&pp, sizeof(pp));
80  }
81  }
82  }
83  }
84  // do the same for lower bitmap
85  // read number of components
86  i->read((char*)&size, sizeof(size));
87  if (size)
88  {
89  // read lower bbox
90  i->read((char*)&bboxLower, sizeof(bboxLower));
91  // read loweruextent and lowervextent
92  i->read((char*)&loweruextent, sizeof(loweruextent));
93  i->read((char*)&lowervextent, sizeof(lowervextent));
94  for (size_t j = 0; j < size; ++j)
95  {
96  // read number of polys of component
97  size_t numPolys;
98  i->read((char*)&numPolys, sizeof(numPolys));
99  for (size_t k = 0; k < numPolys; ++k)
100  {
101  // read number of points in poly
102  size_t numPoints;
103  i->read((char*)&numPoints, sizeof(numPoints));
105  for (size_t l = 0; l < numPoints; ++l)
106  {
107  i->read((char*)&pp, sizeof(pp));
108  }
109  }
110  }
111  }
112  }
113  else
114  {
115  // read number of components
116  size_t size;
117  (*i) >> size;
118  if (size)
119  {
120  // read upper bbox
121  (*i) >> bboxUpper.Min()[0] >> bboxUpper.Max()[0]
122  >> bboxUpper.Min()[1] >> bboxUpper.Max()[1];
123  // read upperuextent and uppervextent
124  (*i) >> upperuextent >> uppervextent;
125  for (size_t j = 0; j < size; ++j)
126  {
127  // read number of polys of component
128  size_t numPolys;
129  (*i) >> numPolys;
130  for (size_t k = 0; k < numPolys; ++k)
131  {
132  // read number of points in poly
133  size_t numPoints;
134  (*i) >> numPoints;
136  for (size_t l = 0; l < numPoints; ++l)
137  {
138  (*i) >> pp[0] >> pp[1];
139  }
140  }
141  }
142  }
143  // read number of components
144  (*i) >> size;
145  if (size)
146  {
147  // read lower bbox
148  (*i) >> bboxLower.Min()[0] >> bboxLower.Max()[0]
149  >> bboxLower.Min()[1] >> bboxLower.Max()[1];
150  // read loweruextent and lowervextent
151  (*i) >> loweruextent >> lowervextent;
152  for (size_t j = 0; j < size; ++j)
153  {
154  // read number of polys of component
155  size_t numPolys;
156  (*i) >> numPolys;
157  for (size_t k = 0; k < numPolys; ++k)
158  {
159  // read number of points in poly
160  size_t numPoints;
161  (*i) >> numPoints;
163  for (size_t l = 0; l < numPoints; ++l)
164  {
165  (*i) >> pp[0] >> pp[1];
166  }
167  }
168  }
169  }
170  }
171  return true;
172 }
173 
175 {
176  return new SpherePrimitiveShape(*this);
177 }
178 
180 {
181  return m_sphere.Distance(p);
182 }
183 
185 {
186  return m_sphere.SignedDistance(p);
187 }
188 
190  const Vec3f& n) const
191 {
192  Vec3f normal;
193  m_sphere.Normal(p, &normal);
194  return n.dot(normal);
195 }
196 
198  const Vec3f& p, const Vec3f& n, std::pair< float, float >* dn) const
199 {
200  Vec3f normal;
201  dn->first = m_sphere.DistanceAndNormal(p, &normal);
202  dn->second = n.dot(normal);
203 }
204 
205 void SpherePrimitiveShape::Project(const Vec3f& p, Vec3f* pp) const
206 {
207  m_sphere.Project(p, pp);
208 }
209 
210 void SpherePrimitiveShape::Normal(const Vec3f& p, Vec3f* n) const
211 {
212  m_sphere.Normal(p, n);
213 }
214 
215 unsigned int SpherePrimitiveShape::ConfidenceTests(unsigned int numTests,
216  float epsilon, float normalThresh, float rms, const PointCloud& pc,
217  const MiscLib::Vector< size_t >& indices) const
218 {
219  return BasePrimitiveShape::ConfidenceTests< Sphere >(numTests, epsilon,
220  normalThresh, rms, pc, indices);
221 }
222 
223 void SpherePrimitiveShape::Description(std::string* s) const
224 {
225  *s = "Sphere";
226 }
227 
228 bool SpherePrimitiveShape::Fit(const PointCloud& pc, float epsilon,
229  float normalThresh, MiscLib::Vector< size_t >::const_iterator begin,
231 {
232  // do LS-fitting
233  Sphere fit = m_sphere;
234  if (fit.LeastSquaresFit(pc, begin, end))
235  {
236  m_sphere = fit;
237  m_parametrization.Shape(m_sphere);
238  return true;
239  }
240  return false;
241 }
242 
244  float normalThresh, MiscLib::Vector< size_t >::const_iterator begin,
246  std::pair< size_t, float >* score) const
247 {
248  // do LS-fitting
249  Sphere fit = m_sphere;
250  if (fit.LeastSquaresFit(pc, begin, end))
251  {
252  score->first = -1;
253  return new SpherePrimitiveShape(fit);
254  }
255  score->first = 0;
256  return NULL;
257 }
258 
259 void SpherePrimitiveShape::Serialize(std::ostream* o, bool binary) const
260 {
261  if (binary)
262  {
263  const char id = 1;
264  (*o) << id;
265  }
266  else
267  {
268  (*o) << "1" << " ";
269  }
270  m_sphere.Serialize(binary, o);
271  m_parametrization.Serialize(o, binary);
272  if (!binary)
273  {
274  *o << std::endl;
275  }
276 }
277 
278 void SpherePrimitiveShape::Deserialize(std::istream* i, bool binary)
279 {
280  m_sphere.Init(binary, i);
281  m_parametrization.Shape(m_sphere);
282  m_parametrization.Deserialize(i, binary);
283 }
284 
286 {
287  return m_sphere.SerializedSize()
288  + m_parametrization.SerializedSize() + 1;
289 }
290 
292 {
293  return new SphereLevMarFunc(m_sphere);
294 }
295 
296 void SpherePrimitiveShape::Transform(float scale, const Vec3f& translate)
297 {
298  m_sphere.Transform(scale, translate);
299 }
300 
302 {
303  visitor->Visit(*this);
304 }
305 
308  MiscLib::Vector< size_t >::const_iterator end, float distThresh,
310 {
311  // sample the bounding box in parameter space at 25 locations
312  // these points are used to estimate the other shapes
313  // if the shapes succeed the suggestion is returned
314  MiscLib::Vector< Vec3f > samples;
315  samples.resize(2 * 25);
316  size_t c = samples.size() / 2;
317  float uStep = (m_extBbox.Max()[0] - m_extBbox.Min()[0]) / 4;
318  float vStep = (m_extBbox.Max()[1] - m_extBbox.Min()[1]) / 4;
319  float u = m_extBbox.Min()[0];
320  for (unsigned int i = 0; i < 5; ++i, u += uStep)
321  {
322  float v = m_extBbox.Min()[1];
323  for (unsigned int j = 0; j < 5; ++j, v += vStep)
324  m_parametrization.InSpace(u, v,
325  &samples[i * 5 + j], &samples[i * 5 + j + c]);
326  }
327 
328  Plane plane;
329  if (plane.LeastSquaresFit(samples.begin(), samples.begin() + c))
330  {
331  bool failed = false;
332  for (size_t i = 0; i < c; ++i)
333  if (plane.Distance(samples[i]) > distThresh)
334  {
335  failed = true;
336  break;
337  }
338  if (!failed)
339  {
340  suggestions->push_back(new PlanePrimitiveShape(plane));
341  suggestions->back()->Release();
342  }
343  }
344 
345  /*// we suggest a plane if the radius is large enough so that the error
346  // along the two directions is less than distThresh
347  float ulength = 0, vlength = 0;
348  if(m_hasBitmap.first)
349  {
350  // has points on the upper side
351  ulength = m_extBboxUpper.Max()[0] - m_extBboxUpper.Min()[0];
352  vlength = m_extBboxUpper.Max()[1] - m_extBboxUpper.Min()[1];
353  }
354  if(m_hasBitmap.second)
355  {
356  ulength += m_extBboxLower.Max()[0] - m_extBboxLower.Min()[0];
357  vlength += m_extBboxLower.Max()[1] - m_extBboxLower.Min()[1];
358  }
359  float arcLength = M_PI * std::max(ulength, vlength);
360  float radiusDiff = (m_sphere.Radius() - std::sin(arcLength / 2)
361  * m_sphere.Radius()) / 2;
362  if(radiusDiff < distThresh)
363  {
364  Vec3f pos, normal;
365  SphereAsSquaresParametrization ssp(m_sphere, m_parametrizationNormal);
366  if(m_hasBitmap.first && m_hasBitmap.second)
367  {
368  GfxTL::Vector3Df center, eigenValues;
369  GfxTL::Mean(GfxTL::IndexIterate(begin, pc.begin()),
370  GfxTL::IndexIterate(end, pc.begin()), &center);
371  GfxTL::MatrixXX< 3, 3, float > cov, eigenVectors;
372  GfxTL::CovarianceMatrix(center, GfxTL::IndexIterate(begin, pc.begin()),
373  GfxTL::IndexIterate(end, pc.begin()), &cov);
374  GfxTL::Jacobi(cov, &eigenValues, &eigenVectors);
375  GfxTL::EigSortDesc(&eigenValues, &eigenVectors);
376  GfxTL::Vector3Df n = GfxTL::Vector3Df(eigenVectors[2]);
377  Plane plane(Vec3f(center.Data()), Vec3f(n.Data()));
378  suggestions->push_back(new PlanePrimitiveShape(plane));
379  suggestions->back()->Release();
380  }
381  else if(m_hasBitmap.first)
382  {
383  GfxTL::Vector2Df center;
384  m_extBboxUpper.Center(&center);
385  ssp.InSpace(std::make_pair(center[0], center[1]), false, &pos, &normal);
386  // offset position
387  pos -= radiusDiff * normal;
388  Plane plane(pos, normal);
389  suggestions->push_back(new PlanePrimitiveShape(plane));
390  suggestions->back()->Release();
391  }
392  else if(m_hasBitmap.second)
393  {
394  GfxTL::Vector2Df center;
395  m_extBboxUpper.Center(&center);
396  ssp.InSpace(std::make_pair(center[0], center[1]), true, &pos, &normal);
397  // offset position
398  pos -= radiusDiff * normal;
399  Plane plane(pos, normal);
400  suggestions->push_back(new PlanePrimitiveShape(plane));
401  suggestions->back()->Release();
402  }
403  }*/
404 }
405 
409 {
410  m_parametrization.Optimize(GfxTL::IndexIterate(begin, pc.begin()),
411  GfxTL::IndexIterate(end, pc.begin()), epsilon);
412 }
413 
415  size_t begin, size_t end, float epsilon)
416 {
417  m_parametrization.Optimize(GfxTL::IndexIterate(IndexIterator(begin), pc.begin()),
418  GfxTL::IndexIterate(IndexIterator(end), pc.begin()), epsilon);
419 }
420 
421 bool SpherePrimitiveShape::Similar(float tolerance,
422  const SpherePrimitiveShape& shape) const
423 {
424  return m_sphere.Radius() <= (1.f + tolerance) * shape.m_sphere.Radius()
425  && (1.f + tolerance) * m_sphere.Radius() >= shape.m_sphere.Radius();
426 }
427 
429  std::pair< float, float >* param) const
430 {
431  m_parametrization.Parameters(p, param);
432 }
433 
439  MiscLib::Vector< std::pair< float, float > >* bmpParams) const
440 {
441  ParametersImpl(begin, end, bmpParams);
442 }
443 
449  MiscLib::Vector< std::pair< float, float > >* bmpParams) const
450 {
451  ParametersImpl(begin, end, bmpParams);
452 }
453 
454 bool SpherePrimitiveShape::InSpace(float u, float v, Vec3f* p, Vec3f* n) const
455 {
456  return m_parametrization.InSpace(u, v, p, n);
457 }
458 
461  MiscLib::Vector< std::pair< float, float > >* params,
462  size_t* uextent, size_t* vextent)
463 {
464  *uextent = std::ceil((bbox->Max()[0] - bbox->Min()[0]) / epsilon);
465  *vextent = std::ceil((bbox->Max()[1] - bbox->Min()[1]) / epsilon);
466 }
467 
468 void SpherePrimitiveShape::InBitmap(const std::pair< float, float >& param,
469  float epsilon, const GfxTL::AABox< GfxTL::Vector2Df >& bbox,
470  size_t uextent, size_t vextent,
471  std::pair< int, int >* inBmp) const
472 {
473  inBmp->first = std::floor((param.first - bbox.Min()[0]) / epsilon);
474  inBmp->second = std::floor((param.second - bbox.Min()[1]) / epsilon);
475 }
476 
479  float epsilon, bool* uwrap, bool* vwrap) const
480 {
481  m_parametrization.WrapBitmap(bbox, epsilon, uwrap, vwrap);
482 }
483 
485  float epsilon, size_t uextent, size_t vextent,
486  MiscLib::Vector< int >* componentImg,
487  MiscLib::Vector< std::pair< int, size_t > >* labels) const
488 {
489  m_parametrization.WrapComponents(bbox, epsilon, uextent, vextent,
490  componentImg, labels);
491 }
492 
493 bool SpherePrimitiveShape::InSpace(size_t u, size_t v, float epsilon,
494  const GfxTL::AABox< GfxTL::Vector2Df >& bbox, size_t uextent,
495  size_t vextent, Vec3f* p, Vec3f* n) const
496 {
497  return m_parametrization.InSpace((u + .5f) * epsilon + bbox.Min()[0],
498  (v + .5f) * epsilon + bbox.Min()[1], p, n);
499 }
GfxTL::IndexedIterator
Definition: IndexedIterator.h:8
LowStretchSphereParametrization::InSpace
bool InSpace(float u, float v, Vec3f *p) const
Definition: LowStretchSphereParametrization.h:63
PrimitiveShapeVisitor::Visit
virtual void Visit(const PlanePrimitiveShape &plane)=0
CellBBoxBuildInformationKdTreeStrategy.h
SpherePrimitiveShape::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: SpherePrimitiveShape.cpp:243
LevMarFunc< float >
GfxTL::VectorXD
Definition: MatrixXX.h:21
IncrementalDistanceKdTreeStrategy.h
GfxTL::AABox::Max
Point & Max()
Definition: AABox.hpp:74
LowStretchSphereParametrization::WrapBitmap
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
Definition: LowStretchSphereParametrization.h:25
SpherePrimitiveShape.h
MiscLib::Vector::begin
T * begin()
Definition: Vector.h:460
SphereLevMarFunc
Definition: SpherePrimitiveShape.h:137
Mean.h
PlanePrimitiveShape.h
SpherePrimitiveShape::Distance
float Distance(const Vec3f &p) const
Definition: SpherePrimitiveShape.cpp:179
Vec3f
Definition: basic.h:16
Performance.h
Sphere::Distance
float Distance(const Vec3f &p) const
Definition: Sphere.h:219
SpherePrimitiveShape::Parameters
void Parameters(const Vec3f &p, std::pair< float, float > *param) const
Definition: SpherePrimitiveShape.cpp:428
SpherePrimitiveShape::InSpace
bool InSpace(float u, float v, Vec3f *p, Vec3f *n) const
Definition: SpherePrimitiveShape.cpp:454
SpherePrimitiveShape::Normal
void Normal(const Vec3f &p, Vec3f *n) const
Definition: SpherePrimitiveShape.cpp:210
SpherePrimitiveShape::Project
void Project(const Vec3f &p, Vec3f *pp) const
Definition: SpherePrimitiveShape.cpp:205
MiscLib::Vector::resize
void resize(size_type s, const value_type &v)
Definition: Vector.h:222
BucketSizeSubdivisionTreeStrategy.h
SpherePrimitiveShape::SpherePrimitiveShape
SpherePrimitiveShape()
Definition: SpherePrimitiveShape.h:24
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
Sphere::SerializedSize
static size_t SerializedSize()
Definition: Sphere.cpp:427
SpherePrimitiveShape::OptimizeParametrization
void OptimizeParametrization(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end, float epsilon)
Definition: SpherePrimitiveShape.cpp:406
Bitmap.h
BitmapPrimitiveShape
Definition: BitmapPrimitiveShape.h:30
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
PrimitiveShape
PrimtiveShape is a shape primitive in conjunction with a parametrization.
Definition: PrimitiveShape.h:32
SpherePrimitiveShape::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: SpherePrimitiveShape.cpp:259
NullTreeStrategy.h
SpherePrimitiveShape::ConfidenceTests
unsigned int ConfidenceTests(unsigned int numTests, float epsilon, float normalThresh, float rms, const PointCloud &pc, const MiscLib::Vector< size_t > &indices) const
Definition: SpherePrimitiveShape.cpp:215
MiscLib::Vector< size_t >
PrimitiveShapeVisitor.h
MiscLib::Vector< Point >::const_iterator
const typedef Point * const_iterator
Definition: Vector.h:26
SpherePrimitiveShape::Similar
bool Similar(float tolerance, const SpherePrimitiveShape &shape) const
Definition: SpherePrimitiveShape.cpp:421
SpherePrimitiveShape::Transform
void Transform(float scale, const Vec3f &translate)
Definition: SpherePrimitiveShape.cpp:296
MiscLib::Vector::size
size_type size() const
Definition: Vector.h:212
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
ImmediateTreeDataKernels.h
Plane::Distance
float Distance(const Vec3f &pos) const
Definition: Plane.h:34
LowStretchSphereParametrization::Serialize
void Serialize(std::ostream *o, bool binary) const
Definition: LowStretchSphereParametrization.cpp:112
KdTree.h
SpherePrimitiveShape::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: SpherePrimitiveShape.cpp:306
PrimitiveShapeVisitor
Definition: PrimitiveShapeVisitor.h:14
MiscLib::performance_t
clock_t performance_t
Definition: Performance.h:27
Sphere::Serialize
void Serialize(bool binary, std::ostream *o) const
Definition: Sphere.cpp:413
NearestNeighbors.h
SpherePrimitiveShape::SignedDistanceFunc
LevMarFunc< float > * SignedDistanceFunc() const
Definition: SpherePrimitiveShape.cpp:291
CellRangeDataTreeStrategy.h
GfxTL::IndexIterate
IndexedIterator< IndexIteratorT, IteratorT > IndexIterate(IndexIteratorT idxIt, IteratorT it)
Definition: IndexedIterator.h:154
IndexIterator.h
AABox.h
Covariance.h
LowStretchSphereParametrization::SerializedSize
static size_t SerializedSize()
Definition: LowStretchSphereParametrization.cpp:107
LowStretchSphereParametrization::Deserialize
void Deserialize(std::istream *i, bool binary)
Definition: LowStretchSphereParametrization.cpp:141
BitmapPrimitiveShape::m_extBbox
GfxTL::AABox< GfxTL::Vector2Df > m_extBbox
Definition: BitmapPrimitiveShape.h:98
Sphere::Normal
void Normal(const Vec3f &p, Vec3f *normal) const
Definition: Sphere.h:224
SpherePrimitiveShape::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: SpherePrimitiveShape.cpp:484
BBoxDistanceKdTreeStrategy.h
MiscLib::RefCountPtr< PrimitiveShape >
Sphere::Init
bool Init(const MiscLib::Vector< Vec3f > &samples)
Definition: Sphere.cpp:172
SpherePrimitiveShape::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: SpherePrimitiveShape.cpp:468
SpherePrimitiveShape::SignedDistance
float SignedDistance(const Vec3f &p) const
Definition: SpherePrimitiveShape.cpp:184
SpherePrimitiveShape::Description
void Description(std::string *s) const
Definition: SpherePrimitiveShape.cpp:223
IndexedIterator.h
totalTime_sphereConnected
MiscLib::performance_t totalTime_sphereConnected
PointCloud
Definition: PointCloud.h:69
SpherePrimitiveShape::Visit
void Visit(PrimitiveShapeVisitor *visitor) const
Definition: SpherePrimitiveShape.cpp:301
BBoxBuildInformationTreeStrategy.h
LowStretchSphereParametrization::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: LowStretchSphereParametrization.cpp:17
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
SpherePrimitiveShape::WrapBitmap
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
Definition: SpherePrimitiveShape.cpp:477
Sphere::DistanceAndNormal
float DistanceAndNormal(const Vec3f &p, Vec3f *normal) const
Definition: Sphere.h:230
Jacobi.h
SpherePrimitiveShape::BitmapExtent
void BitmapExtent(float epsilon, GfxTL::AABox< GfxTL::Vector2Df > *bbox, MiscLib::Vector< std::pair< float, float > > *params, size_t *uextent, size_t *vextent)
Definition: SpherePrimitiveShape.cpp:459
Vec3f::dot
float dot(const Vec3f &v) const
Definition: basic.h:92
L2Norm.h
VectorKernel.h
GfxTL::AABox::Min
Point & Min()
Definition: AABox.hpp:62
SpherePrimitiveShape::NormalDeviation
float NormalDeviation(const Vec3f &p, const Vec3f &n) const
Definition: SpherePrimitiveShape.cpp:189
NullClass.h
LowStretchSphereParametrization::Shape
void Shape(const Sphere &sphere)
Definition: LowStretchSphereParametrization.cpp:11
SpherePrimitiveShape::SerializedSize
size_t SerializedSize() const
Definition: SpherePrimitiveShape.cpp:285
LowStretchSphereParametrization::Optimize
void Optimize(IteratorT begin, IteratorT end, float epsilon)
Definition: LowStretchSphereParametrization.h:96
Plane
Definition: Plane.h:16
SpherePrimitiveShape::Clone
PrimitiveShape * Clone() const
Definition: SpherePrimitiveShape.cpp:174
Sphere
Definition: Sphere.h:27
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
Sphere::Project
void Project(const Vec3f &p, Vec3f *pp) const
Definition: Sphere.cpp:338
SpherePrimitiveShape
Definition: SpherePrimitiveShape.h:19
SpherePrimitiveShape::Init
bool Init(bool binary, std::istream *i)
Definition: SpherePrimitiveShape.cpp:49
SpherePrimitiveShape::DistanceAndNormalDeviation
void DistanceAndNormalDeviation(const Vec3f &p, const Vec3f &n, std::pair< float, float > *dn) const
Definition: SpherePrimitiveShape.cpp:197
MaxIntervalSplittingKdTreeStrategy.h
SpherePrimitiveShape::Deserialize
void Deserialize(std::istream *i, bool binary)
Definition: SpherePrimitiveShape.cpp:278
LowStretchSphereParametrization::Parameters
void Parameters(const Vec3f &p, std::pair< float, float > *param) const
Definition: LowStretchSphereParametrization.h:46
SpherePrimitiveShape::Identifier
size_t Identifier() const
Definition: SpherePrimitiveShape.cpp:44
SpherePrimitiveShape::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: SpherePrimitiveShape.cpp:228
Sphere::Radius
float Radius() const
Definition: Sphere.cpp:351
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
Sphere::Transform
void Transform(float scale, const Vec3f &translate)
Definition: Sphere.cpp:454
Sphere::SignedDistance
float SignedDistance(const Vec3f &p) const
Definition: Sphere.h:241