]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/interpolater.hxx
Allow geocentric distance computations to return radians.
[simgear.git] / simgear / math / interpolater.hxx
index 8be1c672aeadc0a08d2268dcbe573cc4614f2ed1..393e39ffb267ba58c3bfe0505d1a8f1fda2903db 100644 (file)
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Library General Public License for more details.
 //
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the
-// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA  02111-1307, USA.
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 #define _INTERPOLATER_H
 
 
-#ifndef __cplusplus                                                          
+#ifndef __cplusplus
 # error This library requires C++
-#endif                                   
+#endif
 
 #include <simgear/compiler.h>
 
-#include <vector>
-SG_USING_STD(vector);
+#include <simgear/structure/SGReferenced.hxx>
 
-#include STL_STRING
-SG_USING_STD(string);
+#include <map>
 
+#include <string>
+using std::string;
+
+class SGPropertyNode;
 
 /**
  * A class that provids a simple linear 2d interpolation lookup table.
@@ -49,21 +50,7 @@ SG_USING_STD(string);
  * independant variable must be strictly ascending.  The dependent
  * variable can be anything.
  */
-class SGInterpTable {
-
-    struct Entry
-    {
-      Entry ()
-       : ind(0.0L), dep(0.0L) {}
-      Entry (double independent, double dependent)
-       : ind(independent), dep(dependent) {}
-      double ind;
-      double dep;
-    };
-
-    int size;
-    vector<Entry> table;
-
+class SGInterpTable : public SGReferenced {
 public:
 
     /**
@@ -71,6 +58,13 @@ public:
      */
     SGInterpTable();
 
+    /**
+     * Constructor. Loads the interpolation table from an interpolation
+     * property node.
+     * @param interpolation property node having entry children
+     */
+    SGInterpTable(const SGPropertyNode* interpolation);
+
     /**
      * Constructor. Loads the interpolation table from the specified file.
      * @param file name of interpolation file
@@ -96,6 +90,10 @@ public:
 
     /** Destructor */
     ~SGInterpTable();
+
+private:
+    typedef std::map<double, double> Table;
+    Table _table;
 };