2d Local coords

Blitz3D Forums/Blitz3D Beginners Area/2d Local coords

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi

You have to know wich is the center of rotation, suppose, it's the center of the image (10.5 , 9.5 use real numbers, round at final stage)

then, the coords 4,2 relative to the center: -6.5 , 7.5
that's are OldX = -6.5, OldY = 7.5 after a rotation of "alfa" degrees NewX and NewY (respect to the center) are:

NewX = (OldX*Cos(alfa)) - (OldY*Sin(alfa))
NewY = (OldY*Cos(alfa)) + (OldX*Sin(alfa))

if alfa = 10 degrees then: NewX = -7.70361, NewY = 6.25735
(10 degrees anticlockwise, -10 if you want clockwise!)

I hope, someone has a better way (or easyer) but this should work

(remember to translate the newx and newy from center to the correct point)

Juan