Share my code "Clockwise Rotation"
from (A, B) to (X,Y)
#include "math.h"
double atan(double);
float atanf(float);
int16_t iA, iB, iX, iY;
float fAngle, fDistance, fRotate;
fAngle = atan2f (iB, iA);
fDistance = sqrt(pow(iA,2) + pow(iB,2));
iX = fDistance * cos(fAngle - fRotate);
iY = fDistance * sin(fAngle - fRotate);
Best Regards,
Aaron
Reference:
Determining clockwise vs counter clockwise rotations
Determining angle of rotation