如何判断圆弧是否顺时针?

How to determine if arc is clockwise or not?

最近我一直在为弧线及其方向而苦恼。 我的弧线建立在三个点上。我们称它们为 FirstPoint、MiddlePointLastPoint。 我需要确定它们是顺时针还是逆时针。 我从这里 Is ARC clockwise or counter clockwise? 尝试了解决方案。但是,它给了我错误的结果。我坚持这样的事情:

public bool IsClockwise()
        {
            Vector se = new Vector(LastPoint.X - FirstPoint.X, LastPoint.Y - LastPoint.Y);
            Vector sm = new Vector(MiddlePoint.X - FirstPoint.X, MiddlePoint.Y - FirstPoint.Y);
            double cp = Vector.CrossProduct(se, sm);
            if (cp > 0)
            {
                return true;
            }
            else return false;
        }

有什么想法吗?

试试这个。在您的示例中,您将 se 计算为

Vector se = new Vector(LastPoint.X - FirstPoint.X, LastPoint.Y - LastPoint.Y);

请注意,第二项始终为零。

另外,你的两个向量应该是从中点到第一个点,以及从中点到最后一个点。我想您 可以 使用从第一个点到中点和最后一个点的向量,但这实际上不是通常的做法。就是感觉不对。

    public bool IsClockwise()
    {
        Vector se = new Vector(LastPoint.X - MiddlePoint.X, LastPoint.Y - MiddlePoint.Y);
        Vector sm = new Vector(FirstPoint.X - MiddlePoint.X, FirstPoint.Y - MiddlePoint.Y);
        double cp = Vector.CrossProduct(se, sm);

        return cp > 0;
    }