<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:"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;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@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-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">is really a question for the users list, but the answer is actually written in the header file.
<o:p></o:p></span></p>
<p class="MsoNormal"><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">if you look at the doc<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:navy">// Description:</span></span></b><span style="font-family:"Courier New";color:navy"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:navy">// Create and return a pointer to a vtkPlane object at the ith</span></span></b><span style="font-family:"Courier New";color:navy"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:navy">// position. Asking for a plane outside the allowable range returns NULL.</span></span></b><span style="font-family:"Courier New";color:navy"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:navy">// This method always returns the same object. </span></span></b><span style="font-family:"Courier New";color:navy"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New""> <span style="color:navy">// Use GetPlane(int i, vtkPlane *plane) instead</span></span></b><span style="font-family:"Courier New";color:navy"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:green">vtkPlane</span> *<span style="color:green">GetPlane</span>(<span style="color:maroon">int</span>
<span style="color:green">i</span>);</span></b><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-family:"Courier New"">
<span style="color:maroon">void</span> <span style="color:green">GetPlane</span>(<span style="color:maroon">int</span>
<span style="color:green">i</span>, <span style="color:green">vtkPlane</span> *<span style="color:green">plane</span>);</span></b><span style="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> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">you can see that the same object is used every time and so your pointers are the same. so use GetPlane(...) instead, where a new object is created for you.<o:p></o:p></span></p>
<p class="MsoNormal"><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">you must delete the extra objects when you’re done with them.<o:p></o:p></span></p>
<p class="MsoNormal"><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">JB<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </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""> vtk-developers-bounces@vtk.org [mailto:vtk-developers-bounces@vtk.org]
<b>On Behalf Of </b>Laurent Chauvin<br>
<b>Sent:</b> 12 July 2011 16:25<br>
<b>To:</b> vtk-developers@vtk.org<br>
<b>Subject:</b> [vtk-developers] Issue to get plane from vtkPlanes<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hello,<br>
<br>
I was using vtkPlanes, and I needed to retrieve 2 planes (number 4 and 5).<br>
<br>
When I was using:<br>
<br>
planes->GetPlane(5) and planes->GetPlane(4) <br>
<br>
and using this as argument for clipping, like this:<br>
<br>
clip->SetClipFunction(planes->GetPlane(5));<br>
clip2->SetClipFunction(planes->GetPlane(4));<br>
<br>
But, when I was not doing clip2, everything was working good, but after adding clip2, my first clip changed and become the same as the clip2.<br>
<br>
So, I try this insted:<br>
<br>
vtkPlane* plane1 = vtkPlane::New();<br>
planes->GetPlane(4, plane1);<br>
<br>
vtkPlane* plane2 = vtkPlane::New();<br>
planes->GetPlane(5, plane2);<br>
<br>
clip->SetClipFunction(plane1);<br>
clip2->SetClipFunction(plane2);<br>
<br>
And it works.<br>
I don't really understand. Is there shared memory in these classes (vtkPlanes, vtkClipPolyData) ?<br>
I was thinking the vtkClipPolyData output was shared, so the clip2 write in the same place than the clip, which could explain why they are the same after second clipping.<br>
<br>
Thank you.<br>
Laurent.<br>
<br clear="all">
<br>
-- <o:p></o:p></p>
<div>
<p class="MsoNormal">Laurent Chauvin, MS<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Surgical Planning Laboratory, Radiology<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Brigham And Women's Hospital, Harvard Medical School<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><a href="http://wiki.ncigt.org/index.php/User:Lchauvin" target="_blank">http://wiki.ncigt.org/index.php/User:Lchauvin</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>