drufat/triangle

Segmentation fault while doing multiple loop in ubuntu.

aasmanbashyal opened this issue · 2 comments

          I am also getting the segmentation fault while running it on ubuntu. But while running it on windows there is no problem.
import faulthandler
# Enable fault handler
faulthandler.enable()
import triangle as tr
import numpy as np

def delaunay_triangulation(pts, segments):
    """
    Apply constrained delaunay triangulation
    https://rufat.be/triangle/API.html
    """
    pts = np.array(pts[:-1])
    segments[-1][1] = 0

    t = tr.triangulate({"vertices": pts[:, 0:2], "segments": segments}, 'p')

    if 'triangles' not in t:
        return []

    triangulated_pts = [pts[triangle] for triangle in t['triangles'].tolist()]

    return triangulated_pts

boundary_pts = [[1383, 171, 18.0], [1998, 0, 9.170907020568848], [2378, 750, 18.0], [660, 1483, 18.0], [0, 551, 4.605607986450195], [0, 551, 4.605607986450195], [1383, 171, 18.0]]
boundary_segments =[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]]

for i in range(100):
    triangulated_pts = delaunay_triangulation(pts=boundary_pts, segments=boundary_segments)
    print(f" is {triangulated_pts}")

faulthandler.disable()

The error i get: Current thread 0x00007fcae2b78740 (most recent call first):
File "/usr/local/lib/python3.8/dist-packages/triangle/tri.py", line 73 in triangulate
File "testtriangle.py", line 15 in delaunay_triangulation
File "testtriangle.py", line 28 in

Originally posted by @aasmanbashyal in #68 (comment)