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 SurfelAdjacency.ih
19 * @author Jacques-Olivier Lachaud (\c jacques-olivier.lachaud@univ-savoie.fr )
20 * Laboratory of Mathematics (CNRS, UMR 5807), University of Savoie, France
24 * Implementation of inline methods defined in SurfelAdjacency.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 //
41//-----------------------------------------------------------------------------
42template <DGtal::Dimension dim>
44DGtal::SurfelAdjacency<dim>::
47//-----------------------------------------------------------------------------
48template <DGtal::Dimension dim>
50DGtal::SurfelAdjacency<dim>::
51SurfelAdjacency( bool int2ext )
54 DGtal::Dimension offset = 0;
55 for ( DGtal::Dimension j = 0; j < dim; ++j )
56 for ( DGtal::Dimension i = 0; i < dim; ++i )
57 myInt2Ext[ offset++ ] = int2ext;
60//-----------------------------------------------------------------------------
61template <DGtal::Dimension dim>
63DGtal::SurfelAdjacency<dim>::
64SurfelAdjacency ( const SurfelAdjacency & other )
65 : myInt2Ext( other.myInt2Ext )
68//-----------------------------------------------------------------------------
69template <DGtal::Dimension dim>
71DGtal::SurfelAdjacency<dim> &
72DGtal::SurfelAdjacency<dim>::
73operator= ( const SurfelAdjacency & other )
76 myInt2Ext = other.myInt2Ext;
79//-----------------------------------------------------------------------------
80template <DGtal::Dimension dim>
83DGtal::SurfelAdjacency<dim>::
84setAdjacency( DGtal::Dimension i, DGtal::Dimension j, bool int2ext )
86 myInt2Ext[ i * dim + j ] = int2ext;
87 myInt2Ext[ j * dim + i ] = int2ext;
89//-----------------------------------------------------------------------------
90template <DGtal::Dimension dim>
93DGtal::SurfelAdjacency<dim>::
94getAdjacency( DGtal::Dimension i, DGtal::Dimension j ) const
96 return myInt2Ext[ i * dim + j ];
98//-----------------------------------------------------------------------------
99template <DGtal::Dimension dim>
102DGtal::SurfelAdjacency<dim>::
103selfDisplay ( std::ostream & out ) const
105 out << "[SurfelAdjacency]";
107//-----------------------------------------------------------------------------
108template <DGtal::Dimension dim>
111DGtal::SurfelAdjacency<dim>::
119///////////////////////////////////////////////////////////////////////////////
120// Implementation of inline functions and external operators //
123 * Overloads 'operator<<' for displaying objects of class 'SurfelAdjacency'.
124 * @param out the output stream where the object is written.
125 * @param object the object of class 'SurfelAdjacency' to write.
126 * @return the output stream after the writing.
128template <DGtal::Dimension dim>
131DGtal::operator<< ( std::ostream & out,
132 const SurfelAdjacency<dim> & object )
134 object.selfDisplay ( out );
139///////////////////////////////////////////////////////////////////////////////