00001 // Interpolator2D.cpp: implementation of the Interpolator2D class. 00002 // 00004 #ifdef WIN32 00005 #pragma warning(disable:4786) 00006 #endif 00007 #include "Interpolator2D.h" 00008 00010 // Construction/Destruction 00012 namespace Interpolator 00013 { 00015 Interpolator2D::Interpolator2D() 00016 { 00017 00018 } 00019 00021 Interpolator2D::~Interpolator2D() 00022 { 00023 00024 } 00025 00031 Interpolator2D::Interpolator2D( std::string sName, 00032 std::string sDescription, 00033 std::string sInterpolationType, 00034 InterpolationData2D* mInterpolationData) : 00035 Interpolator(sName,sDescription,sInterpolationType),_mInterpolationData(mInterpolationData) 00036 00037 { 00038 00039 } 00040 00042 void Interpolator2D::findIndexes(double dXValue,double dYValue) 00043 { 00044 //Faire algo quicksort pour plus de rapidité 00045 //int iXIndex = 00046 findXIndex(dXValue); 00047 //int iYIndex = 00048 findYIndex(dYValue); 00049 } 00050 00052 int Interpolator2D::findXIndex(double dXValue) 00053 { 00054 //Faire algo quicksort pour plus de rapidité 00055 int iXIndex = -1; 00056 00057 for (int i=0;i<_mInterpolationData->getNbXData();i++) 00058 { 00059 if (_mInterpolationData->getXValue(i) > dXValue) return iXIndex; 00060 else iXIndex = i; 00061 } 00062 return iXIndex+1; 00063 } 00064 00066 int Interpolator2D::findYIndex(double dYValue) 00067 { 00068 //Faire algo quicksort pour plus de rapidité 00069 int iYIndex = -1; 00070 00071 for (int i=0;i<_mInterpolationData->getNbYData();i++) 00072 { 00073 if (_mInterpolationData->getYValue(i) > dYValue) return iYIndex; 00074 else iYIndex = i; 00075 } 00076 return iYIndex+1; 00077 } 00078 00080 InterpolationData2D* Interpolator2D::getInterpolatedData() 00081 { 00082 return _mInterpolationData; 00083 } 00084 00085 00086 } 00087
1.4.5