DGtal 1.4.2
Loading...
Searching...
No Matches
Knot_7_4.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_7_4.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_7_4.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_7_4<T>::Knot_7_4 ( 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_7_4<T>::RealPoint DGtal::Knot_7_4<T>::x ( const long double t ) const
49{
50 return RealPoint (
51 scale[0] * 4. / 5. * t * ( t * t - 6. ) * ( t * t- 12. ),
52 scale[1] * t * t * ( t * t - 7. ) * ( t * t - 9. ),
53 scale[2] * 1. / 200. * t * ( t * t - 0.2 ) * ( t * t - 1. ) * ( t * t - 5. ) *
54 ( t * t - 6.5 ) * ( t * t - 9. ) * ( t * t - 10. )
55 );
56}
57
58template < typename T>
59inline
60typename DGtal::Knot_7_4<T>::RealPoint DGtal::Knot_7_4<T>::xp ( const long double t ) const
61{
62 return RealPoint (
63 scale[0] * 4. / 5. * ( 72. - 54. * t * t + 5. * std::pow ( t, 4 ) ),
64 scale[1] * 2. * t * ( 63. - 32. * t * t + 3. * std::pow ( t, 4 ) ),
65 scale[2] * ( 2.925 - 57.6075 * t * t + 124.405 * std::pow ( t, 4) - 72.373 * std::pow ( t, 6 ) +
66 17.001 * std::pow ( t, 8 ) - 1.7435 * std::pow ( t, 10 ) + 0.065 * std::pow ( t, 12 ) )
67 );
68}
69
70
71template < typename T>
72inline
73void DGtal::Knot_7_4<T>::selfDisplay ( std::ostream & out ) const
74{
75 out << "[Knot_7_4]";
76}
77
78///////////////////////////////////////////////////////////////////////////////
79// Implementation of inline functions and external operators //
80
81/**
82 * Overloads 'operator<<' for displaying objects of class 'Knot_7_4'.
83 * @param out the output stream where the object is written.
84 * @param object the object of class 'Knot_7_4' to write.
85 * @return the output stream after the writing.
86 */
87template <typename T>
88inline
89std::ostream&
90DGtal::operator<< ( std::ostream & out, const Knot_7_4<T> & object )
91{
92 object.selfDisplay ( out );
93 return out;
94}
95
96// //
97///////////////////////////////////////////////////////////////////////////////
98
99