[vtkusers] marching-cubes and scalar distance field update

Anders Wallin anders.e.e.wallin at gmail.com
Wed Aug 11 06:02:16 EDT 2010


Hi group,

I am making a cutting-simulation for cnc mills/lathes which uses an
octree to model the stock volume. My first attempt looks like this:
http://www.youtube.com/watch?v=9sctWgd_5rs
The idea is to subtract a tool-volume from the stock-volume, then move
the tool slightly, and iterate.

Instead of rendering cubes, it looks much better if a signed
distance-function is stored at each octree-vertex. The function is
negative inside the cutter, zero on the surface of the cutter, and
positive outside. Marching-cubes is then used to produce surface
triangles (f=0 isosurface) from the octree.
With a spherical cutter at one position it looks good:
http://tinyurl.com/336ku9j
The white dots are corners of octree-nodes, the cyan triangles are
produced by marching-cubes.
But when I then re-position the cutter and update my octree, I get
gaps in the marching-cubes surface like this:
http://tinyurl.com/35resyc
or at a lower resolution:
http://tinyurl.com/378w5r8

questions:
- any ideas on how the scalar field should be updated correctly so
there are no gaps after marching-cubes runs? There will be 1000s of
these cutter-positions so I obviously don't want to store and check
against the implicit distance-function of each cutter-position.
- I am doing the octree and marching-cubes in my own code now, only
using VTK for rendering triangles and points. Is there something in
VTK that I could/should use instead? My octree is a cube of specified
side-length, the distance function is evaluated at the eight vertices
of the cube, and the cube is subdivided up to a maximum specified
tree-depth based on the vertex-values.

thanks,
Anders
(If there's a better list for these rather general
graphics/visualization topics, let me know!)



More information about the vtkusers mailing list