DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ArithmeticalDSS.ih
1 
29 
30 // IMPLEMENTATION of inline methods.
32 
34 #include <cstdlib>
35 #include <boost/math/common_factor_rt.hpp>
37 
38 
39 
40 
41 
43 // Implementation of inline methods //
44 
45 
46 template <typename TIterator, typename TInteger, int connectivity>
47 inline
49 {
50  myUf = Point(0,0);
51  myLf = Point(0,0);
52  myUl = Point(0,0);
53  myLl = Point(0,0);
54 
55  myA = 0;
56  myB = 0;
57  myMu = 0;
58  myOmega = 0;
59  myNbUpPat = 0;
60  myNbLowPat = 0;
61 }
62 
63 
64 template <typename TIterator, typename TInteger, int connectivity>
65 inline
67 {
68  init(it);
69 }
70 
71 template <typename TIterator, typename TInteger, int connectivity>
72 inline
74 {
75 
76  myF = it;
77  myL = it;
78 
79  myUf = *it;
80  myLf = *it;
81  myUl = *it;
82  myLl = *it;
83 
84  myA = 0;
85  myB = 0;
86  myMu = 0;
87  myOmega = 0;
88  myNbUpPat = 0;
89  myNbLowPat = 0;
90 
91  mySteps.clear();
92 
93 }
94 
95 template <typename TIterator, typename TInteger, int connectivity>
96 inline
99  myA(other.myA), myB(other.myB), myMu(other.myMu), myOmega(other.myOmega),
100  myNbUpPat(other.myNbUpPat),myNbLowPat(other.myNbLowPat),
101  myUf(other.myUf), myUl(other.myUl), myLf(other.myLf), myLl(other.myLl),
102  myF(other.myF), myL(other.myL) {
103 
104  mySteps.clear();
105  mySteps = other.mySteps;
106 }
107 
108 template <typename TIterator, typename TInteger, int connectivity>
109 inline
113 {
114  if ( this != &other )
115  {
116  myA = other.myA;
117  myB = other.myB;
118  myMu = other.myMu;
119  myOmega = other.myOmega;
120  myNbUpPat = other.myNbUpPat;
121  myNbLowPat = other.myNbLowPat;
122  myUf = other.myUf;
123  myLf = other.myLf;
124  myUl = other.myUl;
125  myLl = other.myLl;
126  myF = other.myF;
127  myL = other.myL;
128  mySteps = other.mySteps;
129 
130  }
131  return *this;
132 }
133 
134 template <typename TIterator, typename TInteger, int connectivity>
135 inline
138 ::getReverse() const {
139  return Reverse();
140 }
141 
142 template <typename TIterator, typename TInteger, int connectivity>
143 inline
146 ::getSelf() const {
147  return Self();
148 }
149 
150 
151 
152 template <typename TIterator, typename TInteger, int connectivity>
153 inline
154 bool
157  return ( ( (myOmega == other.myOmega) &&
158  (myUf == other.myUf) &&
159  (myUl == other.myUl) &&
160  (myLf == other.myLf) &&
161  (myLl == other.myLl) &&
162  (*myF == *other.myF) &&
163  (*myL == *other.myL) ) ||
164  ( (myOmega == other.myOmega) &&
165  (myUf == other.myLl) &&
166  (myUl == other.myLf) &&
167  (myLf == other.myUl) &&
168  (myLl == other.myUf) &&
169  (*myF == *other.myL) &&
170  (*myL == *other.myF) ) );
171 }
172 
173 template <typename TIterator, typename TInteger, int connectivity>
174 inline
175 bool
178  return (!(*this == other));
179 }
180 
181 
182 template <typename TIterator, typename TInteger, int connectivity>
183 inline
184 bool
187  ConstIterator & lastIt,
188  const Vector & lastMove,
189  Point & Uf, Point & Ul,
190  Point & Lf, Point & Ll )
191 {
192 
193  Point lastPoint(*it);
194 
196  ::norm(lastMove[0],lastMove[1]);
197  //if the two last points are not connected return false
198  if (deviation > NumberTraits<Integer>::ONE) return false;
199  //if the two last points are confounded return true
200  else if (deviation == NumberTraits<Integer>::ZERO)
201  {
202  //add the point to the DSS
203  lastIt = it;
204  return true;
205  }
206  //otherwise
207  else if (mySteps.size()<2) {
208 
209  //initialisation stage
210 
211  if (mySteps.size()==0) {
212 
213  mySteps.push_back(lastMove);
214 
215  //update
216  lastIt = it;
217  Ul = lastPoint;
218  Ll = lastPoint;
219  myA += lastMove[1];
220  myB += lastMove[0];
221  myMu = getRemainder(myUl);
222  myOmega = Tools<Integer,connectivity>::norm(myA,myB);
223  myNbUpPat = 1;
224  myNbLowPat = 1;
225 
226  return true;
227 
228  } else { //mySteps.size() == 1
229 
230  if (lastMove == mySteps.at(0)) {
231 
232  //update
233  lastIt = it;
234  Ul = lastPoint;
235  Ll = lastPoint;
236  myNbUpPat++;
237  myNbLowPat++;
238 
239  return true;
240 
241  } else {
242 
243  //difference of the two steps viewed as points
244  Vector diff = ( lastMove-mySteps.at(0) );
246  //the two steps are compatible
247 
248  //update
249  lastIt = it;
250  //remainder
251  Integer r = getRemainder(lastPoint);
252  if ( r < myMu) { //on the left
253  Ul = lastPoint;
254  Lf = Ll;
255  myA = myNbUpPat*mySteps.at(0)[1] + lastMove[1];
256  myB = myNbUpPat*mySteps.at(0)[0] + lastMove[0];
257  myNbUpPat = 1;
258  myNbLowPat = 0;
259  } else { //on the right
260  Ll = lastPoint;
261  Uf = Ul;
262  myA = myNbUpPat*mySteps.at(0)[1] + lastMove[1];
263  myB = myNbUpPat*mySteps.at(0)[0] + lastMove[0];
264  myNbUpPat = 0;
265  myNbLowPat = 1;
266  }
267  myMu = getRemainder(myUl);
268  myOmega = Tools<Integer,connectivity>::norm(myA,myB);
269 
270  mySteps.push_back(lastMove);
271 
272  return true;
273 
274  } else { //the two steps are not compatible
275  return false;
276  }
277  }
278 
279  }
280 
281  } else { //mySteps.size() == 2
282 
283  //main stage
284 
285  //if there are only two steps at most
286  if (hasLessThanTwoSteps(lastMove)) {
287 
288  //remainder
289  Integer r = getRemainder(lastPoint);
290 
291  if ( (r < myMu-1)||(r > myMu+myOmega) )
292  return false; //strongly exterior
293  else {
294  //add the point to the DSS
295  lastIt = it;
296  //update
297  //if weakly interior
298  if (r == myMu) {
299  Ul = lastPoint;
300  myNbUpPat++;
301  }
302  if (r == myMu+myOmega-1) {
303  Ll = lastPoint;
304  myNbLowPat++;
305  }
306  //if weakly exterior
307  if (r == myMu-1) { //on the left
308  Ul = lastPoint;
309  Lf = Ll;
310  myA = myUl[1] - myUf[1];
311  myB = myUl[0] - myUf[0];
312  myMu = getRemainder(myUl);
313  myOmega = Tools<Integer,connectivity>::norm(myA,myB);
314  myNbUpPat = 1;
315  myNbLowPat = 0;
316  } else if (r == myMu+myOmega) { //on the right
317  Ll = lastPoint;
318  Uf = Ul;
319  myA = myLl[1] - myLf[1];
320  myB = myLl[0] - myLf[0];
321  myMu = getRemainder(myUl);
322  myOmega = Tools<Integer,connectivity>::norm(myA,myB);
323  myNbUpPat = 0;
324  myNbLowPat = 1;
325  }
326  return true;
327 
328  }
329 
330  } else {
331  //if there is more than two steps
332  return false;
333  }
334 
335  }
336 
337 }
338 
339 //Deprecated
340 //--------------------------------------------------------------------
341 template <typename TIterator, typename TInteger, int connectivity>
342 inline
343 bool
345 {
346 
347  return extendForward(it, myL, (Point(*it) - Point(*myL)), myUf, myUl, myLf, myLl);
348 
349 }
350 
351 //Deprecated
352 //--------------------------------------------------------------------
353 template <typename TIterator, typename TInteger, int connectivity>
354 inline
355 bool
357 {
358 
359  return extendForward(it, myF, (Point(*myF) - Point(*it)), myUl, myUf, myLl, myLf);
360 
361 }
362 
363 
364 //--------------------------------------------------------------------
365 template <typename TIterator, typename TInteger, int connectivity>
366 inline
367 bool
369 {
370 
371  ConstIterator it(myL); ++it;
372  return extendForward(it, myL, (Point(*it) - Point(*myL)), myUf, myUl, myLf, myLl);
373 
374 }
375 
376 //--------------------------------------------------------------------
377 template <typename TIterator, typename TInteger, int connectivity>
378 inline
379 bool
381 {
382 
383  ConstIterator it(myF); --it;
384  return extendForward(it, myF, (Point(*myF) - Point(*it)), myUl, myUf, myLl, myLf);
385 
386 }
387 
388 //--------------------------------------------------------------------
389 
390 template <typename TIterator, typename TInteger, int connectivity>
391 inline
392 bool
395  ConstIterator & lastIt,
396  ConstIterator & nextIt,
397  Point & Uf, Point & Ul,
398  Point & Lf, Point & Ll,
399  const Integer& s )
400 {
401 
402 
403  Vector v = Point(*myL)-Point(*myF);
405  ::norm(v[0],v[1]) <= NumberTraits<Integer>::ONE) {//if there are only two points
406 
407  //init with nextIt
408  firstIt = nextIt;
409  Uf = *firstIt;
410  Lf = *firstIt;
411 
412  myA = 0;
413  myB = 0;
414  myMu = 0;
415  myOmega = 0;
416  myNbUpPat = 0;
417  myNbLowPat = 0;
418 
419  mySteps.clear();
420 
421  } else { //there are strictly more than two points
422 
423  //update myF
424  Point ptToRemove = *firstIt;
425  firstIt = nextIt;
426 
427  //if the point to remove is the first upper leaning point...
428  if (ptToRemove == Uf) {
429  //... and if the first and last lower leaning points are confounded
430  if (Lf == Ll) {
431  //update of the parameters:
432  //a,b
433  Vector newMainVector = ( Lf - ( Uf + vectorFrom0ToOmega() ) )*s;
434  myA = newMainVector[1];
435  myB = newMainVector[0];
436  //leaning points
437  Integer k; //repetitions of the newMainVector
438  Vector toUl = (Ul - Point(*firstIt))*s;
439  k = Tools<Integer,connectivity>::norm(toUl[0],toUl[1])
441  Uf = Ul - newMainVector*k*s;
442  myNbUpPat = k;
443  Vector toLastIt = Point(*lastIt) - Lf;
444  k = Tools<Integer,connectivity>::norm(toLastIt[0],toLastIt[1])
446  Ll = Lf + newMainVector*k*s;
447  myNbLowPat = k;
448  //mu, omega
449  myMu = getRemainder(myUl);
450  myOmega = Tools<Integer,connectivity>::norm(myA,myB);
451  } else {
452  Uf = Uf + Vector(myB,myA)*s;
453  myNbUpPat--;
454  }
455  }
456 
457  //if the point to remove is the first lower leaning point...
458  if (ptToRemove == Lf) {
459  //... and if the first and last upper leaning points are confounded
460  if (Uf == Ul) {
461  //update of the parameters:
462  //a,b
463  Vector newMainVector = ( Uf - (Lf - vectorFrom0ToOmega() ) )*s;
464  myA = newMainVector[1];
465  myB = newMainVector[0];
466  //leaning points
467  Integer k; //repetitions of the newMainVector
468  Vector toLl = Ll - Point(*firstIt);
469  k = Tools<Integer,connectivity>::norm(toLl[0],toLl[1])
471  Lf = Ll - newMainVector*k*s;
472  myNbLowPat = k;
473  Vector toLastIt = Point(*lastIt) - Uf;
474  k = Tools<Integer,connectivity>::norm(toLastIt[0],toLastIt[1])
476  Ul = Uf + newMainVector*k*s;
477  myNbUpPat = k;
478  //mu, omega
479  myMu = getRemainder(myUl);
480  myOmega = Tools<Integer,connectivity>::norm(myA,myB);
481  } else {
482  Lf = Lf + Vector(myB,myA)*s;
483  myNbLowPat--;
484  }
485  }
486 
487  //steps update
488  if (Vector(myB,myA) == mySteps.at(0)) {
489  Vector tmp(mySteps.at(0));
490  mySteps.clear();
491  mySteps.push_back(tmp);
492  } else if (Vector(myB,myA) == mySteps.at(1)) {
493  Vector tmp(mySteps.at(1));
494  mySteps.clear();
495  mySteps.push_back(tmp);
496  }
497 
498  }
499 
500  return true;
501 }
502 
503 
504 //--------------------------------------------------------------------
505 
506 template <typename TIterator, typename TInteger, int connectivity>
507 inline
508 bool
510 {
511 
512  Vector v = Point(*myL)-Point(*myF);
513  if ( (v[0] == 0) && (v[1] == 0) ) {//if there is only one point
514  return false;
515  } else { //otherwise
516  ConstIterator next(myF); ++next;
517  return retractForward(myF, myL, next, myUf, myUl, myLf, myLl, 1);
518  }
519 }
520 
521 //--------------------------------------------------------------------
522 
523 template <typename TIterator, typename TInteger, int connectivity>
524 inline
525 bool
527 {
528 
529  Vector v = Point(*myL)-Point(*myF);
530  if ( (v[0] == 0) && (v[1] == 0) ) {//if there is only one point
531  return false;
532  } else { //otherwise
533  ConstIterator previous(myL); --previous;
534  return retractForward(myL, myF, previous, myUl, myUf, myLl, myLf, -1);
535  }
536 }
537 
538 //--------------------------------------------------------------------
539 //Deprecated
540 template <typename TIterator, typename TInteger, int connectivity>
541 inline
542 bool
544 {
545 
546  Point lastPoint(*it);
547  Vector lastMove = lastPoint-Point(*myL);
548 
550  ::norm(lastMove[0],lastMove[1]);
551  //if the two last points are not connected return false
552  if (deviation>NumberTraits<Integer>::ONE) return false;
553  //if the two last points are confounded return true
554  else if (deviation==NumberTraits<Integer>::ZERO) return true;
555  //otherwise
556 
557  else if (mySteps.size()<2) {
558 
559  //initialisation stage
560 
561  if (mySteps.size()==0) {
562 
563  return true;
564 
565  } else { //mySteps.size() == 1
566 
567  if (lastMove == mySteps.at(0)) {
568 
569  return true;
570 
571  } else {
572 
573  //difference of the two steps viewed as points
574  Vector diff = ( lastMove-mySteps.at(0) );
576  //the two steps are compatible
577  return true;
578 
579  } else { //the two steps are not compatible
580  return false;
581  }
582  }
583 
584  }
585 
586  } else { //mySteps.size() == 2
587 
588  //main stage
589 
590  //if there only two steps at most
591  if (hasLessThanTwoSteps(lastMove)) {
592 
593  //remainder
594  Integer r = getRemainder(lastPoint);
595 
596  if ( (r < myMu-1)||(r > myMu+myOmega) )
597  return false; //strongly exterior
598 
599  else {
600  return true;
601  }
602 
603  } else {
604  //if there is more than two steps
605  return false;
606  }
607 
608  }
609 
610 }
611 
612 //--------------------------------------------------------------------
613 template <typename TIterator, typename TInteger, int connectivity>
614 inline
615 bool
617 {
618 
619  ConstIterator it(myL); ++it;
620  return isExtendableForward(*it, (Point(*it) - Point(*myL)) );
621 
622 }
623 
624 //--------------------------------------------------------------------
625 template <typename TIterator, typename TInteger, int connectivity>
626 inline
627 bool
629 {
630 
631  ConstIterator it(myF); --it;
632  return isExtendableForward(*it, (Point(*myF) - Point(*it)) );
633 
634 }
635 
636 template <typename TIterator, typename TInteger, int connectivity>
637 inline
638 bool
640  const Point & lastPoint,
641  const Vector & lastMove )
642 {
643 
644 
646  ::norm(lastMove[0],lastMove[1]);
647  //if the two last points are not connected return false
648  if (deviation > NumberTraits<Integer>::ONE) return false;
649  //if the two last points are confounded return true
650  else if (deviation == NumberTraits<Integer>::ZERO) return true;
651  //otherwise
652 
653  else if (mySteps.size()<2) {
654 
655  //initialisation stage
656 
657  if (mySteps.size()==0) {
658 
659  return true;
660 
661  } else { //mySteps.size() == 1
662 
663  if (lastMove == mySteps.at(0)) {
664 
665  return true;
666 
667  } else {
668 
669  //difference of the two steps viewed as points
670  Vector diff = ( lastMove-mySteps.at(0) );
671  if (Tools<Integer,connectivity>::dualNorm(diff[0],diff[1]) == 1) {
672  //the two steps are compatible
673  return true;
674 
675  } else { //the two steps are not compatible
676  return false;
677  }
678  }
679 
680  }
681 
682  } else { //mySteps.size() == 2
683 
684  //main stage
685 
686  //if there only two steps at most
687  if (hasLessThanTwoSteps(lastMove)) {
688 
689  //remainder
690  Integer r = getRemainder(lastPoint);
691 
692  if ( (r < myMu-1)||(r > myMu+myOmega) )
693  return false; //strongly exterior
694  else
695  return true;
696 
697  } else {
698  //if there is more than two steps
699  return false;
700  }
701 
702  }
703 
704 }
705 
706 
707 //-------------------------------------------------------------------------
708 template <typename TIterator, typename TInteger, int connectivity>
709 inline
710 TInteger
712 {
713  return myA * static_cast<Integer>(aPoint[0])
714  - myB * static_cast<Integer>(aPoint[1]);
715 }
716 
717 
718 template <typename TIterator, typename TInteger, int connectivity>
719 inline
720 TInteger
722 {
723  return getRemainder(*it);
724 }
725 
726 
727 template <typename TIterator, typename TInteger, int connectivity>
728 inline
729 TInteger
731 {
732  return myA * static_cast<Integer>(aPoint[0])
733  + myB * static_cast<Integer>(aPoint[1]);
734 }
735 
736 template <typename TIterator, typename TInteger, int connectivity>
737 inline
738 TInteger
740 {
741  return getPosition(*it);
742 }
743 
744 
745 template <typename TIterator, typename TInteger, int connectivity>
746 inline
747 bool
749 {
750  Integer r = getRemainder(aPoint);
751  return ( (r >= myMu)&&(r < myMu+myOmega) );
752 }
753 
754 
755 template <typename TIterator, typename TInteger, int connectivity>
756 inline
757 bool
759 {
760  return isInDSL(*it);
761 }
762 
763 //-------------------------------------------------------------------------
764 template <typename TIterator, typename TInteger, int connectivity>
765 inline
766 bool
768 {
769  Integer s = getPosition(aPoint);
770  Integer smin = getPosition(myF);
771  Integer smax = getPosition(myL);
772  return (isInDSL(aPoint) && ( (s >= smin)&&(s <= smax) ) );
773 }
774 
775 
776 template <typename TIterator, typename TInteger, int connectivity>
777 inline
778 bool
780 {
781  return isInDSS(*it);
782 }
783 
784 
785 //------------------------- Accessors --------------------------
786 
787 template <typename TIterator, typename TInteger, int connectivity>
788 inline
789 TInteger
791  return myA;
792 }
793 
794 template <typename TIterator, typename TInteger, int connectivity>
795 inline
796 TInteger
798  return myB;
799 }
800 
801 template <typename TIterator, typename TInteger, int connectivity>
802 inline
803 TInteger
805  return myMu;
806 }
807 
808 template <typename TIterator, typename TInteger, int connectivity>
809 inline
810 TInteger
812  return myOmega;
813 }
814 
815 template <typename TIterator, typename TInteger, int connectivity>
816 inline
819  return myUf;
820 }
821 template <typename TIterator, typename TInteger, int connectivity>
822 inline
825  return myUl;
826 }
827 
828 template <typename TIterator, typename TInteger, int connectivity>
829 inline
832  return myLf;
833 }
834 
835 template <typename TIterator, typename TInteger, int connectivity>
836 inline
839  return myLl;
840 }
841 
842 template <typename TIterator, typename TInteger, int connectivity>
843 inline
846  return (*myF);
847 }
848 
849 template <typename TIterator, typename TInteger, int connectivity>
850 inline
853  return (*myL);
854 }
855 
856 template <typename TIterator, typename TInteger, int connectivity>
857 inline
860  return (*myF);
861 }
862 
863 template <typename TIterator, typename TInteger, int connectivity>
864 inline
867  return (*myL);
868 }
869 
870 template <typename TIterator, typename TInteger, int connectivity>
871 inline
872 TIterator
874  return myF;
875 }
876 
877 template <typename TIterator, typename TInteger, int connectivity>
878 inline
879 TIterator
881  return myL;
882 }
883 
884 template <typename TIterator, typename TInteger, int connectivity>
885 inline
886 TIterator
888  return myF;
889 }
890 
891 template <typename TIterator, typename TInteger, int connectivity>
892 inline
893 TIterator
895  ConstIterator i(myL); ++i;
896  return i;
897 }
898 
899 //-----------------------------------------------------------------
900 template <typename TIterator, typename TInteger, int connectivity>
901 inline
902 bool
904 {
905 
906  if (Point(*myF) == Point(*myL)) {
907 
908  //init case with one point
909  if ( (myA==0)
910  &&(myB==0)
911  &&(myMu==0)
912  &&(myOmega==0)
913  &&(myNbUpPat==0)
914  &&(myNbLowPat==0) ) return true;
915  else return false;
916 
917  } else {
918 
919  //remainders of leaning points
920  if (getRemainder(myUf) != myMu) return false;
921  else if (getRemainder(myUl) != myMu) return false;
922  else if (getRemainder(myLf) != myMu+myOmega-1) return false;
923  else if (getRemainder(myLl) != myMu+myOmega-1) return false;
924  //number of patterns
925  else if ( (Vector(myB,myA)*myNbUpPat) != (myUl - myUf) ) return false;
926  else if ( (Vector(myB,myA)*myNbLowPat) != (myLl - myLf) ) return false;
927  else return true;
928 
929  }
930 
931 }
932 
933 
934 
935 template <typename TIterator, typename TInteger, int connectivity>
936 inline
939 {
940  //casts
941  double a = (double) NumberTraits<TInteger>::castToInt64_t(myA);
942  double b = (double) NumberTraits<TInteger>::castToInt64_t(myB);
943  double mu = (double) NumberTraits<TInteger>::castToInt64_t(myMu);
944  double omega = (double) NumberTraits<TInteger>::castToInt64_t(myOmega);
945  double xm = (double) NumberTraits<TInteger>::castToInt64_t(m[0]);
946  double ym = (double) NumberTraits<TInteger>::castToInt64_t(m[1]);
947 
948  double alpha = ( mu + (omega - 1.0)/2.0 );
949  double d2 = ( a * a + b * b );
950  double s = b * xm + a * ym;
951  double xp = ( b * s + a * alpha ) / d2;
952  double yp = ( a * s - b * alpha ) / d2;
953  return PointD( xp, yp );
954 }
955 
956 template <typename TIterator, typename TInteger, int connectivity>
957 inline
960 {
961  //casts
962  double a = (double) NumberTraits<TInteger>::castToInt64_t(myA);
963  double b = (double) NumberTraits<TInteger>::castToInt64_t(myB);
964  double xm = (double) NumberTraits<TInteger>::castToInt64_t(m[0]);
965  double ym = (double) NumberTraits<TInteger>::castToInt64_t(m[1]);
966 
967  double d2 = ( a * a + b * b );
968  double s = b * xm + a * ym;
969  double xp = ( b * s + a * r ) / d2;
970  double yp = ( a * s - b * r ) / d2;
971 
972  return PointD( xp, yp );
973 }
974 
975 
976 template <typename TIterator, typename TInteger, int connectivity>
977 inline
980 {
981 
982  double r = (double) NumberTraits<TInteger>::castToInt64_t(getRemainder(p));
983  return project(m,r);
984 
985 }
986 
987 template <typename TIterator, typename TInteger, int connectivity>
988 inline
989 double
991 {
992  PointD v = project( *myL );
993  PointD u = project( *myF );
994  v -= u;
995  return v.norm(PointD::L_2);
996 }
997 
998 
999 template <typename TIterator, typename TInteger, int connectivity>
1000 inline
1001 std::string
1003 {
1004  return "ArithmeticalDSS";
1005 }
1006 
1012 template <typename TIterator, typename TInteger, int connectivity>
1013 inline
1014 void
1016 {
1017 
1018  out << "[ArithmeticalDSS]" << endl;
1019  out << "Parameters (a,b,mu,omega)=";
1020  out << "("<< myA << ", " << myB << ", ";
1021  out << myMu << ", " << myOmega << ")" << endl;
1022  out << "Number of upper patterns: " << myNbUpPat << endl;
1023  out << "Number of lower patterns: " << myNbLowPat << endl;
1024  out << "First point " << Point(*myF) << " Last point " << Point(*myL) << endl;
1025  out << "Leaning points:" << endl;
1026  out << " Uf " << myUf << endl << " Ul " << myUl << endl;
1027  out << " Lf " << myLf << endl << " Ll " << myLl << endl;
1028  out << "Steps:" << endl;
1029  for (unsigned int i = 0; i < mySteps.size(); i++) {
1030  out << " " << mySteps.at(i) << endl;
1031  }
1032  out << "[End ArithmeticalDSS]" << endl;
1033 
1034 }
1035 
1036 //-------------------------------------------------------------------------
1037 template <typename TIterator, typename TInteger, int connectivity>
1038 inline
1039 bool
1041  const Vector& aStep) const
1042 {
1043  if ( (aStep == mySteps.at(0)) ||
1044  (aStep == mySteps.at(1)) ) {
1045  return true;
1046  } else {
1047  return false;
1048  }
1049 
1050 }
1051 
1052 template <typename TIterator, typename TInteger, int connectivity>
1053 inline
1056 {
1057  Vector v = mySteps.at(1) - mySteps.at(0);
1058  if ( getRemainder(v) == myOmega) {
1059  return v;
1060  } else {
1061  return ( mySteps.at(0) - mySteps.at(1) );
1062  }
1063 
1064 }
1065 
1066 
1067