DGtal  1.5.beta
Knot_4_1.ih
1 /**
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.
6  *
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.
11  *
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/>.
14  *
15  **/
16 
17 /**
18  * @file Knot_4_1.ih
19  * @author Kacper Pluta (\c kacper.pluta@esiee.fr )
20  * Laboratoire d'Informatique Gaspard-Monge - LIGM, A3SI, France
21  *
22  * @date 2014/10/01
23  *
24  * Implementation of inline methods defined in Knot_4_1.h
25  *
26  * This file is part of the DGtal library.
27  */
28 
29 ///////////////////////////////////////////////////////////////////////////////
30 // IMPLEMENTATION of inline methods.
31 ///////////////////////////////////////////////////////////////////////////////
32 
33 //////////////////////////////////////////////////////////////////////////////
34 //////////////////////////////////////////////////////////////////////////////
35 
36 
37 
38 ///////////////////////////////////////////////////////////////////////////////
39 // Implementation of inline methods //
40 
41 template <typename T>
42 inline
43 DGtal::Knot_4_1<T>::Knot_4_1 ( long double scale_1, long double scale_2, long double scale_3 ) : scale {scale_1, scale_2, scale_3}
44 {}
45 
46 template < typename T>
47 inline
48 typename DGtal::Knot_4_1<T>::RealPoint DGtal::Knot_4_1<T>::x ( const long double t ) const
49 {
50  return RealPoint ( scale[0] * ( 2. / 5. * t * ( -10. + t * t ) * ( -7. + t * t ) ), scale[1] * ( t * t * ( -13 + t * t ) ),
51  scale[2] * ( 1. / 10. * t * ( -12. + t * t ) * ( -9. + t * t ) * ( -4. + t * t ) ) );
52 }
53 
54 template < typename T>
55 inline
56 typename DGtal::Knot_4_1<T>::RealPoint DGtal::Knot_4_1<T>::xp ( const long double t ) const
57 {
58  return RealPoint ( scale[0] * 2. / 5. * ( 70. - 51. * t * t + 5. * std::pow ( t, 4 ) ), scale[1] * ( -26. * t + 4. * std::pow ( t, 3 ) ),
59  scale[2] * 1. / 10. * ( -432. + 576. * t * t - 125. * std::pow ( t, 4 ) + 7. * std::pow ( t, 6 ) ) );
60 }
61 
62 
63 template < typename T>
64 inline
65 void DGtal::Knot_4_1<T>::selfDisplay ( std::ostream & out ) const
66 {
67  out << "[Knot_4_1]";
68 }
69 
70 ///////////////////////////////////////////////////////////////////////////////
71 // Implementation of inline functions and external operators //
72 
73 /**
74  * Overloads 'operator<<' for displaying objects of class 'Knot_4_1'.
75  * @param out the output stream where the object is written.
76  * @param object the object of class 'Knot_4_1' to write.
77  * @return the output stream after the writing.
78  */
79 template <typename T>
80 inline
81 std::ostream&
82 DGtal::operator<< ( std::ostream & out,
83  const Knot_4_1<T> & object )
84 {
85  object.selfDisplay ( out );
86  return out;
87 }
88 
89 // //
90 ///////////////////////////////////////////////////////////////////////////////
91 
92