Files
hexapod-robot/2011-firefly-mega-ssc32/firmware/2011-nunchuk/hexapod_oud/atan2.cpp
T
mangavalk fe472bfce9 FireFly 2011: Arduino Mega + SSC-32, Wii Nunchuk, preset walking sequences
From Electronics\Hexapod\Arduino sketches 2011-2012\hexapod_oud (banner 'Version 3.0').
2011-10-09 15:56:03 +02:00

16 lines
257 B
C++

// atan2.cpp
#include "atan2.h"
void joy::JoyToDegAndDis (int x, int y)
{
deg = !(90 + degrees(atan2(y, x)));
distance = sqrt(y^2 + x^2);
}
int joy::JoyToDeg (int x, int y)
{ // watchout 90 + does not work good
return !(degrees(atan2(y, x)));
}