📜  检查点是矢量的左侧还是右侧 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:45.369000             🧑  作者: Mango

代码示例1
Check position of point M(X, Y) relative to vector AB with points A(Ax, Ay) and B(Bx, By):

position = sign((Bx - Ax) * (Y - Ay) - (By - Ay) * (X - Ax))

M is:     +1 left,
        -1 right,
        0 on the vector AB