DGtal  1.2.beta
examplePlaneProbingParallelepipedEstimator.cpp
Go to the documentation of this file.
1 
30 #include <iostream>
32 #include "ConfigExamples.h"
33 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/base/Common.h"
35 #include "DGtal/geometry/surfaces/DigitalPlanePredicate.h"
36 #include "DGtal/geometry/surfaces/estimation/PlaneProbingParallelepipedEstimator.h"
38 
39 using namespace std;
40 using namespace DGtal;
41 
44 using Integer = Point::Coordinate;
47 
49 
50 int main(int argc, const char** argv)
51 {
52  const int height = (argc > 1) ? std::atoi(argv[1]) : 2;
53  std::cout << "height=" << height << std::endl;
54 
55  Vector n(2, 6, 15);
56 
57  DigitalPlane plane(n, -height, n.norm1());
58  Point o(0, 0, 0);
59  Integer bound = n.norm1() + 1;
60  std::array<Point, 3> m = { Point(1, 0, 0), Point(0, 1, 0), Point(0, 0, 1) };
61  Estimator estimator(o, m, plane, bound);
62 
63  int it = 0;
64  while (estimator.advance()) {
65  it++;
66 
67  std::cout << "state=" << estimator.getState() << ", isInReverseState=" << estimator.isInReverseState() << std::endl;
68 
69  std::clog << "it = " << it << " "
70  << estimator.m(0) << " " << estimator.m(1) << " " << estimator.m(2) << " "
71  << estimator.getNormal() << std::endl;
72  }
73 
74  ASSERT(estimator.getNormal() == n);
75 
76  return 0;
77 }
78 // //
DigitalPlane::Vector Point
STL namespace.
Aim: Representing digital planes, which are digitizations of Euclidean planes, as point predicates...
bool advance(std::vector< PointOnProbingRay > const &aNeighbors)
DGtal is the top-level namespace which contains all DGtal functions and types.
MyPointD Point
Definition: testClone2.cpp:383
int main(int argc, const char **argv)
FreemanChain< int >::Vector Vector