简体   繁体   English

确定三角测量后二维三角形的缠绕

[英]Determine winding of a 2D triangles after triangulation

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. 我正在使用效果很好的三角测量代码(它处理带孔的多边形并与JTS集成)但显然它不尊重三角形的缠绕。 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. 可能使用来自相邻三角形的信息,但当然越简单越好。

For a triangle ABC, you can find the winding by computing the cross product (B - A) x (C - A). 对于三角形ABC,您可以通过计算叉积(B - A)x(C - A)来找到绕组。 For 2d tri's, with z=0, it will only have az component. 对于2d tri,z = 0,它只有az分量。

To give all the same winding, swap vertices C and B if this z component is negative. 要给出所有相同的绕组,如果此z分量为负,则交换顶点C和B.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM