Closest geometry Daniel Piker

I came across a certain script as I am attempting Frei Otto’s sand experiment with my own forms. I found a script by Daniel Piker but it seems to be asking for a password? Anyone got any ideas on how to tackle this? I have circled in red the closest Geometry which seems to be the locked component/node.

it must be a Peacock component ( a cluster)

A script by Daniel Piker signed Laurent Delrieu !!!

1 Like

Yea, I don’t recognise this definition, I don’t think it has anything to do with me. Maybe you’re thinking of @Dani_Abalde?

1 Like

If it has a password it was probably meant that you don’t go in there…

1 Like

Thanks, I have now downloaded Peacock, and got this component, although it still seems to be protected, if there is a reason ill just find another way

Yeah, it looks like mine. The cluster contains a C# component, with closest point functions for all native geometries (not only GeometryBase, also some structs like Plane, Point…), the code will be free in the next version of Peacock. The algorithm is the same as searching for the closest point in a point cloud, but replacing the point cloud with the points closest to each geometry.

ClosestGeometry(pt, geometries)
    minDist = double.MaxValue
    clstGeo = null
    for(geo in geometries)
        dist = pt.DistanceTo(ClosestPoint(pt, geo))
        if(dist < minDist)
            minDist = dist
            clstGeo = geo
    return clstGeo

ClosestPoint(pt, object)
    if( object is Brep)
       //Do brep closest point 
    if( object is Mesh)
       //Do mesh closest point