What's the opposite of polygon triangulation?

狂风中的少年 提交于 2019-12-02 01:08:15

Think of each triangle as an outline comprised of three vectors going in a counter-clockwise chain.

<--^
| /
|/ 
V

So for all the triangles in your shape, take the union of their outline vectors. If two outline vectors in the union are identical but go in opposite directions, they cancel each other out and are removed from the union.

For example, for two triangles that are side by side the union is 6 vectors

<--^^
| //|
|// |
VV-->

which reduces to 4 vectors because the two diagonal vectors in the middle cancel because they are identical but run in opposite directions:

<--^
|  |
|  |
V-->

You'll find this works for larger aggregations of triangles. Just connect the resulting vectors tail to head to get closed paths. Some of the closed paths may run clockwise, and these are holes.

<-----<-----<-----^
|                 |
|                 |
V     ^----->     ^
|     |     |     |
|     |     |     |
V     <-----V     ^
|                 |
|                 |
V----->----->----->
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!