51 #include "DGtal/base/Common.h"
52 #include "DGtal/helpers/StdDefs.h"
53 #include "DGtal/io/viewers/Viewer3D.h"
54 #include "DGtal/geometry/surfaces/COBANaivePlaneComputer.h"
58 using namespace DGtal;
62 template <
typename Viewer3D,
typename Domain,
typename Predicate>
75 int main(
int argc,
char** argv )
79 QApplication application(argc,argv);
82 unsigned int nbok = 0;
86 typedef PlaneComputer::Primitive Primitive;
89 plane.
init( 2, 100, 1, 1 );
91 bool pt0_inside = plane.extend( pt0 );
92 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") Plane=" << plane
95 bool pt1_inside = plane.extend( pt1 );
96 ++nb, nbok += pt1_inside ==
true ? 1 : 0;
97 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt1
98 <<
" Plane=" << plane << std::endl;
100 bool pt2_inside = plane.extend( pt2 );
101 ++nb, nbok += pt2_inside ==
true ? 1 : 0;
102 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt2
103 <<
" Plane=" << plane << std::endl;
105 Point pt3( 0, 5, 12 );
106 bool pt3_inside = plane.extend( pt3 );
107 ++nb, nbok += pt3_inside ==
false ? 1 : 0;
108 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt3
109 <<
" Plane=" << plane << std::endl;
111 Point pt4( -5, -5, 10 );
112 bool pt4_inside = plane.extend( pt4 );
113 ++nb, nbok += pt4_inside ==
false ? 1 : 0;
114 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt4
115 <<
" Plane=" << plane << std::endl;
117 Point pt5 = pt0 + pt1 + pt2 +
Point( 0, 0, 1 );
118 bool pt5_inside = plane.extend( pt5 );
119 ++nb, nbok += pt5_inside ==
true ? 1 : 0;
120 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt5
121 <<
" Plane=" << plane << std::endl;
124 bool pt6_inside = plane.extend( pt6 );
125 ++nb, nbok += pt6_inside ==
true ? 1 : 0;
126 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt5
127 <<
" Plane=" << plane << std::endl;
129 Primitive strip = plane.primitive();
131 <<
" axis=" << strip.mainAxis()
132 <<
" axiswidth=" << strip.axisWidth()
133 <<
" diag=" << strip.mainDiagonal()
134 <<
" diagwidth=" << strip.diagonalWidth()
136 ++nb, nbok += strip.axisWidth() < 1.0 ? 1 : 0;
137 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") axiswidth < 1 "
139 ++nb, nbok += strip.diagonalWidth() < sqrt(3.0) ? 1 : 0;
140 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") axiswidth < sqrt(3) "
142 trace.
emphase() << ( nbok == nb ?
"Passed." :
"Error." ) << endl;
148 Color red( 255, 0, 0 );
149 Color green( 0, 255, 0 );
150 Color grey( 200, 200, 200 );
162 viewer << MyViewer::updateDisplay;
165 return application.exec();
Aim: A class that contains the COBA algorithm (Emilie Charrier, Lilian Buzer, DGCI2008) for recognizi...
void init(Dimension axis, InternalInteger diameter, InternalInteger widthNumerator=NumberTraits< InternalInteger >::ONE, InternalInteger widthDenominator=NumberTraits< InternalInteger >::ONE)
Structure representing an RGB triple with alpha component.
Iterator for HyperRectDomain.
const ConstIterator & end() const
const ConstIterator & begin() const
void beginBlock(const std::string &keyword="")
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
void displayPredicate(Viewer3D &viewer, const Domain &domain, const Predicate &pred)