[vtkusers] Displaying the intersection of a plane with a bunch of spheres
Steve Chall
stevec at renci.org
Fri Oct 5 14:35:07 EDT 2007
I want to generate a 3D rectangular volume of ~38,000 closely packed,
sometimes overlapping "particles" - initially spheres simply defined as a
list of centroids and a parallel list of radii, more complex objects later
on - and interactively look at arbitrary slices through the volume, with the
particle intersections represented as disks or circles in the 2D slice (down
to a single pixel, of course, if the slice is tangent to the surface of a
"particle"). Due to the number of "particles" I think performance scaling
issues might also be a concern at some point.
Ive been working with VTK now for some time in pursuit of a solution and
havent really come to a satisfactory conclusion. Ive tried the following
two approaches thus far:
1) Implicit booleans: I read in the sphere positions and radii and
construct a vtkSphere for each one. As I do that I add each to a
vtkImplicitBoolean object sphereUnion with the operation type set to
union. I then create a vtkPlane object (right now Im not worrying about
interactively moving the plane around: Ive just got it set through the
middle of the cluster of spheres so that I know, because I can see it, that
theres a non-empty intersection between the plane and some of the
spheres). Then I create another vtkImplicitBoolean called slice and add
to it the sphereUnion and the plane with operation type set to
intersection. I run slice into a vtkSampleFunction, that into a
vtkContourFilter into a vtkPolyDataMapper into a vtkActor and into a
vtkRenderer (the standard textbook sequence). Ive tried looking at various
subsets just the sphereUnion, just the plane, etc. and I see what I
expect. But Id think that the intersection of a bunch of spheres and a
plane would look like calamari or sausage slices: a cluster of rings or
disks on a 2D surface. However, what Im seeing is a strange cluster of
lumpy, irregular 3D objects scattered through the 3D sample space that
perhaps roughly correspond to some or all of the original spheres. Thus far
I haven't made any sense of it. So on to the second approach:
2) Polygons: I create the vtkSpheres, but this time convert each into a
vtkPolyData object (vtkSphere -> vtkSampleFunction -> vtkContourFilter) and
add the resulting polygonal sphere to a vtkAppendPolyData object. I create
a vtkPlaneSource object (the polygonal equivalent to the vtkPlane implicit
surface object in approach 1 above) and a vtkProbeFilter. I set the probes
input connection to the vtkPlaneSource and its source connection to the
vtkAppendPolydata object (the spheres) and then from there into the usual
pipeline to the renderer. Once again I think the subunits are ok I can
display them and they look like Id expect but I dont see any probed
data at all.
Does either of these approaches look promising, or is there an entirely
different direction thats more likely to produce useful results? Id
appreciate any insights you might have. I can provide source code if it
would make it any clearer. Thanks for any help you can provide.
Steve
-Steve Chall
Senior Research Software Developer
Renaissance Computing Institute
Phone: 919-515-0051
Email: stevec at renci.org
More information about the vtkusers
mailing list