pushing to work.

This commit is contained in:
yggdrasil75
2025-11-25 05:36:01 -05:00
parent 72c318a320
commit 872cf3db1a
3 changed files with 226 additions and 129 deletions

View File

@@ -13,6 +13,26 @@ protected:
public:
double temp;
Temp(float temp) : temp(temp) {};
Temp(const Vec2& testPos, const std::unordered_map<Vec2, Temp>& others) {
TIME_FUNCTION;
double power = 2.0;
double num = 0.0;
double den = 0.0;
for (const auto& [point, tempObj] : others) {
double dist = testPos.distance(point);
double weight = 1.0 / std::pow(dist, power);
num += weight * tempObj.temp;
den += weight;
}
if (den < 1e-10 && den > -1e-10) {
den = 1e-10;
}
this->temp = num / den;
}
static double calTempIDW(const Vec2& testPos, std::unordered_map<Vec2, Temp> others) {
TIME_FUNCTION;