Edge Function - A Little Math You Want to Know about CG

Edge 函数定义

E01(P)=(P.xV0.x)(V1.yV0.y)(P.yV0.y)(V1.xV0.x)E_{01}(P)=(P.x - V_0.x) * (V_1.y - V_0.y) - (P.y - V_0.y) * (V_1.x - V_0.x)
  • E01(P)>0E_{01}(P) > 0PPV0V1\overrightharpoon{V_0V_1}右边
  • E01(P)=0E_{01}(P) = 0PPV0V1\overrightharpoon{V_0V_1}边上
  • E01(P)<0E_{01}(P) < 0PPV0V1\overrightharpoon{V_0V_1}左边

更好记的形式: V1V0×PV0\lVert \overrightharpoon{V_1V_0} \times \overrightharpoon{PV_0} \rVert

参考

A Parallel Algorithm for Polygon Rasteriztion