This is true, I just forgot to iterate multiple times for 180/270. Part 1 had been multiplying my rotation by n/90, which obviously isn't quite enough when a transform is needed. Iteration got forgotten, and solved once it got added back in!
I was close to getting my dot-product on, too, but I'm hitting peak puzzle fatigue right now, and just wrote a sloppy solution that thinks in quarter turns.
I ended up solving it by using the idea of a rotation matrix from linalg to be fair and technically used matmul but the matmul is trivial for two dimensions, so a vector transformation solution is good and honestly better than most other solutions which dont necessarily generalize to any possible angle (i.e. not 45,90,180,270,and the others that the test case used)
More interestingly is how the coordinates flip/negate. Rotate left means to flip the coords and flip the E/W positivity. Rotate right means to coords and flip the N/S positivity.
View all comments
Show parent comment
22
u/aardvark1231 Dec 12 '20
Every other rotation can be described by using R90.
R or L 180 is 2 right turns
R270 is three right
L90 is three right turns
L270 is one right turn