Retrieve a positive or a negative angle from 3 points

前端 未结 4 409
日久生厌
日久生厌 2020-12-17 03:13

I am rotating points around a center point in 2D space. The points are the center point, the old mouse position, and the new mouse position. My rotation function works fin

4条回答
  •  忘掉有多难
    2020-12-17 04:02

    Given vectors (x1,y1) and (x2,y2), I would suggest computing the cross product and dot product, and then using Atan2() on them. That will work in all cases where both vectors are non-zero and vector lengths are "reasonable".

提交回复
热议问题