2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU Lesser General Public License as
4 * published by the Free Software Foundation, either version 3 of the
5 * License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @file ArithDSSIterator.ih
19 * @author Isabelle Sivignon (\c isabelle.sivignon@gipsa-lab.grenoble-inp.fr )
20 * gipsa-lab Grenoble Images Parole Signal Automatique (CNRS, UMR 5216), CNRS, France
24 * Implementation of inline methods defined in ArithDSSIterator.h
26 * This file is part of the DGtal library.
29 ///////////////////////////////////////////////////////////////////////////////
30 // IMPLEMENTATION of inline methods.
31 ///////////////////////////////////////////////////////////////////////////////
33 //////////////////////////////////////////////////////////////////////////////
35 //////////////////////////////////////////////////////////////////////////////
39 ///////////////////////////////////////////////////////////////////////////////
40 // Implementation of inline methods //
42 template<typename TInteger, int c>
44 DGtal::ArithDSSIterator<TInteger,c>::ArithDSSIterator(const Integer a, const Integer b, const Integer mu, const Point & p)
52 template<typename TInteger, int c>
54 DGtal::ArithDSSIterator<TInteger,c>::ArithDSSIterator(const ArithDSSIterator<TInteger,c> &other):myA(other.myA),myB(other.myB),myMu(other.myMu),myP(other.myP)
61 template<typename TInteger, int c>
63 typename DGtal::ArithDSSIterator<TInteger,c>::Self & DGtal::ArithDSSIterator<TInteger,c>::operator=(const ArithDSSIterator<TInteger,c> & other)
79 template<typename TInteger, int c>
81 TInteger DGtal::ArithDSSIterator<TInteger,c>::remainder(const Point &Q)
83 return myA*Q[0] - myB*Q[1];
86 template<typename TInteger, int c>
88 typename DGtal::ArithDSSIterator<TInteger,c>::reference DGtal::ArithDSSIterator<TInteger,c>::operator*() const
94 template<typename TInteger, int c>
96 typename DGtal::ArithDSSIterator<TInteger,c>::Self & DGtal::ArithDSSIterator<TInteger,c>::operator++()
98 Integer r = remainder(myP);
101 if(r + myA >= myB + myMu)
105 else // connectivity = 4
115 template<typename TInteger, int c>
117 typename DGtal::ArithDSSIterator<TInteger,c>::Self DGtal::ArithDSSIterator<TInteger,c>::operator++(int)
125 template<typename TInteger, int c>
127 bool DGtal::ArithDSSIterator<TInteger,c>::operator==(const ArithDSSIterator<TInteger,c> & other) const
129 return myP == other.myP;
133 template<typename TInteger, int c>
135 bool DGtal::ArithDSSIterator<TInteger,c>::operator!=(const ArithDSSIterator<TInteger, c> & other) const
137 return ! (this->operator==(other));
147 ///////////////////////////////////////////////////////////////////////////////
148 // Implementation of inline functions and external operators //
151 * Overloads 'operator<<' for displaying objects of class 'ArithDSSIterator'.
152 * @param out the output stream where the object is written.
153 * @param object the object of class 'ArithDSSIterator' to write.
154 * @return the output stream after the writing.
158 // DGtal::operator<< ( std::ostream & out,
159 // const ArithDSSIterator & object )
161 // object.selfDisplay ( out );
166 ///////////////////////////////////////////////////////////////////////////////