]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/interpolater.cxx
Ignore generated binaries.
[simgear.git] / simgear / math / interpolater.cxx
index d3d743509d7611db4a9d8bbfb44042f9f31a0210..abc3b480a64dab2b3be53a1e14971a502d744612 100644 (file)
@@ -4,7 +4,7 @@
 //
 // Written by Curtis Olson, started April 1998.
 //
-// Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
+// Copyright (C) 1998  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -30,7 +30,6 @@
 
 #include STL_STRING
 
-// depricated - #include <simgear/sg_zlib.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sgstream.hxx>
 
@@ -83,8 +82,9 @@ double SGInterpTable::interpolate(double x) const
     int i;
     double y;
 
-    if (size == 0.0)
+    if (size == 0.0) {
       return 0.0;
+    }
 
     i = 0;
 
@@ -96,14 +96,14 @@ double SGInterpTable::interpolate(double x) const
 
     // printf ("i = %d ", i);
 
-    if ( (i == 0) && (x < table[0].ind) ) {
+    if ( i <= 0 ) {
        SG_LOG( SG_MATH, SG_DEBUG, 
                "interpolate(): lookup error, x to small = " << x );
        return table[0].dep;
     }
 
     // cout << " table[size-1].ind = " << table[size-1].ind << endl;
-    if ( x > table[size-1].ind ) {
+    if ( i >= size ) {
        SG_LOG( SG_MATH, SG_DEBUG, 
                "interpolate(): lookup error, x to big = " << x );
        return table[size-1].dep;