64 typedef typename DSL::Point
Point;
65 typedef typename DSL::Vector
Vector;
66 typedef typename DSL::Integer
Integer;
67 typedef typename DSL::Position Position;
69 unsigned int nbok = 0;
72 trace.beginBlock (
"One simple test..." );
74 trace.info() << aDSL << std::endl;
77 Position l = (2*aDSL.patternLength());
78 std::vector<Point> lch, uch;
80 std::back_inserter(uch), std::back_inserter(lch) );
82 if (v ==
Vector(aDSL.b(),aDSL.a()))
85 trace.info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
86 if ( aDSL.remainder(lch.back()) == aDSL.mu()-1 )
89 trace.info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
90 if ( aDSL.remainder(uch.back()) == aDSL.mu() )
93 trace.info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
97 unsigned int threshold = (
unsigned int) std::ceil( std::log(bound) / std::log(1.618) );
98 if ( (lch.size()+uch.size()-1) <= threshold )
101 trace.info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
201 typedef typename DSL::Point
Point;
202 typedef typename DSL::Vector
Vector;
205 unsigned int nbok = 0;
208 trace.beginBlock (
"Comparison ..." );
211 trace.info() << a <<
" " << b << std::endl;
212 trace.info() <<
"testing every mu between 0 and -" << inputDSL.omega() << std::endl;
214 for (
typename DSL::Integer mu = 0; ( (mu-1 >= -inputDSL.omega())&&(nbok == nb) ); --mu)
216 trace.info() <<
"mu=" << mu <<
", testing every length between 1 and 2*" << inputDSL.omega() << std::endl;
217 inputDSL = DSL(a,b,mu);
219 for (
typename DSL::Position l = 1; ( (l <= 2*inputDSL.patternLength())&&(nbok == nb) ); ++l)
224 std::vector<Point> lch, uch;
226 std::back_inserter(uch), std::back_inserter(lch) );
233 Vector shift = -inputDSL.shift();
238 typename CIP::HalfSpace line(
typename CIP::Vector(a,-b), mu );
239 typename CIP::HalfSpace line2(
typename CIP::Vector(a,-b), mu-1 );
244 typename CIP::HalfSpace constraint(
typename CIP::Vector(shift[1],-shift[0]), l );
245 std::vector<typename CIP::Point> inch, outch, inch2, outch2;
246 inch.push_back(
typename CIP::Point(shift[0],shift[1]) );
247 inch2.push_back(
typename CIP::Point(shift[0],shift[1]) );
248 ASSERT( line(inch[0]) );
249 ASSERT( constraint(inch[0]) );
250 outch.push_back(
typename CIP::Point(0,0) );
251 outch2.push_back(
typename CIP::Point(0,0) );
252 ASSERT( (!line2(outch[0])) );
253 ASSERT( constraint(outch[0]) );
254 typename CIP::Vector vBezout(1,0);
255 cip.getAllPointsOfHull(inch, outch, vBezout, line, constraint);
256 cip.getAllPointsOfHull(inch2, outch2, vBezout, line2, constraint);
264 std::unique(inch2.begin(), inch2.end());
265 if (std::equal(lch.begin(), lch.end(), inch2.begin()))
269 std::unique(outch.begin(), outch.end());
270 if (std::equal(uch.begin(), uch.end(), outch.begin()))
318 typename DSL::Position x,
typename DSL::Position y)
322 typedef typename DSL::Point
Point;
323 typedef typename DSL::Vector
Vector;
324 typedef typename DSL::Integer
Integer;
326 Point startingPoint = aDSL.getPoint(x);
329 std::vector<Point> lch, uch;
331 std::back_inserter(uch), std::back_inserter(lch) );
334 Point upperLeaningPoint = uch.back();
336 -
static_cast<Integer>(upperLeaningPoint[1])*
static_cast<Integer>(v[0]));
339 return DSL( v[1],v[0],intercept );
356 typename DSL::Position x,
typename DSL::Position y)
360 typedef typename DSL::Point
Point;
362 typedef typename DSL::Integer
Integer;
366 Point startingPoint = aDSL.getPoint(x);
367 ASSERT( aDSL(startingPoint) );
368 Point endingPoint = aDSL.getPoint(y);
369 ASSERT( aDSL(endingPoint) );
376 for (++it; (it != ite); ++it)
378 dss.extendFront(*it);
382 return DSL(dss.a(), dss.b(), dss.mu());
497 typedef typename DSL::Point
Point;
498 typedef typename DSL::Vector
Vector;
500 typedef typename DSL::Integer
Integer;
501 typedef typename DSL::Position Position;
503 unsigned int nbok = 0;
506 trace.beginBlock (
"One simple test..." );
511 Position l = (2*aDSL.patternLength());
512 Point B = aDSL.getPoint( aDSL.position(
A) + l + 1 );
513 DSS dss(aDSL.begin(
A), aDSL.begin(
B) );
515 trace.info() << dss << std::endl;
518 std::vector<Point> lch, uch;
520 std::back_inserter(uch), std::back_inserter(lch) );
522 trace.info() << v << lch.back() << uch.back() << std::endl;
524 if ( (uch.back() ==
A) && (lch.back() ==
A - aDSL.shift()) )
527 trace.info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
529 Vector LU = lch.back() - uch.back();
533 trace.info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
623 typename DSS::Position aBound)
625 ASSERT( (aBound - aDSS.position(aDSS.back())) > 0 );
627 typedef typename DSS::Point
Point;
628 typedef typename DSS::Vector
Vector;
629 typedef typename DSS::Integer
Integer;
630 typedef typename DSS::DSL DSL;
632 Point startingPoint = aDSS.dsl().getPoint(aBound);
635 std::vector<Point> lch, uch;
637 std::back_inserter(uch), std::back_inserter(lch) );
640 Point upperLeaningPoint = uch.back();
642 -
static_cast<Integer>(upperLeaningPoint[1])*
static_cast<Integer>(v[0]));
645 return DSL( v[1],v[0],intercept );
680 unsigned int nbok = 0;
683 trace.beginBlock (
"Subsegment comparison ..." );
686 for (
typename DSL::Integer mu = 0; ( (mu-1 >= -aDSL.omega())&&(nbok == nb) ); --mu)
688 trace.info() <<
"mu=" << mu << std::endl;
691 typedef typename DSL::Point
Point;
693 typedef typename DSL::Integer
Integer;
696 Point startingPoint = aDSL.getPoint(0);
697 ASSERT( aDSL(startingPoint) );
698 Point endingPoint = aDSL.getPoint(2*aDSL.patternLength()+1);
699 ASSERT( aDSL(endingPoint) );
701 DSS dss = DSS(aDSL.begin(startingPoint), aDSL.begin(endingPoint));
704 for (
typename DSL::Position l = 1; ( (l <= 2*aDSL.patternLength())&&(nbok == nb) ); ++l)
706 trace.info() <<
"l=" << l << std::endl;
PointVector smartCH(const PointVector &aFirstPoint, const Coordinate &aRemainderBound, const Position &aPositionBound, const PointVector &aStep, const Coordinate &aRStep, const PointVector &aShift, const Coordinate &aRShift, const PositionFunctor &aPositionFunctor, OutputIterator uIto, OutputIterator lIto)
Procedure that computes the lower and upper left hull of a DSS of first point aFirstPoint,...
PointVector reversedSmartCH(PointVector U, PointVector L, PointVector V, const Position &aFirstPosition, const Position &aLastPosition, const PositionFunctor &aPositionFunctor, OutputIterator uIto, OutputIterator lIto)
Procedure that computes the lower and upper left hull of the left subsegment of a greater DSS charact...