0
$\begingroup$

I have a triangle with the coordinates (0, 20), (15, -10), (-15, -10). So the centre of the triangle is 0,0.

I want to rotate this by one degree. Im using the formula:

x' = cos(theta)*x - sin(theta)*y
y' = sin(theta)*x + cos(theta)*y

Yet when I work out the coordinate for angle rotation of 1, I get completely inexplicable coordinates:

(-16.82941969615793, -3.3554222481086295), (16.51924443610106, 8.497441825246927), (0.31017526005686946, -5.142019577138298)

Which when plotted out looks nothing like the original triangle being rotated by 1 degree. I've made a simple demo in javascript here.

What could i be possibly doing wrong?

2 Answers 2

1

You rotate your triangle by $1 \text{rad}\approx 57.3^{\circ}$. To rotate it by $1^{\circ}$ set theta=Math.Pi/180 or theta=3.14/180

1

By an error you rotated by one radian, not $1^0$. Either use $\pi/180$ radians or $1^0$ as the correct unit chosen.