Curve.ClosestPoints in PointCloud?

Hi there,

I have been asking myself if there is a similar thing for Curve.ClosestPoints for a pointcloud?
I am very happy about PointCloud.ClosestPoint, which I think is working superfast in my case and I am really happy about it!

I would now chose to iterate through the 42.000.000 points of my pointcloud but that’s a bit time consuming. As the ClosestPoint method is working so welll, the question would be:
Is there any chance to do the same for a curve?

Thanks,
T.

Hi @tobias.stoltmann,

No, there is no function in the Rhino SDK that will determine which geometric object is closest to a point cloud. I’m not sure what a good strategy is here - I guess it spends on what you need.

– Dale

@dale sorry for the late reply…

What I saw is that the ClosestPoint command works super fast in my eyes.
That’s why I thought that there must be some option in Rhinocommon.
Would the only chance to automize this is via scripting the commandline?

In general it would be nice to have in RhinoCommon because this is a very effective and efficient way to analyze pointclouds in my eyes.

Thanks,
T.

Try to use RTree instead of point cloud.

@Wiley
Thanks for the input, what is the benefit from using the RTree?
Also it only provides a PointClosestPoints Method.
I assume you mean to divide the curve into an almost endless amount of points and get the closest point like that? I have a similar approach using the PointCloud class, which is not soo bad, but also not as fast as the command.

There could be a lot of ways to do what you want to do. Finding the closest point is a simple process.

If you want something quick and dirty, use divide curve and then use RTree to find the closest point. RTree is likely the fastest workaround so if you want to advance your knowledge probably good to dig a bit deeper

R-tree - Wikipedia.

you might also want to use something like Region, to check if the point is included in an offsetted region

Before we could pitch in a bit more, you need to describe what you try to accomplish though.