Retrieve a positive or a negative angle from 3 points

前端 未结 4 395
日久生厌
日久生厌 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 03:47

    Try this, but I'm not sure:

    double v1x = Xb - Xc;
    double v1y = Yb - Yc;
    double v2x = Xa - Xc;
    double v2y = Ya - Yc;
    
    double angle = Math.Atan2(v1x, v1y) - Math.Atan2(v2x, v2y);
    

提交回复
热议问题