]> git.mxchange.org Git - simgear.git/blob - simgear/math/interpolater.hxx
Fix a build order problem.
[simgear.git] / simgear / math / interpolater.hxx
1 //
2 // interpolater.hxx -- routines to handle linear interpolation from a table of
3 //                     x,y   The table must be sorted by "x" in ascending order
4 //
5 // Written by Curtis Olson, started April 1998.
6 //
7 // Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Library General Public
11 // License as published by the Free Software Foundation; either
12 // version 2 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // Library General Public License for more details.
18 //
19 // You should have received a copy of the GNU Library General Public
20 // License along with this library; if not, write to the
21 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 // Boston, MA  02111-1307, USA.
23 //
24 // $Id$
25
26
27 #ifndef _INTERPOLATER_H
28 #define _INTERPOLATER_H
29
30
31 #ifndef __cplusplus                                                          
32 # error This library requires C++
33 #endif                                   
34
35 #include <simgear/compiler.h>
36
37 #include STL_STRING
38 FG_USING_STD(string);
39
40 #define MAX_TABLE_SIZE 32
41
42
43 class fgINTERPTABLE {
44     int size;
45     double table[MAX_TABLE_SIZE][2];
46
47 public:
48
49     // Constructor -- loads the interpolation table from the specified
50     // file
51     fgINTERPTABLE( const string& file );
52
53     // Given an x value, linearly interpolate the y value from the table
54     double interpolate(double x);
55
56     // Destructor
57     ~fgINTERPTABLE( void );
58 };
59
60
61 #endif // _INTERPOLATER_H
62
63