Python detect aligned segments in a mesh

时间:2017-12-18 08:38:59

标签: python geometry detection

I am searching for a method to detect the segments of a mesh that are approximately in line.

I have a set of <section data-stellar-background-ratio="0.5" class="parallax parallax_bg text-center mx-auto d-block"> <div class="parallax_text"> <h3><em>Venenatis Nisl Porta</em></h3> <p>Lorem vestibulum gravida ipsum non velit aliquam</p> <a class="btn btn-primary mt-3" href="#">Read More&nbsp;<i class="fa fa-angle-double-right" aria-hidden="true"></i></a> </div> </section> defined by their points coordinates:

quasiperiodic set of points

Then I perform a Delaunay triangulation:

triangulated set

As you can see, may elements of the mesh are forming quasi-lines. I would like to find a solid way to detect these quasi-lines...

I tried to define every segment of the mesh by a cartesian equation x, y and to parse the values y = m.x+b (an angle) and alpha = arctan(m), with a threshold system, but I am getting poor results:

detected lines

What would be your strategy to detect a maximum of those lines?

1 个答案:

答案 0 :(得分:1)

访问每个边缘并(使用您拥有的拓扑信息)找到与其共享端点的边缘。保持形成最佳对齐的那些。如果对齐在某个容差范围内,请考虑这些边是链接的。

在处理整个三角测量之后,您将拥有包含路线的一组链接列表。