ARC是顺时针还是逆时针? [英] Is ARC clockwise or counter clockwise?
问题描述
我有一个ARC.对于ARC,我有以下信息:
I have an ARC. For ARC I have an below information :
- 起点.
- 终点.
- ARC的另一个第三点.
- 中心点.
下图显示了详细信息:
现在的问题是如何检查ARC是顺时针还是逆时针?
Now the question is how to check ARC is clock wise or counter clockwise?
推荐答案
在 2D 中,您可以利用叉积,该乘积将垂直向量返回到相乘的向量.它指向的那一侧取决于乘数(CW/CCW)的顺序,因此,如果获得向量 v1,v2
,则 v1 x v2 =-(v2 x v1)
.如果 v1,v2
是2D向量,则其交叉结果仅位于 Z坐标中,因此:
In 2D you can exploit cross product which returns perpendicular vector to vectors multiplied. The side on which it points is dependend on the order of multiplicants (CW/CCW) so if you got vectors v1,v2
then v1 x v2 = - (v2 x v1)
. if v1,v2
are 2D vectors then the result of their cross lies only in Z-coordinate so:
让我们的起点是 SP ,终点是 EP ,中间点是 MP .
表单向量 SE = EP-SP 和 SM = MP-SP ,并计算其叉积的 Z坐标的符号.
Let's starting point is SP, ending point is EP, and some middle point is MP.
Form vectors SE = EP - SP and SM = MP - SP and calculate the sign of Z-coordinate of their cross product.
CP = SE.X * SM.Y - SE.Y * SM.X
如果叉积为正,则弧为顺时针,如果叉积为负,则弧为逆时针(或者反之亦然,这取决于您定义 2D坐标系的方式).
Arc is clockwise if cross product is positive and anti-clockwise if negative (or the other way around it depends on how is your 2D coordinate system defined).
这篇关于ARC是顺时针还是逆时针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!