Fix arc to hgt converter overwriting and make more verbose
[tecorrec.git] / maths / SplineDefinitions.cpp
blobcd8a327ef58fbbe1a5e4c8f6e77f327ffa59025c
1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 /**
21 * @file maths/SplineDefinitions.cpp
22 * @brief Spline types.
25 #include "SplineDefinitions.h"
27 // B-Spline
28 // Doesn't intersect control points
29 // Nice and smoooooooth
30 const maths::CubicSplineDefinition<char> maths::bSpline
31 ( // Spline matrix and divisor
32 maths::CubicSpline<char>( maths::Vector<4, char>( -1, 3, -3, 1),
33 maths::Vector<4, char>( 3, -6, 0, 4),
34 maths::Vector<4, char>( -3, 3, 3, 1),
35 maths::Vector<4, char>( 1, 0, 0, 0), 6),
36 // Tangent matrix and divisor
37 maths::CubicSpline<char>( maths::Vector<4, char>( 0, -1, 2, -1),
38 maths::Vector<4, char>( 0, 3, -4, 0),
39 maths::Vector<4, char>( 0, -3, 2, 1),
40 maths::Vector<4, char>( 0, 1, 0, 0), 2)
43 // Catmull-Rom Spline
44 // Intersects control points
45 // Not as smoooooth as B-Spline
46 const maths:: CubicSplineDefinition<char> maths::catmullRomSpline
47 ( // Spline matrix and divisor
48 maths::CubicSpline<char>( maths::Vector<4, char>( -1, 2, -1, 0),
49 maths::Vector<4, char>( 3, -5, 0, 2),
50 maths::Vector<4, char>( -3, 4, 1, 0),
51 maths::Vector<4, char>( 1, -1, 0, 0), 2),
52 // Tangent matrix and divisor
53 maths::CubicSpline<char>( maths::Vector<4, char>( -3, -1, 4, -1),
54 maths::Vector<4, char>( 9, 3,-10, 0),
55 maths::Vector<4, char>( -9, -3, 8, 1),
56 maths::Vector<4, char>( 3, 1, -2, 0), 2)