DGtal 1.4.0
Loading...
Searching...
No Matches
Knot_5_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_5_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_5_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
41template <typename T>
42inline
43DGtal::Knot_5_1<T>::Knot_5_1 ( long double scale_1, long double scale_2, long double scale_3 ) : scale {scale_1, scale_2, scale_3}
44{}
45
46template < typename T>
47inline
48typename DGtal::Knot_5_1<T>::RealPoint DGtal::Knot_5_1<T>::x ( const long double t ) const
49{
50 return RealPoint (
51 scale[0] * 1. / 5. * ( std::pow ( t, 5 ) - 36. * std::pow ( t, 3 ) + 260. * t),
52 scale[1] * 1. / 2. * ( std::pow ( t, 4 ) - 24. * t * t ),
53 scale[2] * 1. / 100. * ( std::pow ( t, 7 ) - 31. * std::pow ( t, 5 ) + 164. * std::pow ( t, 3 ) + 560. * t )
54 );
55}
56
57template < typename T>
58inline
59typename DGtal::Knot_5_1<T>::RealPoint DGtal::Knot_5_1<T>::xp ( const long double t ) const
60{
61 return RealPoint (
62 scale[0] * ( 52. - ( 108. * t *t ) / 5. + std::pow ( t, 4 ) ), scale[1] * 2. * t * ( -12. + t * t ),
63 scale[2] * 1. / 100. * ( 560. + 492. * t * t -155. * std::pow ( t, 4 ) + 7. * std::pow ( t, 6 ) ) );
64}
65
66
67template < typename T>
68inline
69void DGtal::Knot_5_1<T>::selfDisplay ( std::ostream & out ) const
70{
71 out << "[Knot_5_1]";
72}
73
74///////////////////////////////////////////////////////////////////////////////
75// Implementation of inline functions and external operators //
76
77/**
78 * Overloads 'operator<<' for displaying objects of class 'Knot_5_1'.
79 * @param out the output stream where the object is written.
80 * @param object the object of class 'Knot_5_1' to write.
81 * @return the output stream after the writing.
82 */
83template <typename T>
84inline
85std::ostream&
86DGtal::operator<< ( std::ostream & out, const Knot_5_1<T> & object )
87{
88 object.selfDisplay ( out );
89 return out;
90}
91
92// //
93///////////////////////////////////////////////////////////////////////////////
94
95