# MeshClosestPoint - Minimal 3d shape with tolerance - Virtual point cloud of 3d shape

Hi,
Has anyone studied the possibility to produce more detailed simple model than BoundingBox or MinimalBoundingBox? I wonder if there’s a way to find the closest points in 3d point array with parametric tolerance / point distance to find outer limits of simplified 3d shape?

If you use ReduceMesh, then it will ultimately lose some of the polygon connections and alter the outer limits of the original 3d shape. This idea would be 3D point array bounding shape type of solution without losing the original outer limits.

I think the point array for the 3d coordinates will not be an issue, but how to draw that shape in 3d? It’s basically a virtual point cloud of the original shape So, any suggestions and ideas? Or hint if there’s a ready solution already to be found?

There is already a mathematical definition of what is a minimal bounding-box called the Principal Component Analysis.

I implemented this in OpenNest. Yes it depends on points, but depending on geometry i.e. meshes there is one to one correspondence since mesh is a pointcloud with graph data. For smooth objects there is another story. But this could be starting point.

https://doc.cgal.org/latest/Principal_component_analysis/index.html

Essentially it is not the minimal bounding box what you are searching but the most optimal plane orientation.

1 Like

I mean to create a solid 3D model of virtual point cloud with parametric tolerance or resolution so that it’s not just a box, but presents the original 3D form more accurately.

You mean this?
All depends on a data-set you are using.
I.e. Poisson Surface Reconstruction, Ball Pivoting, Alpha Shape3D

Yes, it looks more like what I meant. So, if I create a virtual point cloud using 3d array of points to find MeshClosestPoint for every point in the array, I could draw the shape with CMP from python/rhinoscript when plugin installed?

Is there a documentation for CMP command, if I use it in pythonscript directly?

This is Rhino Plugin. Probably there is a way to call RhinoCommands.

Also I am doing a Cockroach Grasshopper plugin, so ideally you could call method in .NET IronPython you are using.

Also it depends on pointset so it is hard to tell if you even need surface reconstruction without knowing what you are doing.

So now I get just a block version of the original 3d shape, but it’s too “blocky”

If CMP command would take the virtual point cloud made with MeshClosestPoint it would look much better. But could it use just points in an 3d array or does it need an actual point cloud?

I think you better do smth to this since you already have 3d models:
You can do similar to what Piker was doing using mesh closest point or his shrink wrap meshing

That’s a cool method too, and useful for many cases I can think of. Shrink wrap was the first idea to approach this problem, but I think the mesh closest point method would be more what I need at this point and would be faster than iterative solution like shrink wrap. But I will take a closer look at that solution too, 'cos I know there are applications for that too!

But if the CMP command takes the actual point cloud as an input, could it be used after making an actual point cloud at first?

And select the point cloud temporarily created and make it a 3d model?