Determine winding of a 2D triangles after triangulation

前端 未结 1 1100
难免孤独
难免孤独 2021-02-09 20:31

I\'m using triangulation code that works pretty well (it processes polygons with holes and integrates with JTS) but apparently it doesn\'t respect the winding of triangles. Some

1条回答
  •  囚心锁ツ
    2021-02-09 21:29

    For a triangle A B C, you can find the winding by computing the cross product (B - A) x (C - A). For 2d tri's, with z=0, it will only have a z component.

    To give all the same winding, swap vertices C and B if this z component is negative.

    0 讨论(0)
提交回复
热议问题