How to rotate a vertex around a certain point?

前端 未结 6 1372
南旧
南旧 2020-11-29 04:09

Imagine you have two points in 2d space and you need to rotate one of these points by X degrees with the other point acting as a center.

float distX = Math.a         


        
6条回答
  •  暖寄归人
    2020-11-29 04:10

    1. Translate "1" to 0,0

    2. Rotate

      x = sin(angle) * r; y = cos(angle) * r;

    3. Translate it back

提交回复
热议问题