32 #include "DGtal/base/Common.h"
34 #include "DGtal/kernel/PointVector.h"
35 #include "DGtal/geometry/tools/PolarPointComparatorBy2x2DetComputer.h"
39 using namespace DGtal;
49 unsigned int nbok = 0;
61 trace.
info() <<
"same half-plane" << endl;
65 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
70 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
75 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
80 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
83 trace.
info() <<
"different half-plane" << endl;
87 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
92 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
95 trace.
info() <<
"y-coordinate == 0" << endl;
99 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
104 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
109 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
114 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
117 trace.
info() <<
"aligned points" << endl;
121 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
126 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
131 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
134 trace.
info() <<
"aligned points on the horizontal axis" << endl;
138 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
143 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
148 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
153 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
158 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
163 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
166 trace.
info() <<
"point equality" << endl;
170 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
175 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
180 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
192 unsigned int nbok = 0;
200 std::vector<Point> g, v;
202 v.push_back(
Point(3,4) );
203 v.push_back(
Point(5,0) );
204 v.push_back(
Point(4,3) );
205 v.push_back(
Point(0,5) );
206 v.push_back(
Point(-3,-4) );
207 v.push_back(
Point(-5,0) );
208 v.push_back(
Point(-4,-3) );
209 v.push_back(
Point(0,-5) );
210 v.push_back(
Point(3,-4) );
211 v.push_back(
Point(4,-3) );
212 v.push_back(
Point(-3,4) );
213 v.push_back(
Point(-4,3) );
215 g.push_back(
Point(5,0) );
216 g.push_back(
Point(4,3) );
217 g.push_back(
Point(3,4) );
218 g.push_back(
Point(0,5) );
219 g.push_back(
Point(-3,4) );
220 g.push_back(
Point(-4,3) );
221 g.push_back(
Point(-5,0) );
222 g.push_back(
Point(-4,-3) );
223 g.push_back(
Point(-3,-4) );
224 g.push_back(
Point(0,-5) );
225 g.push_back(
Point(3,-4) );
226 g.push_back(
Point(4,-3) );
230 std::sort(v.begin(), v.end(), comp);
231 std::copy(v.begin(), v.end(), ostream_iterator<Point>( std::cout,
" " ) );
232 std::cout << std::endl;
234 if ( std::equal(v.begin(), v.end(), g.begin()) )
237 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
241 std::sort(v.begin(), v.end(), comp);
242 std::copy(v.begin(), v.end(), ostream_iterator<Point>( std::cout,
" " ) );
243 std::cout << std::endl;
245 if ( std::equal(v.begin(), v.end(), g.begin()) )
248 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << endl;
258 int main(
int argc,
char** argv )
260 trace.
beginBlock (
"Testing class PolarPointComparatorBy2x2DetComputer" );
262 for (
int i = 0; i < argc; ++i )
269 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: Implements basic operations that will be used in Point and Vector classes.
void beginBlock(const std::string &keyword="")
Aim: Class that implements a binary point predicate, which is able to compare the position of two giv...
void setPole(const Point &aPole)
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
bool testPolarPointComparatorBy2x2DetComputer()