<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=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi, <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am trying to use a vtkCutter with vtkPlanes as CutFunction, and then get the output.<o:p></o:p></p>
<p class="MsoNormal">I set a vtkPlane with a normal (0.0, 0.0, 1.0) and an origin of (-1.0, -1.0, 0.5).<o:p></o:p></p>
<p class="MsoNormal">My source is half a sphere centered on (-1.0,-1.0,0.5) and with z > 0.5.<o:p></o:p></p>
<p class="MsoNormal">When I do the cut, and try to get the output, this is empty.
<o:p></o:p></p>
<p class="MsoNormal">I try to cut the entire sphere instead of only a half with the same vtkPlane and get the output (with vtkPolyData::GetPoint(i)) and<o:p></o:p></p>
<p class="MsoNormal">I see that the resulting points have a z = 0.49999999046325684 instead of 0.5, which explains that the output is empty when I use half the sphere.
<o:p></o:p></p>
<p class="MsoNormal">I am only using doubles and the vtk methods I am calling return also doubles, so I am wondering why this happens, and if I am doing something wrong?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here is the sample :<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">vtkSmartPointer</span><<span style="color:#010001">vtkPlane</span>>
<span style="color:#010001">plane3</span> = <span style="color:#010001">vtkSmartPointer</span><<span style="color:#010001">vtkPlane</span>>::<span style="color:#010001">New</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">plane3</span>-><span style="color:#010001">SetNormal</span>(0.0,0.0,1.0);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">plane3</span>-><span style="color:#010001">SetOrigin</span>(-1.0,-1.0, 0.5);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">vtkSmartPointer</span><<span style="color:#010001">vtkSTLReader</span>>
<span style="color:#010001">roiModelReader</span> = <o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:#010001">vtkSmartPointer</span><<span style="color:#010001">vtkSTLReader</span>>::<span style="color:#010001">New</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">roiModelReader</span>-><span style="color:#010001">SetFileName</span>(<span style="color:#A31515">"HalfSphere.stl"</span>);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:#010001">
roiModelReader</span>-><span style="color:#010001">Update</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">vtkSmartPointer</span><<span style="color:#010001">vtkCutter</span>>
<span style="color:#010001">cutterForROI</span> =<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:#010001">vtkSmartPointer</span><<span style="color:#010001">vtkCutter</span>>::<span style="color:#010001">New</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">cutterForROI</span>-><span style="color:#010001">SetInputConnection</span>(<span style="color:#010001">roiModelReader</span>-><span style="color:#010001">GetOutputPort</span>());<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:#010001">cutterForROI</span>-><span style="color:#010001">SetCutFunction</span>(<span style="color:#010001">plane3</span>);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:#010001">cutterForROI</span>-><span style="color:#010001">Update</span>();</span><o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#010001">vtkPointSet</span>* <span style="color:#010001">dataSet</span> =
<span style="color:#010001">cutterForROI</span>-><span style="color:#010001">GetOutput</span>();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:blue">
int</span> <span style="color:#010001">nbrPoints</span> = <span style="color:#010001">
dataSet</span>-><span style="color:#010001">GetNumberOfPoints</span>(); // = 0 with half the sphere<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:blue">double</span>* <span style="color:#010001">point</span>;
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New";color:blue"> for</span><span style="font-size:10.0pt;font-family:"Courier New"">(<span style="color:blue">int</span>
<span style="color:#010001">i</span> = 0; <span style="color:#010001">i</span><<span style="color:#010001">nbrPoints</span>; ++<span style="color:#010001">i</span>)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New""> <span style="color:#010001">point</span> =
<span style="color:#010001">dataSet</span>-><span style="color:#010001">GetPoint</span>(<span style="color:#010001">i</span>); // point[2] = 0.</span> 0.49999999046325684 when using the whole sphere<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""> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Remy Trichet<o:p></o:p></p>
</div>
</body>
</html>