[vtkusers] Displaying the intersection of a plane with a bunch of spheres
David.Pont at ensisjv.com
David.Pont at ensisjv.com
Sun Oct 7 16:32:04 EDT 2007
"Steve Chall" <stevec at renci.org> wrote on 06/10/2007 07:35:07:
> 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.
>
> I’ve been working with VTK now for some time in pursuit of a solution and
> haven’t really come to a satisfactory conclusion. I’ve 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 I’m not worrying about
> interactively moving the plane around: I’ve just got it set through the
> middle of the cluster of spheres so that I know, because I can see it,
that
> there’s 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). I’ve tried looking at
various
> subsets – just the sphereUnion, just the plane, etc. – and I see what I
> expect. But I’d 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 I’m 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
probe’s
> 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 I’d expect – but I don’t see any probe’d
> data at all.
>
> Does either of these approaches look promising, or is there an entirely
> different direction that’s more likely to produce useful results? I’d
> 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.
You should try this: create your spheres as polydata objects with
vtkSphereSource (instead of implicit spheres with vtkSphere) and merge into
one data set with vtkAppendPolyData. Create an implicit plane with vtkPlane
(as before) and use vtkCutter to generate the 2D slice through your
polydata spheres. You should get 'circular' polylines (and/or points),
increase the resolution in vtkSphereSource to get better approximation to
circles (better calamari ;-).
You can also cut more complex shapes this way, so long as you can represent
them as polydata. Performance with this approach should be OK, unlike an
approach based on vtkSampleFunction -> vtkContourFilter which typically
requires high sampling density to get acceptable resolution. 38K particles
is quite a few so vtkCutter will be busy but using vtkSampleFunction on
this problem would be an order of magnitude (or 2) slower.
If you really need to specify the particles as implicit functions you would
use vtkSampleFunction -> vtkContour to turn them into polydata and then
apply vtkCutter on the polydata, that way if you want to move the cutting
plane around you will not have to re-execute vtkSampleFunction.
HTH, Dave P
>
> Steve
>
> -Steve Chall
> Senior Research Software Developer
> Renaissance Computing Institute
> Phone: 919-515-0051
> Email: stevec at renci.org
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.
> org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071008/06959518/attachment.htm>
More information about the vtkusers
mailing list