1
Graphics / Re: Do these three features exist?
« on: March 08, 2020, 08:25:18 pm »
An easy way to do this is with a matrix:
let's say you have a center of rotation, C, and an angle of rotation, A.
your shape is made of a bunch of little shapes - you can just apply this transformation to each one.
let's say your shape's vertices are {(x,y), (x1, y1), (x2,y2)}
create a new shape with vertices at {(x-C, y-C), (x1-C, y1-C), (x2-C, y2-C)}
apply the 2D rotation matrix (oh boy how do I format this):
[cos(A) -sin(A)]
[sin(A) cos(A)]
to each one of the new shape's vertices and then just add C back to each one.
Apply this to every one of your shapes and they will rotate exactly!
let's say you have a center of rotation, C, and an angle of rotation, A.
your shape is made of a bunch of little shapes - you can just apply this transformation to each one.
let's say your shape's vertices are {(x,y), (x1, y1), (x2,y2)}
create a new shape with vertices at {(x-C, y-C), (x1-C, y1-C), (x2-C, y2-C)}
apply the 2D rotation matrix (oh boy how do I format this):
[cos(A) -sin(A)]
[sin(A) cos(A)]
to each one of the new shape's vertices and then just add C back to each one.
Apply this to every one of your shapes and they will rotate exactly!