====== XInterpolator ====== **//Inherited from//** [[class::spacehashbucket|SpaceHashBucket]], **//Inherited by//** NULL **//Friend class//** NULL **//Description//** XInterpolator从SpaceHashBucket继承以适配器模式封装了插值器接口,插值器基于空间数据点云构建空间哈希索引,给定任意坐标通过不同插值算法计算得到该坐标下的值,通过继承XInterpolatorMethod可支持扩展不同的插值算法。 **//Members//** * TypeID m_iMethod = [[xinterpolator#-1|-1]] * XInterpolatorMethod * m_pMethod = [[xinterpolator#0|0]] **//Public interface//** * static bool [[xinterpolator#registermethod|registerMethod]](TypeID t, InterpolateCtor ctor) * [[xinterpolator#xinterpolator1|XInterpolator]]() * void [[xinterpolator#setmethod|setMethod]](TypeID t) * TypeID [[xinterpolator#getmethod|getMethod]]() const * void [[xinterpolator#setdatapoints|setDataPoints]](vector * dataPoints, XCoordSystem * coordSys = 0) * double [[xinterpolator#interpolateat|interpolateAt]](const double * pos) * bool [[xinterpolator#interpolateat|interpolateAt]](vector * pts, vector * values) ---- {{anchor:-1}} **TypeID m_iMethod = -1** {{anchor:0}} **XInterpolatorMethod * m_pMethod = 0** ---- {{anchor:registermethod}} **static bool registerMethod(TypeID t, InterpolateCtor ctor)** *function: 注册插值算法 *parameters: - [i]TypeID t: 插值类型ID - [i] InterpolateCtor ctor: 插值类构造函数 *return value: 注册成功返回true,否则返回false {{anchor:xinterpolator1}} **XInterpolator()** *function: 构造函数 *parameters: NULL *return value: 无 {{anchor:setmethod}} **void setMethod(TypeID t)** *function: 设置当前的插值方法 *parameters: - [i]TypeID t: 插值方法ID *return value: 无 {{anchor:getmethod}} **TypeID getMethod() const** *function: 获取当前的插值方法ID *parameters: NULL *return value: 插值方法ID {{anchor:setdatapoints}} **void setDataPoints(vector * dataPoints, XCoordSystem * coordSys = 0)** *function: 输入源数据点云构建空间哈希索引 *parameters: - [i]vector * dataPoints: 数据点数组 - [i] XCoordSystem * coordSys = 0: 局部坐标系 *return value: 无 {{anchor:interpolateat}} **double interpolateAt(const double * pos)** *function: 将源数据场插值到位置pos上 *parameters: - [i]const double * pos: 待插值的空间坐标 *return value: 在pos上的值 {{anchor:interpolateat}} **bool interpolateAt(vector * pts, vector * values)** *function: 将源数据场插值到一组空间点上 *parameters: - [i]vector * pts: 待插值的空间坐标数组 - [o]vector * values: 在空间坐标点数组上的值,与输入的空间坐标数组一一对应 *return value: 插值成功返回true,否则返回false