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/>.
19 * @author Kacper Pluta (\c kacper.pluta@esiee.fr )
20 * Laboratoire d'Informatique Gaspard-Monge - LIGM, A3SI, France
24 * Implementation of inline methods defined in Knot_3_2.h
26 * This file is part of the DGtal library.
29 ///////////////////////////////////////////////////////////////////////////////
30 // IMPLEMENTATION of inline methods.
31 ///////////////////////////////////////////////////////////////////////////////
33 //////////////////////////////////////////////////////////////////////////////
34 //////////////////////////////////////////////////////////////////////////////
38 ///////////////////////////////////////////////////////////////////////////////
39 // Implementation of inline methods //
43 DGtal::Knot_3_2<T>::Knot_3_2 ( long double scale_1, long double scale_2, long double scale_3 ) : scale {scale_1, scale_2, scale_3}
46 template < typename T>
48 typename DGtal::Knot_3_2<T>::RealPoint DGtal::Knot_3_2<T>::x ( const long double t ) const
50 return RealPoint ( scale[0] * ( std::cos ( 2 * t ) * ( 3. + std::cos ( 3. * t ) ) ),
51 scale[1] * ( std::sin ( 2. * t ) * ( 3. + std::cos ( 3. * t ) ) ), scale[2] * std::sin ( 3. * t ) );
54 template < typename T>
56 typename DGtal::Knot_3_2<T>::RealPoint DGtal::Knot_3_2<T>::xp ( const long double t ) const
59 -2. * scale[0] * ( 3. + std::cos ( 3. * t ) ) * std::sin( 2. * t ) - 3. * scale[0] * std::cos ( 2. * t ) * std::sin ( 3. * t),
60 2. * scale[1] * std::cos (2. * t ) * ( 3. + std::cos( 3. * t ) ) - 3. * scale[1] * std::sin ( 2. * t ) * std::sin ( 3. * t),
61 3. * scale[2] * std::cos ( 3. * t ) );
65 template < typename T>
67 double DGtal::Knot_3_2<T>::getPeriod()
72 template < typename T>
74 void DGtal::Knot_3_2<T>::selfDisplay ( std::ostream & out ) const
79 ///////////////////////////////////////////////////////////////////////////////
80 // Implementation of inline functions and external operators //
83 * Overloads 'operator<<' for displaying objects of class 'Knot_3_2'.
84 * @param out the output stream where the object is written.
85 * @param object the object of class 'Knot_3_2' to write.
86 * @return the output stream after the writing.
91 DGtal::operator<< ( std::ostream & out, const Knot_3_2<T> & object )
93 object.selfDisplay ( out );
98 ///////////////////////////////////////////////////////////////////////////////