38 #include "DGtal/base/Common.h"
39 #include "DGtal/kernel/PointVector.h"
41 using namespace DGtal;
78 const double t[ ] = { 3.5, 4.1, 2.2, 3.2 };
81 #ifdef CPP11_INITIALIZER_LIST
87 trace.
info()<<
"v == v2 (true)"<<std::endl;
89 trace.
info()<<
"v == v2 (false)"<<std::endl;
91 #ifdef CPP11_INITIALIZER_LIST
93 trace.
info()<<
"v == v3 (true)"<<std::endl;
95 trace.
info()<<
"v == v3 (false)"<<std::endl;
99 trace.
info()<<
"v < v2 (true)"<<std::endl;
101 trace.
info()<<
"v < v2 (false)"<<std::endl;
106 return ((v == v2) && !(v != v2));
113 const double t[ ] = { 3.5, 4.1, 2.2, 3.2 };
117 trace.
info() <<
" Vector: "<< v<<std::endl;
118 trace.
info() <<
"max val = "<< v.max() <<std::endl;
119 trace.
info()<<
"min val = "<<v.min() << std::endl;
120 trace.
info() <<
"maxElement val = "<< *v.maxElement() <<std::endl;
121 trace.
info()<<
"minElement val = "<<*v.minElement() << std::endl;
123 return ((v.max() == 4.1) && (v.min()==2.2));
130 bool testSimplePoint()
134 int t[]={-3 ,4 ,4 ,0};
140 cout <<
"aPoint=" << aPoint << endl;
143 trace.
info() <<
"aPoint dimension="<<aPoint.dimension <<endl;
146 if ( aPoint.dimension != 4 )
149 int tt[] = { 3, 4, 2, 2 };
151 aPoint = aFPoint + v;
153 trace.
info() <<
"aPoint = "<< aFPoint <<
" + " << v << endl;
154 trace.
info() <<
"aPoint = "<< aPoint << endl;
166 aPoint.at ( 1 ) = -1;
170 trace.
info() <<
"aPoint l_2 norm="<<aPoint.norm() <<endl;
171 trace.
info() <<
"aPoint l_1 norm="<<aPoint.norm ( PointType::L_1 ) <<endl;
172 trace.
info() <<
"aPoint l_infty norm="<<aPoint.norm ( PointType::L_infty ) <<endl;
174 trace.
info() <<
"Normalization="<<aPoint.getNormalized () <<endl;
179 return ( ( aPoint.norm ( PointType::L_1 ) == 6 ) &&
180 ( aPoint.norm ( PointType::L_infty ) == 3 ) );
188 bool testSimpleVector()
196 trace.
info() <<
"aVector = "<< aVector <<endl;
215 for (
unsigned int i=0;i<25;++i)
217 trace.
info() <<
"aPoint="<<aPoint<< std::endl;
239 trace.
info() <<
"p1: "<<p1 <<
", "<<
"p2: "<<p2 <<std::endl;
240 trace.
info() <<
"p1+p2: "<<p1+p2 <<std::endl;
241 trace.
info() <<
"p1*2+p2: "<<p1*2+p2 <<std::endl;
242 trace.
info() <<
"p1-p2: "<<p1-p2 <<std::endl;
243 trace.
info() <<
"inf(p1,p2): "<<p1.inf(p2) <<std::endl;
244 trace.
info() <<
"sup(p1,p2): "<<p1.sup(p2) <<std::endl;
245 trace.
info() <<
"p1 dot p2: "<<p1.dot(p2) <<std::endl;
252 bool testIntegerNorms()
254 unsigned int nbok = 0;
264 trace.
info() <<
"p1: "<<p1 <<
", "<<
"p2: "<<p2 <<std::endl;
265 nbok += p.
norm1() == 8 ? 1 : 0;
267 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
268 <<
"L1(p2-p1): "<< p.
norm1() <<
"( == 8 ?)" << std::endl;
271 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
282 res = testSimplePoint()
283 && testSimpleVector()
288 && testIntegerNorms()