<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@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:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ok &#8211; almost there &#8211; the following will no doubt help someone in future &#8211; I have attached an adapted picture from <a href="http://vis.computer.org/vis2004/dvd/tutorial/tut_5/notes_1.pdf">http://vis.computer.org/vis2004/dvd/tutorial/tut_5/notes_1.pdf</a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Correct me if I am wrong but the concept of Parallel Projection means that the scale is like making the size of the camera bigger, there is no perspective, so if you move the camera 1000 metres back, the picture will be exactly the same (assuming the object is still in the clipping plane). If you want to fit something that is &#8220;yay big&#8221; in the picture, you need to make sure that the camera is &#8220;yay big&#8221; also. So if I have a sphere with radius 0.05, I set the parallel scale to 0.05 and the camera will reach that height above and below (VTK code snippet below)... so far I think I am right </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>Description:</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>Set/Get</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>the</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>scaling</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>used</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>for</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>a</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>parallel</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>projection,</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>i.e.</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>the</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>height</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>of</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>the</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>viewport</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>in</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>world-coordinate</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>distances.</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>The</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>default</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>is</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>1.</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>Note</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>that</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>the</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>&quot;scale&quot;</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>parameter</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>works</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>as</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>an</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>&quot;inverse</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>scale&quot;</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>---</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>larger</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>numbers</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>produce</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>smaller</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>images.</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>This</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>method</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>has</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>no</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>effect</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>in</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>perspective</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>projection</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>mode.</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>void</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>SetParallelScale(double</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>scale);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>vtkGetMacro(ParallelScale,double);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>How</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>camera</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>is</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>configured</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>from:</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>D:\vtk-5.8.0\Rendering\vtkCamera.cxx</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>if</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>(</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;ParallelProjection)</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>{</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>set</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>up</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>a</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>rectangular</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>parallelipiped</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>double</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>width</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>=</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;ParallelScale</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>*</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>aspect;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>double</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>height</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>=</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;ParallelScale;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>double</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>xmin</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>=</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>(</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;WindowCenter[0]</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>-</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>1.0</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>)</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>*</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>width;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>double</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>xmax</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>=</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>(</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;WindowCenter[0]</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>+</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>1.0</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>)</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>*</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>width;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>double</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>ymin</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>=</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>(</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;WindowCenter[1]</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>-</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>1.0</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>)</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>*</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>height;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>double</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>ymax</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>=</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>(</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;WindowCenter[1]</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>+</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>1.0</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>)</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>*</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>height;</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;ProjectionTransform-&gt;Ortho(</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>xmin,</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>xmax,</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>ymin,</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>ymax,</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;ClippingRange[0],</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>this-&gt;ClippingRange[1]</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'> </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";color:green'>//</span><span style='font-size:10.0pt;font-family:"Courier New";color:silver'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";color:green'>}</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Paul<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Paul McIntosh [<a href="mailto:paul.mcintosh@internetscooter.com">mailto:paul.mcintosh@internetscooter.com</a>] <br><b>Sent:</b> Friday, 26 October 2012 1:05 PM<br><b>To:</b> 'vtkusers@vtk.org'<br><b>Subject:</b> RE: [vtkusers] Projected area calculation - i.e. frontal area<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Ok &#8211; I have all the bits in place now load STL -&gt; render STL -&gt; capture screenshot -&gt; count black pixels. Now I just have to make the count mean something useful ;)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Has anyone got some suggestions of how to make, for example, 10000 pixels = 1 metre. &nbsp;I&#8217;ll keep playing and will eventually nut it out but any suggestions to speed up this process is most welcome.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Below is my test data dimensions and below that is the camera properties that produce the attached image. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Reading: D:\scooter\vespalabs\3D_Scan_small\201205_attempt\Horn_Cover.stl<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>xmin: -1.41477 xmax: 216.216<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>ymin: -72.8783 ymax: 62.79<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>zmin: 234.3 zmax: 632.477<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>position x:107.401&nbsp; y:-5.04419 z:433.389<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp; // Camera<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkCamera&gt; camera = vtkSmartPointer&lt;vtkCamera&gt;::New();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp; camera-&gt;SetFocalPoint(centre);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp; camera-&gt;SetPosition(centre[0],centre[1],centre[2]+500);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp; camera-&gt;SetParallelProjection(1);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp; camera-&gt;SetParallelScale(100);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Paul<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a> [<a href="mailto:vtkusers-bounces@vtk.org">mailto:vtkusers-bounces@vtk.org</a>] <b>On Behalf Of </b>Paul McIntosh<br><b>Sent:</b> Thursday, 25 October 2012 8:08 AM<br><b>To:</b> 'Goodwin Lawlor'<br><b>Cc:</b> <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br><b>Subject:</b> Re: [vtkusers] Projected area calculation - i.e. frontal area<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>HI Goodwin,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The meshes are all over the place and overlapping &#8211; if I could just select triangles facing forward, then I could transform them flat and do the area that way. Selecting only triangles facing forward and not obscured by other triangles is the hard part. Also select visible surfaces doesn&#8217;t work because the mesh is much finer than what is being rendered.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Paul<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Goodwin Lawlor [<a href="mailto:goodwin.lawlor.lists@gmail.com">mailto:goodwin.lawlor.lists@gmail.com</a>] <br><b>Sent:</b> Wednesday, 24 October 2012 10:45 PM<br><b>To:</b> Paul McIntosh<br><b>Cc:</b> <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br><b>Subject:</b> Re: [vtkusers] Projected area calculation - i.e. frontal area<o:p></o:p></span></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>Hi Paul,<o:p></o:p></p><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>I may have misunderstood but could you not just project each triangle in the stl mesh onto the frontal plane (using&nbsp;vtkPlane::ProjectPoint() ), then sum the projected areas?<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>You may have to prune the mesh first of triangles not &quot;facing&quot; the plane... you could use vtkVectorDot to do this. You'll also have to deal with occluded triangles (if you have them)<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>hth,<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Goodwin<o:p></o:p></p><div><p class=MsoNormal>On Wed, Oct 24, 2012 at 2:18 PM, Paul McIntosh &lt;<a href="mailto:paul.mcintosh@internetscooter.com" target="_blank">paul.mcintosh@internetscooter.com</a>&gt; wrote:<o:p></o:p></p><p class=MsoNormal>Hi All,<br><br>I have been working on a utility for calculating frontal area of an STL mesh<br>for CFD. I thought I had it cracked my scanning a line through the mesh at<br>evenly spaced distances and then counting the number of hits (based on the<br>OBBTree example). However on closer inspection the areas I was getting were<br>always larger than they should be, with reason being the OBBTree method is<br>not precise and I was getting double/triple hits at edges. I have included<br>the code below as it would probably help someone solve some other problem ;)<br><br>Ok - back to the drawing board... the next obvious way of doing this (and<br>probably quicker) is to render with parallel projection and then count<br>pixels in the result.<br><br>Is there an easy way to take sceenshot so that pixels are a known size? Any<br>pointers welcome!<br><br>Cheers,<br><br>Paul<br>---<br><a href="http://www.internetscooter.com" target="_blank">www.internetscooter.com</a><br><br><br><a href="https://github.com/internetscooter/Vespa-Labs/blob/master/VespaCFD/CalculateFrontalArea/CalculateFrontalArea.cxx" target="_blank">https://github.com/internetscooter/Vespa-Labs/blob/master/VespaCFD/Calculate<br>FrontalArea/CalculateFrontalArea.cxx</a><br><br>#include &lt;vtkPolyData.h&gt;<br>#include &lt;vtkTriangle.h&gt;<br>#include &lt;vtkLineSource.h&gt;<br>#include &lt;vtkSTLReader.h&gt;<br>#include &lt;vtkSmartPointer.h&gt;<br>#include &lt;vtkPolyDataMapper.h&gt;<br>#include &lt;vtkIdTypeArray.h&gt;<br>#include &lt;vtkSelectionNode.h&gt;<br>#include &lt;vtkActor.h&gt;<br>#include &lt;vtkRenderWindow.h&gt;<br>#include &lt;vtkRenderer.h&gt;<br>#include &lt;vtkRenderWindowInteractor.h&gt;<br>#include &lt;vtkSelection.h&gt;<br>#include &lt;vtkExtractSelection.h&gt;<br>#include &lt;vtkDataSetMapper.h&gt;<br>#include &lt;vtkProperty.h&gt;<br>#include &lt;vtkObjectFactory.h&gt;<br>#include &lt;vtkCellArray.h&gt;<br>#include &lt;vtkCell.h&gt;<br>#include &lt;vtkInformation.h&gt;<br>#include &lt;vtkExtractSelectedPolyDataIds.h&gt;<br>#include &lt;vtkOBBTree.h&gt;<br><br><br>// C++<br>#include &lt;iostream&gt;<br>using namespace std;<br><br>// just to make things nicer later and save some documentation reading ;)<br>struct boundingBox {<br>&nbsp; &nbsp; double xmin;<br>&nbsp; &nbsp; double xmax;<br>&nbsp; &nbsp; double ymin;<br>&nbsp; &nbsp; double ymax;<br>&nbsp; &nbsp; double zmin;<br>&nbsp; &nbsp; double zmax;<br>};<br><br>// this projects a series of lines through a mesh and looks for<br>intersections to determine frontal area<br>// lines are projected based on the bounding box and the resolution is<br>determined by the steps<br>// For my application I just need to look at frontal area along the X<br>direction. The follow code could easily be<br>// adapted to take a direction as a command line option and produce the area<br>from that .<br>// So this currently &quot;scans&quot; yMin-&gt;yMax,zMin-&gt;ZMax, with a line from Xmin to<br>Xmax<br>// ref:<br><a href="http://www.cmake.org/Wiki/VTK/Examples/Cxx/DataStructures/OBBTree_IntersectW" target="_blank">http://www.cmake.org/Wiki/VTK/Examples/Cxx/DataStructures/OBBTree_IntersectW</a><br>ithLine<br>int main(int argc, char *argv[])<br>{<br>&nbsp; &nbsp; &nbsp; &nbsp; // check and get the stl input file provided<br>&nbsp; &nbsp; if ( argc != 2 )<br>&nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Required parameters: Filename&quot; &lt;&lt; endl;<br>&nbsp; &nbsp; &nbsp; &nbsp; return EXIT_FAILURE;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; std::string inputfile = argv[1];<br><br>&nbsp; &nbsp; // later this should be a command line option - hard coded for now<br>&nbsp; &nbsp; double resolution = 0.005; // step value while scanning - will need to<br>do some more calculations later if changed<br>&nbsp; &nbsp; //char direction = &quot;X&quot;; &nbsp;// direction of scan<br><br>&nbsp; &nbsp; // read STL and print out some info<br>&nbsp; &nbsp; std::cout &lt;&lt; &quot;Reading: &quot; &lt;&lt; inputfile &lt;&lt; std::endl;<br>&nbsp; &nbsp; vtkSmartPointer&lt;vtkSTLReader&gt; stlReader =<br>vtkSmartPointer&lt;vtkSTLReader&gt;::New();<br>&nbsp; &nbsp; stlReader-&gt;SetFileName(inputfile.c_str());<br>&nbsp; &nbsp; &nbsp; &nbsp; vtkSmartPointer&lt;vtkPolyData&gt; polydata =<br>vtkSmartPointer&lt;vtkPolyData&gt;::New();<br>&nbsp; &nbsp; &nbsp; &nbsp; polydata = stlReader-&gt;GetOutput();<br>&nbsp; &nbsp; polydata-&gt;Update();<br>&nbsp; &nbsp; // &nbsp; &nbsp;Debug info if needed:<br>&nbsp; &nbsp; cout &lt;&lt; &quot;Cells: &quot; &lt;&lt; polydata-&gt;GetNumberOfCells() &lt;&lt; endl;<br>&nbsp; &nbsp; cout &lt;&lt; &quot;Points: &quot; &lt;&lt; polydata-&gt;GetNumberOfPoints() &lt;&lt; endl;<br>&nbsp; &nbsp; cout &lt;&lt; &quot;Polys: &quot; &lt;&lt; polydata-&gt;GetNumberOfPolys() &lt;&lt; endl;<br>&nbsp; &nbsp; cout &lt;&lt; &quot;Verts: &quot; &lt;&lt; polydata-&gt;GetNumberOfVerts() &lt;&lt; endl;<br>&nbsp; &nbsp; polydata-&gt;Print(cout);<br><br>&nbsp; &nbsp; // makes sense to only scan in an area the object exists, the bounding<br>box will tell us this<br>&nbsp; &nbsp; double bounds[6];<br>&nbsp; &nbsp; boundingBox boxBounds;<br>&nbsp; &nbsp; polydata-&gt;GetBounds(bounds);<br>&nbsp; &nbsp; boxBounds.xmin = bounds[0] - resolution*5;<br>&nbsp; &nbsp; boxBounds.xmax = bounds[1] + resolution*5;<br>&nbsp; &nbsp; boxBounds.ymin = bounds[2] - resolution*5;<br>&nbsp; &nbsp; boxBounds.ymax = bounds[3] + resolution*5;<br>&nbsp; &nbsp; boxBounds.zmin = bounds[4] - resolution*5;<br>&nbsp; &nbsp; boxBounds.zmax = bounds[5] + resolution*5;<br><br>&nbsp; &nbsp; // &nbsp; &nbsp;Debug info if needed:<br>&nbsp; &nbsp; std::cout &nbsp;&lt;&lt; &quot;xmin: &quot; &lt;&lt; boxBounds.xmin &lt;&lt; &quot; &quot;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; &quot;xmax: &quot; &lt;&lt; boxBounds.xmax &lt;&lt; std::endl<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; &quot;ymin: &quot; &lt;&lt; boxBounds.ymin &lt;&lt; &quot; &quot;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; &quot;ymax: &quot; &lt;&lt; boxBounds.ymax &lt;&lt; std::endl<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; &quot;zmin: &quot; &lt;&lt; boxBounds.zmin &lt;&lt; &quot; &quot;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;&lt; &quot;zmax: &quot; &lt;&lt; boxBounds.zmax &lt;&lt; std::endl;<br><br>&nbsp; &nbsp; // build OBB Tree locator<br>&nbsp; &nbsp; vtkSmartPointer&lt;vtkOBBTree&gt; tree = vtkSmartPointer&lt;vtkOBBTree&gt;::New();<br>&nbsp; &nbsp; tree-&gt;SetDataSet(polydata);<br>&nbsp; &nbsp; tree-&gt;BuildLocator();<br><br>&nbsp; &nbsp; // calculate area<br>&nbsp; &nbsp; double area = 0;<br>&nbsp; &nbsp; for (double zdir = boxBounds.zmin; zdir &lt; boxBounds.zmax; zdir = zdir +<br>resolution)<br>&nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; for (double ydir = boxBounds.ymin; ydir &lt; boxBounds.ymax; ydir =<br>ydir + resolution)<br>&nbsp; &nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Line to intersect with<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double p1[3] = {boxBounds.xmin, ydir + resolution/2, zdir +<br>resolution/2,};<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double p2[3] = {boxBounds.xmax, ydir + resolution/2, zdir +<br>resolution/2,};<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Find intersection points<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkSmartPointer&lt;vtkPoints&gt; intersectPoints =<br>vtkSmartPointer&lt;vtkPoints&gt;::New();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tree-&gt;IntersectWithLine(p1, p2, intersectPoints, NULL);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // this bit will draw a rough approximation of the shape<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (intersectPoints-&gt;GetNumberOfPoints() &gt; 0)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;#&quot;;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; area++;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot; &quot;;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; std::endl;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; // output how many hits, which for a resolution of 1 should equal<br>something like 1mm^2<br>&nbsp; &nbsp; cout &lt;&lt; &quot;area: &quot; &lt;&lt; area * resolution * resolution &lt;&lt; std::endl;<br><br>&nbsp; &nbsp; return EXIT_SUCCESS;<br>}<br><br><br><br>_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><o:p></o:p></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></div></body></html>