test: where is the NaN coming from

This commit is contained in:
Virt 2024-07-10 14:55:27 +02:00
commit 9734c78394

View file

@ -1,4 +1,5 @@
#include "../config/config.hpp"
#include "src/debug/Log.hpp"
#include "src/macros.hpp"
#include <cmath>
#include "ModeRotate.hpp"
@ -13,6 +14,8 @@ SModeResult CModeRotate::update(Vector2D pos) {
auto length = g_pShapeRuleHandler->getIntOr(CONFIG_ROTATE_LENGTH, **PLENGTH);
auto offset = g_pShapeRuleHandler->getFloatOr(CONFIG_ROTATE_OFFSET, **POFFSET);
Debug::log(LOG, "[dynamic-cursors] rotate: pos.x = {}, pos.y = {}", pos.x, pos.y);
// translate to origin
end.x -= pos.x;
end.y -= pos.y;
@ -32,6 +35,8 @@ SModeResult CModeRotate::update(Vector2D pos) {
angle += PI;
angle += offset * ((2 * PI) / 360); // convert to radiants
Debug::log(LOG, "[dynamic-cursors] this is it: angle = {}, end.x = {}, end.y = {}, offset = {}", angle, end.x, end.y, offset);
// translate back
end.x += pos.x;
end.y += pos.y;