X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsupport%2Finterpolator.cpp;h=ace70fdd70a0bbc9312f05fe2b91e6ecaa75cc3a;hp=e8abdfa0bfc259517b4978ec72818cb23f166b4d;hb=8a7697ce57b56cdc43698cd1241ad98d49f9b5ac;hpb=befd71a7157339b52a0c40359518d5276b25d127 diff --git a/libctsupport/interpolator.cpp b/libctsupport/interpolator.cpp index e8abdfa..ace70fd 100644 --- a/libctsupport/interpolator.cpp +++ b/libctsupport/interpolator.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: interpolator.cpp,v 1.1 2001/02/11 21:57:08 kevin Exp $ +** $Id$ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -42,13 +42,17 @@ CubicPolyInterpolator::interpolate (double x) int hi = lo + 3; if (lo < -1) { +#ifdef DEBUG sys_error (ERR_WARNING, "x=%f, out of range [CubicPolyInterpolator]", x); +#endif return (0); } else if (lo == -1) // linear interpolate at between x = 0 & 1 return m_pdY[0] + x * (m_pdY[1] - m_pdY[0]); if (hi > m_n) { +#ifdef DEBUG sys_error (ERR_WARNING, "x=%f, out of range [CubicPolyInterpolator]", x); +#endif return (0); } else if (hi == m_n) {// linear interpolate between x = (n-2) and (n-1) double frac = x - (lo + 1); @@ -116,7 +120,9 @@ CubicSplineInterpolator::interpolate (double x) int hi = lo + 1; if (lo < 0 || hi >= m_n) { - sys_error (ERR_SEVERE, "X range out of bounds [CubicSplineInterpolator::interpolate]"); +#ifdef DEBUG + sys_error (ERR_SEVERE, "x out of bounds [CubicSplineInterpolator::interpolate]"); +#endif return (0); } @@ -128,5 +134,6 @@ CubicSplineInterpolator::interpolate (double x) return y; } +