Yes. This is how the 2nd signature work, but I was thinking the first one was basically the same, returning a new vtkPlane* when you call it. But it's not a new one, it seems to be the same everytime (this is what is explained in the description in the header (explications that I missed) ).<br>
<br>Laurent.<br><br><div class="gmail_quote">On Tue, Jul 12, 2011 at 12:40 PM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Jul 12, 2011 at 10:33 AM, Biddiscombe, John A. <<a href="mailto:biddisco@cscs.ch">biddisco@cscs.ch</a>> wrote:<br>
</div><div class="im">> is really a question for the users list, but the answer is actually written<br>
> in the header file.<br>
><br>
><br>
><br>
> if you look at the doc<br>
><br>
> // Description:<br>
><br>
> // Create and return a pointer to a vtkPlane object at the ith<br>
><br>
> // position. Asking for a plane outside the allowable range returns NULL.<br>
><br>
> // This method always returns the same object.<br>
><br>
> // Use GetPlane(int i, vtkPlane *plane) instead<br>
><br>
> vtkPlane *GetPlane(int i);<br>
><br>
> void GetPlane(int i, vtkPlane *plane);<br>
><br>
><br>
><br>
> you can see that the same object is used every time and so your pointers are<br>
> the same. so use GetPlane(...) instead, where a new object is created for<br>
> you.<br>
<br>
</div>I'm pretty sure to use that 2nd signature where you pass in a<br>
"vtkPlane *" that you have to create a vtkPlane object to pass in<br>
before you make the call. You create it, the call fills it in for you,<br>
then you delete it when you're done with it.<br>
<div><div></div><div class="h5"><br>
<br>
><br>
><br>
><br>
> you must delete the extra objects when you’re done with them.<br>
><br>
><br>
><br>
> JB<br>
><br>
><br>
><br>
> From: <a href="mailto:vtk-developers-bounces@vtk.org">vtk-developers-bounces@vtk.org</a> [mailto:<a href="mailto:vtk-developers-bounces@vtk.org">vtk-developers-bounces@vtk.org</a>]<br>
> On Behalf Of Laurent Chauvin<br>
> Sent: 12 July 2011 16:25<br>
> To: <a href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a><br>
> Subject: [vtk-developers] Issue to get plane from vtkPlanes<br>
><br>
><br>
><br>
> 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<br>
> 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<br>
> (vtkPlanes, vtkClipPolyData) ?<br>
> I was thinking the vtkClipPolyData output was shared, so the clip2 write in<br>
> the same place than the clip, which could explain why they are the same<br>
> after second clipping.<br>
><br>
> Thank you.<br>
> Laurent.<br>
><br>
><br>
> --<br>
><br>
> Laurent Chauvin, MS<br>
><br>
> Surgical Planning Laboratory, Radiology<br>
><br>
> Brigham And Women's Hospital, Harvard Medical School<br>
><br>
> <a href="http://wiki.ncigt.org/index.php/User:Lchauvin" target="_blank">http://wiki.ncigt.org/index.php/User:Lchauvin</a><br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
><br>
><br>
</blockquote></div><br><br clear="all"><br>-- <br><div>Laurent Chauvin, MS</div><div>Surgical Planning Laboratory, Radiology</div><div>Brigham And Women's Hospital, Harvard Medical School<br></div><div><a href="http://wiki.ncigt.org/index.php/User:Lchauvin" target="_blank">http://wiki.ncigt.org/index.php/User:Lchauvin</a></div>
<br>