42 template <
typename Shape>
45 const Point & firstPoint,
46 const Point & secondPoint,
47 const Shape & aShape ): myShape(aShape)
50 myQHull.push_front(secondPoint);
55 template <
typename Shape>
61 template <
typename Shape>
69 template <
typename Shape>
83 template <
typename Shape>
88 if ( (std::equal(myPHull.begin(),myPHull.end(),other.
myPHull.begin())
89 &&std::equal(myQHull.begin(),myQHull.end(),other.
myQHull.begin()))
90 || (std::equal(myPHull.begin(),myPHull.end(),other.
myPHull.rbegin())
91 &&std::equal(myQHull.begin(),myQHull.end(),other.
myQHull.rbegin()))
98 template <
typename Shape>
103 return !(*
this == other);
106 template <
typename Shape>
118 myShape.init(*PHullBack, *QHullFront);
124 template <
typename Shape>
136 myShape.init(*QHullFront, *PHullBack);
142 template <
typename Shape>
154 myShape.init(*QHullBack, *PHullFront);
160 template <
typename Shape>
172 myShape.init(*PHullFront, *QHullBack);
178 template <
typename Shape>
192 myShape.init(*PHullBack, *QHullFront);
194 myShape.init(*QHullBack, *PHullFront);
197 return ( p1(aP) && p2(aQ) );
200 template <
typename Shape>
215 myShape.init(*PHullFront, *QHullBack);
217 myShape.init(*QHullFront, *PHullBack);
220 return ( p1(aP) && p2(aQ) );
224 template <
typename Shape>
241 myShape.init(*PHullBack, *QHullFront);
243 myShape.init(*QHullBack, *PHullFront);
246 if ( p1(aP) && p2(aQ) ) {
250 update<ForwardIterator,FrontPHullUpdatePred>
251 (aP, myPHull, PHullFront, myPHull.end());
254 if (aP != *myPHull.begin()) myPHull.push_front(aP);
257 update<BackwardIterator,FrontQHullUpdatePred>
258 (aP, myQHull, QHullBack, myQHull.rend());
265 update<ForwardIterator,FrontQHullUpdatePred>
266 (aQ, myQHull, QHullFront, myQHull.end());
269 if (aQ != *myQHull.begin()) myQHull.push_front(aQ);
272 update<BackwardIterator,FrontPHullUpdatePred>
273 (aQ, myPHull, PHullBack, myPHull.rend());
277 }
else isEmpty =
true;
282 template <
typename Shape>
299 myShape.init(*PHullFront, *QHullBack);
301 myShape.init(*QHullFront, *PHullBack);
304 if ( p1(aP) && p2(aQ) ) {
308 update<BackwardIterator,BackPHullUpdatePred>
309 (aP, myPHull, PHullBack, myPHull.rend());
312 if (aP != *myPHull.rbegin()) myPHull.push_back(aP);
315 update<ForwardIterator,BackQHullUpdatePred>
316 (aP, myQHull, QHullFront, myQHull.end());
324 update<BackwardIterator,BackQHullUpdatePred>
325 (aQ, myQHull, QHullBack, myQHull.rend());
328 if (aQ != *myQHull.rbegin()) myQHull.push_back(aQ);
331 update<ForwardIterator,BackPHullUpdatePred>
332 (aQ, myPHull, PHullFront, myPHull.end());
336 }
else isEmpty =
true;
342 template <
typename Shape>
343 template <
typename Iterator,
typename Predicate>
347 const Point & aPoint,
349 Iterator & anIterator,
350 const Iterator & anEndIterator)
356 if (anIterator != anEndIterator) {
359 Predicate pred( myShape );
361 while ( (anIterator != anEndIterator) &&
369 ::erase(aContainer, anIterator);
374 if (anIterator != anEndIterator) {
377 pred = Predicate( myShape );
386 template <
typename Shape>
394 template <
typename Shape>
399 out <<
"[Preimage2D]\n";
400 out <<
"first part: \n";
402 i != myPHull.end(); ++i) {
406 out <<
"second part: \n";
408 i != myQHull.end(); ++i) {
414 template <
typename Shape>
422 template <
typename Shape>
427 return *myPHull.rbegin();
430 template <
typename Shape>
435 return *myPHull.begin();
438 template <
typename Shape>
443 return *myQHull.rbegin();
446 template <
typename Shape>
451 return *myQHull.begin();
454 template <
typename Shape>
469 typedef typename Point::Coordinate Coordinate;
482 double det = (ap*b-bp*a);
486 x = -(b*cp-bp*c)/det;
487 y = -(a*cp-ap*c)/(-det);
489 double l = std::sqrt(a*a + b*b);
490 double lp = std::sqrt(ap*ap + bp*bp);
491 double apn = ap/lp*l;
492 double bpn = bp/lp*l;
497 gamma = -alpha*x - beta*y;
511 template <
typename Shape>
517 object.selfDisplay( out );