Determine rotation direction /toward/ variable point on a circle

℡╲_俬逩灬. 提交于 2019-12-02 08:27:35

Just compute winding direction of triangle ABC

so if you compute normal n=(B-A)x(C-B) where x is cross product then n.z sign determine the direction.

n.z = ((B.x-A.x)*(C.y-B.y)) - ((B.y-A.y)*(C.x-B.x))
if (n.z<0.0) dir=CW else dir=CCW;

that is all you need (CW means clockwise and CCW counter clockwise) of coarse if your coordinate system is different then the rotation can be negated

[Notes]

if (n.z==0) then the points B,C are either opposite or identical so direction does not matter because both ways the angular distance is the same

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!