File: spline.h

package info (click to toggle)
drc 3.2.2~dfsg0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,548 kB
  • sloc: ansic: 13,575; cpp: 11,048; sh: 253; makefile: 41
file content (133 lines) | stat: -rw-r--r-- 5,232 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/****************************************************************************

    DRC: Digital Room Correction
    Copyright (C) 2002-2017 Denis Sbragion

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

		You can contact the author on Internet at the following address:

				d.sbragion@neomerica.it

****************************************************************************/

/* Spline routines */

#ifndef Spline_h
	#define Spline_h

	/* Inclusioni */
	#include "dsplib.h"
  #include "boolean.h"

	/* Tipo spline da generare */
  typedef enum { SplineBDef, SplineBNat } CSplineType;

  /* Valore della spline lineare nel punto X */
	DLReal L1SplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal X);

	/* Valore della spline lineare nei punti X */
	/* X deve essere un array crescente strettamente monotonico */
	void AL1SplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * X, const int XS, DLReal * Y);

	/* Prepara la base per la spline cubica interpolante, ponendola in SPD2YN */
	Boolean SplinePrepare(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal SPD1Y1, const DLReal SPD1YN,
		const CSplineType SPType, DLReal * SPD2YN);

	/* Valore della spline cubica interpolante nel punto X */
	DLReal SplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * SPD2YN, const DLReal X);

	/* Valore della spline cubica interpolante nei punti X */
	/* X deve essere un array crescente strettamente monotonico */
	void ASplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * SPD2YN, const DLReal * X,
		const int XS, DLReal * Y);

	/* Valore della B spline cubica uniforme nel punto X */
	DLReal B3SplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal X);

	/* Valore della B spline cubica uniforme nei punti X */
	/* X deve essere un array crescente strettamente monotonico */
	void AB3SplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * X, const int XS, DLReal * Y);

	/* Valore della B spline cubica di tipo Catmull Rom nel punto X */
	DLReal B3CRSplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal X);

	/* Valore della B spline cubica di tipo Catmull Rom  nei punti X */
	/* X deve essere un array crescente strettamente monotonico */
	void AB3CRSplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * X, const int XS, DLReal * Y);

	/* Interpolazione su scala lineare tramite B spline cubica
	uniforme con riparametrizzazione arc length tramite B spline
	cubica Catmull-Rom interpolante */
	Boolean AB3CRMSplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * X, const int XS, DLReal * Y);

	/* Interpolazione su scala lineare tramite
	Hermite spline cubica monotonica */
	void APCHIPSplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * X, const int XS, DLReal * Y);

	/* Interpolazione su scala lineare tramite B spline cubica
	uniforme con riparametrizzazione arc length tramite spline
	cubica Hermite monotonica */
	Boolean AB3HSMSplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * X, const int XS, DLReal * Y);

	/* Definizione tipo spline da utilizzare */
	typedef enum
		{
			CSLLinear, /* Lineare */
			CSLCSpline, /* Spline cubica interpolante classica, classe C2, non monotonica */
			CSLBSpline, /* B Spline cubica approssimante, classe C2, non interpolante */
			CSLCRSpline, /* CatmullRom, interpolante, non monotonica */
			CSLHSSpline /* Hermite spline, interpolante, monotonica (PCHIP) */
		}
	CSLSplineType;

	/* Definizione tipo asse da utilizzare */
	typedef enum
		{
				CSLLinXLinY,
				CSLLogXLinY,
				CSLLinXLogY,
				CSLLogXLogY
		}
	CSLAxisType;

	/* Funzione generica interpolazione */
	/* Nel caso si utilizzi un asse logaritmico i valori su tale
	asse devono	essere strettamente maggiori di 0 */
	Boolean CSLASplineValue(const DLReal * XN, const DLReal * YN,
		const int N, const DLReal * X, const int XS, DLReal * Y,
		const CSLSplineType SplineType, const CSLAxisType AxisType);

	/* Funzione generica interpolazione, versione complessa */
	/* Nel caso si utilizzi un asse logaritmico i valori di ampiezza
	su tale	asse devono	essere strettamente maggiori di 0.
	I valori di fase vengono sempre considerati su ascissa lineare */
	Boolean CSLCASplineValue(const DLReal * XN, const DLReal * MN,
		const DLReal * PN, const int N, const DLReal * X, const int XS,
		DLComplex * Y, const CSLSplineType SplineType, const CSLAxisType AxisType);

#endif