Jump to content

Recommended Posts

Posted

https://github.com/mapbox/concaveman

https://github.com/sadaszewski/concaveman-cpp

 

it’s not automatic in that it requires parameters depending on the point distribution.

 

concavity: A relative measure of concavity. A value of 1 provides a detailed shape, while Infinity results in a convex hull.

lengthThreshold: Determines the minimum segment length considered for further detailing, with higher values leading to simpler shapes.   

 

Chomped through this 280k point set

 

import traceback
from pyrx import Ap, Db, Ed, Ge
 
# --- Command for PyRx ---
@Ap.Command()
def doit0():
    try:
        ps, ss = Ed.Editor.select([(Db.DxfCode.kDxfStart, "POINT")])
        pnts = Ge.Point3dArray([Db.Point(id).position() for id in ss])
        hull_points = pnts.concaveHull(0.8, 100)
        
        db = Db.curDb()
        pl = Db.Polyline(hull_points)
        pl.setDatabaseDefaults()
        pl.setClosed(True)
        pl.setColorIndex(2)
        db.addToModelspace(pl)
        
    except Exception:
        traceback.print_exc()

concave2.png.6f014fa98ef8155659ab04a2859d9087.png

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...