Proper Trigonometry For Rotating A Point Around The Origin

后端 未结 3 422
悲哀的现实
悲哀的现实 2020-12-10 12:05

Do either of the below approaches use the correct mathematics for rotating a point? If so, which one is correct?

POINT rotate_point(float cx,float cy,float          


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 12:43

    From Wikipedia

    To carry out a rotation using matrices the point (x, y) to be rotated is written as a vector, then multiplied by a matrix calculated from the angle, θ, like so:

    https://upload.wikimedia.org/math/0/e/d/0ed0d28652a45d730d096a56e2d0d0a3.png

    where (x′, y′) are the co-ordinates of the point after rotation, and the formulae for x′ and y′ can be seen to be

    alt text

提交回复
热议问题