Grasshopper

algorithmic modeling for Rhino

# Marching Cubes in Grasshopper

Hey all,

Thought I would share this script for doing the marching cubes algorithm in Grasshopper.  It seems to have popped up in conversations a lot, but I've never seen one posted on this forum yet.  Its derived from the method Daniel Piker used for doing Marching Tetrahedra (I've lost the thread) and just takes advantage of the meshing rules in Paul Bourkes article here: http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/

This case just creates the iso-surface by randomly reducing nodes in the 3d cube matrix.  It can be reorganised also to create iso-surfaces from functions.

Views: 7609

Attachments:

### Replies to This Discussion

Thanks a lot Adam! Have you tried the marching cube algorithm and Iso-Surfaces in the new Millipede tools? Is it quite similar? Can any point in space be “polygonised” or do the points have to come from an f(x,y,z) equation?

Hey Arthur,

You can rearrange the definition so that you can pick points within the space of the grid and then find the nearest points to those in the cubic grid (the higher the resolution, the more accurate that will be).  If you are trying to reconstruct a surface from a point cloud you will also need some way of telling what space is on one side of the surface and what is on the other (i.e. normal vectors) in order to create iso-values for the marching cube algorithm.

I am not sure what is going wrong, but the script you posted "Marching Cubes" does not produce geometry at the end. do you know where am I doing wrong?

thank you in advanceMarchingCubes%20%281%29.gh