I am trying to determine the rotation of a specific point in terms of its top and left positions. It's proving to be quite complex as it involves knowing the original top and left coordinates, applying scaling, and then calculating the rotation.
Currently, my approach is as follows: (original left: -350, original top: -10, f1_scale: 0.544444, rotation angle: -30deg)
function sin(x) {
return Math.sin(x / 180 * Math.PI);
}
function cos(x) {
return Math.cos(x / 180 * Math.PI);
}
function rotate(x, y, a) {
var x2 = cos(a) * x - sin(a) * y;
var y2 = sin(a) * x - cos(a) * y;
return [x2, y2];
}
var scaledLeft = -350 * f1_scale;
var scaledTop = -10 * f1_scale;
var rotateOut = rotate(scaledLeft, scaledTop,-30);
While this code successfully rotates the left (x) coordinate, the y coordinate seems to be inaccurate.
If anyone can spot the mistake in my approach or has experience with this kind of calculation, I would greatly appreciate any insights.
Thank you for your help.