Manually rotating points around center
Posted: Tue May 24, 2011 9:56 pm
Say I have a bunch of points in a shape, or even one single point or two or whatever.
Now I have a center point. How do I rotate each point? (Obviously I just need to know how to rotate based on an offset.)
I already know how to place a point at an angle based on a fixed distance and a center point.
I just don't know how to take points that already exist and move them around a center.
If I can avoid having to use Box2D even just for calculations that would be nice.
Now I have a center point. How do I rotate each point? (Obviously I just need to know how to rotate based on an offset.)
I already know how to place a point at an angle based on a fixed distance and a center point.
Code: Select all
x = center_x + (math.sin((angle) * pi / 180) * (distance))
y = center_y + (math.cos((angle) * pi / 180) * (distance))
If I can avoid having to use Box2D even just for calculations that would be nice.