确定绕组的三角测量后,2D的三角形 [英] Determine winding of a 2D triangles after triangulation
问题描述
我使用的是三角code,工程pretty的好(它处理多边形孔和JTS集成),但显然它不尊重三角形的绕组。一些输出三角形啰嗦的一种方式,有些啰嗦的另一种方式。
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 output triangles are winded one way, some are winded another way.
是否有可能对我来说,确定并纠正这些偏差三角形的缠绕?可能使用来自相邻的三角形信息,但当然越简单越好。
Is it possible for me to determine and correct the winding of these deviant triangles? Possibly using information from neighbouring triangles, but the simpler the better of course.
推荐答案
对于一个三角形ABC中,您可以通过计算叉积找到绕组(B - 一个)×(C - A)。对于2D三的,与Z = 0,只会有AZ的组成部分。
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.
要给予所有同一个绕组,交换顶点C和B,如果这z分量是负的。
To give all the same winding, swap vertices C and B if this z component is negative.
这篇关于确定绕组的三角测量后,2D的三角形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!