Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triangulator running out of memory #1646

Open
OndonH opened this issue Apr 23, 2024 · 1 comment
Open

Triangulator running out of memory #1646

OndonH opened this issue Apr 23, 2024 · 1 comment

Comments

@OndonH
Copy link

OndonH commented Apr 23, 2024

Description

I have a simple polygon (non self-intersecting), with approx. 300 points, see below:

image

When I am running polygon triangulation using Panda3D triangulator module, it keeps running for approx. 20 minutes (in a Python testing framework) until it uses all available memory. Then it gets terminated by the system:

Remote Execution Failure:
Resource Exhausted: rpc error: code = ResourceExhausted desc = OUT_OF_MEMORY on runID 147....

I already tried to simplify the polygon by running Shapely simplify method, I also added a custom method for eliminating vertices with very sharp angles but nothing helped - the error is very consistent.

Steps to Reproduce

Supply points of a polygon to Triangulator and run triangulate:

def _triangulate_poly(poly: Polygon) -> List[Polygon]:
    t = Triangulator()
    for x, y in poly.exterior.coords[:-1]
        idx = t.addVertex(x, y)
        t.addPolygonVertex(idx)

    for interior in poly.interiors:
        t.beginHole()
        for x, y in interior.coords[:-1]:
            idx = t.addVertex(x, y)
            t.addHoleVertex(idx)
    t.triangulate()
    ...

Environment

  • Operating system: Ubuntu 20.04
  • System architecture: Intel Xeon, 64-bit, 8-core
  • Panda3D version: 1.10.14
  • Installation method: pip3
  • Python version (if using Python): 3.8.10
@OndonH
Copy link
Author

OndonH commented Apr 23, 2024

I simplified the polygon above with threshold of 20 cm (the polygon represents real world geo data), using shapely polygon simplification method, and thereafter the triangulator was able to finish successfully.
Unfortunately, 20 cm simplification is too strong for my applications and introduces unacceptable changes in the geometry, therefore I cannot consider it as a solution / workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant