You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/GVision/WinIDW/-IDWCalculation.h

30 lines
1.0 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include <vector>
using namespace std;
class IDWCalculation
{
public:
~IDWCalculation();
void SetData(vector<double>& vecX, vector<double>& vecY, vector<double>& vecZ);
void SetData(vector<array<double, 3>> data);
double GetValue(double x, double y);
public:
/************************************************************************/
/* 默认值为2。一般0.5到3的值可获得最合理的结果
/* 通过定义更高的幂值,可进一步强调最近点。因此,邻近数据将受到更大影响,
表面会变得更加详细(更不平滑)。随着幂数的增大,内插值将逐渐接近最近采样点的值。
指定较小的幂值将对距离较远的周围点产生更大的影响,从而导致平面更加平滑。
由于反距离权重公式与任何实际的物理过程都不关联,因此无法确定特定幂值是否过大。
作为常规准则认为值为30的幂是超大幂因此不建议使用。此外还要牢记一点如果距离或幂值较大则可能生成错误结果。*/
/************************************************************************/
double m_factor = 2.5;
private:
vector<double>* m_pX;
vector<double>* m_pY;
vector<double>* m_pZ;
BOOL m_bCreated = FALSE;
};