pushing this.

This commit is contained in:
Yggdrasil75
2025-11-24 15:00:23 -05:00
parent 6a05161b70
commit 89596ee2be
6 changed files with 770 additions and 21 deletions

37
util/simblocks/temp.hpp Normal file
View File

@@ -0,0 +1,37 @@
#ifndef temp_hpp
#define temp_hpp
#include "../vectorlogic/vec2.hpp"
#include "../timing_decorator.hpp"
#include <vector>
#include <unordered_map>
class Temp {
private:
protected:
public:
double temp;
static double calTempIDW(const Vec2& testPos, std::unordered_map<Vec2, Temp> others) {
TIME_FUNCTION;
double power = 2.0;
double num = 0.0;
double den = 0.0;
for (const auto& [point, temp] : others) {
double dist = testPos.distance(point);
double weight = 1.0 / std::pow(dist, power);
num += weight * temp.temp;
den += weight;
}
if (den < 1e-10 && den > -1e-10) {
den = 1e-10;
}
return num / den;
}
};
#endif