76{
78
79 trace.beginBlock (
"Testing class COBANaivePlaneComputer" );
80
81 unsigned int nbok = 0;
82 unsigned int nb = 0;
83
85 typedef PlaneComputer::Primitive Primitive;
86 PlaneComputer plane;
87
88 plane.
init( 2, 100, 1, 1 );
90 bool pt0_inside = plane.extend( pt0 );
91 trace.info() <<
"(" << nbok <<
"/" << nb <<
") Plane=" << plane
92 << std::endl;
94 bool pt1_inside = plane.extend( pt1 );
95 ++nb, nbok += pt1_inside == true ? 1 : 0;
96 trace.info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt1
97 << " Plane=" << plane << std::endl;
99 bool pt2_inside = plane.extend( pt2 );
100 ++nb, nbok += pt2_inside == true ? 1 : 0;
101 trace.info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt2
102 << " Plane=" << plane << std::endl;
103
104 Point pt3( 0, 5, 12 );
105 bool pt3_inside = plane.extend( pt3 );
106 ++nb, nbok += pt3_inside == false ? 1 : 0;
107 trace.info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt3
108 << " Plane=" << plane << std::endl;
109
110 Point pt4( -5, -5, 10 );
111 bool pt4_inside = plane.extend( pt4 );
112 ++nb, nbok += pt4_inside == false ? 1 : 0;
113 trace.info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt4
114 << " Plane=" << plane << std::endl;
115
116 Point pt5 = pt0 + pt1 + pt2 +
Point( 0, 0, 1 );
117 bool pt5_inside = plane.extend( pt5 );
118 ++nb, nbok += pt5_inside == true ? 1 : 0;
119 trace.info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt5
120 << " Plane=" << plane << std::endl;
121
123 bool pt6_inside = plane.extend( pt6 );
124 ++nb, nbok += pt6_inside == true ? 1 : 0;
125 trace.info() <<
"(" << nbok <<
"/" << nb <<
") add " << pt5
126 << " Plane=" << plane << std::endl;
127
128 Primitive strip = plane.primitive();
129 trace.info() <<
"strip=" << strip
130 << " axis=" << strip.mainAxis()
131 << " axiswidth=" << strip.axisWidth()
132 << " diag=" << strip.mainDiagonal()
133 << " diagwidth=" << strip.diagonalWidth()
134 << std::endl;
135 ++nb, nbok += strip.axisWidth() < 1.0 ? 1 : 0;
136 trace.info() <<
"(" << nbok <<
"/" << nb <<
") axiswidth < 1 "
137 << std::endl;
138 ++nb, nbok += strip.diagonalWidth() < sqrt(3.0) ? 1 : 0;
139 trace.info() <<
"(" << nbok <<
"/" << nb <<
") axiswidth < sqrt(3) "
140 << std::endl;
141 trace.emphase() << ( nbok == nb ?
"Passed." :
"Error." ) << endl;
143
145 Color red( 255, 0, 0 );
146 Color green( 0, 255, 0 );
147 Color grey( 200, 200, 200 );
149 viewer << grey;
150 viewer << ( pt0_inside ? green : red ) << pt0;
151 viewer << ( pt1_inside ? green : red ) << pt1;
152 viewer << ( pt2_inside ? green : red ) << pt2;
153 viewer << ( pt3_inside ? green : red ) << pt3;
154 viewer << ( pt4_inside ? green : red ) << pt4;
155 viewer << ( pt5_inside ? green : red ) << pt5;
156 viewer << ( pt6_inside ? green : red ) << pt6;
157 viewer << grey;
159
161 return 0;
162}
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.
void show() override
Starts the event loop and display of elements.
Z3i this namespace gathers the standard of types for 3D imagery.
void displayPredicate(Viewer3D &viewer, const Domain &domain, const Predicate &pred)