<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
tt
        {font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=black face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:black'>Thanks, David.&nbsp; This looks eminently
doable and makes plenty of sense.&nbsp; I'm going to try it today.<br>
<br>
-Steve</span></font><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=3 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
David.Pont@ensisjv.com [mailto:David.Pont@ensisjv.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Sunday, October 07, 2007
4:32 PM<br>
<b><span style='font-weight:bold'>To:</span></b> Steve Chall<br>
<b><span style='font-weight:bold'>Cc:</span></b> 'Theresa-Marie Rhyne'; <st1:PersonName
w:st="on">vtkusers@vtk.org</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [vtkusers] Displaying
the intersection of a plane with a bunch ofspheres</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p><tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>&quot;Steve
Chall&quot; &lt;stevec@renci.org&gt; wrote on 06/10/2007 07:35:07:</span></font></tt><font
size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><br>
<br>
<tt><font face="Courier New">&gt; I want to generate a 3D rectangular volume of
~38,000 closely packed,</font></tt><br>
<tt><font face="Courier New">&gt; sometimes overlapping &quot;particles&quot; -
initially spheres simply defined as a</font></tt><br>
<tt><font face="Courier New">&gt; list of centroids and a parallel list of
radii, more complex objects later</font></tt><br>
<tt><font face="Courier New">&gt; on - and interactively look at arbitrary
slices through the volume, with the</font></tt><br>
<tt><font face="Courier New">&gt; particle intersections represented as disks
or circles in the 2D slice (down</font></tt><br>
<tt><font face="Courier New">&gt; to a single pixel, of course, if the slice is
tangent to the surface of a</font></tt><br>
<tt><font face="Courier New">&gt; &quot;particle&quot;). &nbsp;Due to the
number of &quot;particles&quot; I think performance scaling</font></tt><br>
<tt><font face="Courier New">&gt; issues might also be a concern at some point.</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; I&#8217;ve been working with VTK now for some time
in pursuit of a solution and</font></tt><br>
<tt><font face="Courier New">&gt; haven&#8217;t really come to a satisfactory
conclusion.&nbsp; I&#8217;ve tried the following</font></tt><br>
<tt><font face="Courier New">&gt; two approaches thus far:</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; 1) Implicit booleans:&nbsp; I read in the
sphere positions and radii and</font></tt><br>
<tt><font face="Courier New">&gt; construct a vtkSphere for each one.&nbsp; As
I do that I add each to a</font></tt><br>
<tt><font face="Courier New">&gt; vtkImplicitBoolean object &#8220;sphereUnion&#8221; with
the operation type set to</font></tt><br>
<tt><font face="Courier New">&gt; union.&nbsp; I then create a vtkPlane object
(right now I&#8217;m not worrying about</font></tt><br>
<tt><font face="Courier New">&gt; interactively moving the plane around:&nbsp;
I&#8217;ve just got it set through the</font></tt><br>
<tt><font face="Courier New">&gt; middle of the cluster of spheres so that I
know, because I can see it, that</font></tt><br>
<tt><font face="Courier New">&gt; there&#8217;s a non-empty intersection between the
plane and some of the</font></tt><br>
<tt><font face="Courier New">&gt; spheres).&nbsp; Then I create another
vtkImplicitBoolean called &#8220;slice&#8221; and add</font></tt><br>
<tt><font face="Courier New">&gt; to it the sphereUnion and the plane with
operation type set to</font></tt><br>
<tt><font face="Courier New">&gt; intersection.&nbsp; I run slice into a
vtkSampleFunction, that into a</font></tt><br>
<tt><font face="Courier New">&gt; vtkContourFilter into a vtkPolyDataMapper
into a vtkActor and into a</font></tt><br>
<tt><font face="Courier New">&gt; vtkRenderer (the standard textbook
sequence).&nbsp; I&#8217;ve tried looking at various</font></tt><br>
<tt><font face="Courier New">&gt; subsets &#8211; just the sphereUnion, just the
plane, etc. &#8211; and I see what I</font></tt><br>
<tt><font face="Courier New">&gt; expect.&nbsp; But I&#8217;d think that the
intersection of a bunch of spheres and a</font></tt><br>
<tt><font face="Courier New">&gt; plane would look like calamari or sausage
slices: a cluster of rings or</font></tt><br>
<tt><font face="Courier New">&gt; disks on a 2D surface.&nbsp; However, what
I&#8217;m seeing is a strange cluster of</font></tt><br>
<tt><font face="Courier New">&gt; lumpy, irregular 3D objects scattered through
the 3D sample space that</font></tt><br>
<tt><font face="Courier New">&gt; perhaps roughly correspond to some or all of
the original spheres.&nbsp; Thus far</font></tt><br>
<tt><font face="Courier New">&gt; I haven't made any sense of it.&nbsp; So on
to the second approach:</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; 2) Polygons:&nbsp; I create the vtkSpheres,
but this time convert each into a</font></tt><br>
<tt><font face="Courier New">&gt; vtkPolyData object (vtkSphere -&gt;
vtkSampleFunction -&gt; vtkContourFilter) and</font></tt><br>
<tt><font face="Courier New">&gt; add the resulting polygonal sphere to a
vtkAppendPolyData object.&nbsp; I create</font></tt><br>
<tt><font face="Courier New">&gt; a vtkPlaneSource object (the polygonal
equivalent to the vtkPlane implicit</font></tt><br>
<tt><font face="Courier New">&gt; surface object in approach 1 above) and a
vtkProbeFilter.&nbsp; I set the probe&#8217;s</font></tt><br>
<tt><font face="Courier New">&gt; input connection to the vtkPlaneSource and
its source connection to the</font></tt><br>
<tt><font face="Courier New">&gt; vtkAppendPolydata object (the spheres) and
then from there into the usual</font></tt><br>
<tt><font face="Courier New">&gt; pipeline to the renderer.&nbsp; Once again I
think the subunits are ok &#8211; I can</font></tt><br>
<tt><font face="Courier New">&gt; display them and they look like I&#8217;d expect &#8211;
but I don&#8217;t see any probe&#8217;d</font></tt><br>
<tt><font face="Courier New">&gt; data at all.&nbsp; </font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; Does either of these approaches look
promising, or is there an entirely</font></tt><br>
<tt><font face="Courier New">&gt; different direction that&#8217;s more likely to
produce useful results? &nbsp;I&#8217;d</font></tt><br>
<tt><font face="Courier New">&gt; appreciate any insights you might have.&nbsp;
I can provide source code if it</font></tt><br>
<tt><font face="Courier New">&gt; would make it any clearer.&nbsp; Thanks for
any help you can provide.</font></tt></span></font><br>
<br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>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 ;-).</span></font></tt><br>
<br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>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 -&gt; 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.</span></font></tt><br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>If you
really need to specify the particles as implicit functions you would use
vtkSampleFunction -&gt; 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. </span></font></tt><br>
<br>
<tt><font size=2 face="Courier New"><span style='font-size:10.0pt'>&nbsp; HTH,
Dave P</span></font></tt><br>
<font size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; Steve</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; -Steve Chall</font></tt><br>
<tt><font face="Courier New">&gt; &nbsp;Senior Research Software Developer</font></tt><br>
<tt><font face="Courier New">&gt; &nbsp;Renaissance Computing Institute</font></tt><br>
<tt><font face="Courier New">&gt; &nbsp;Phone: 919-515-0051</font></tt><br>
<tt><font face="Courier New">&gt; &nbsp;Email: stevec@renci.org</font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; </font></tt><br>
<tt><font face="Courier New">&gt; _______________________________________________</font></tt><br>
<tt><font face="Courier New">&gt; This is the private VTK discussion list. </font></tt><br>
<tt><font face="Courier New">&gt; Please keep messages on-topic. Check the FAQ
at: <a href="http://www.vtk">http://www.vtk</a>.</font></tt><br>
<tt><font face="Courier New">&gt; org/Wiki/VTK_FAQ</font></tt><br>
<tt><font face="Courier New">&gt; Follow this link to subscribe/unsubscribe:</font></tt><br>
<tt><font face="Courier New">&gt; <a
href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a></font></tt></span></font><o:p></o:p></p>

</div>

</body>

</html>