fwt_software/src/core/Geometry.cpp

19 lines
481 B
C++

#include "fgc/Geometry.h"
#include <algorithm>
#include <cmath>
namespace fgc {
long AxisMap::toCounts(double deg) const {
double clamped = std::clamp(deg, min_deg, max_deg);
return std::lround(static_cast<double>(zero_count) + clamped * counts_per_deg);
}
double AxisMap::toDeg(long counts) const {
if (std::abs(counts_per_deg) < 1e-9) return 0.0;
return (static_cast<double>(counts) - static_cast<double>(zero_count)) / counts_per_deg;
}
} // namespace fgc