<div dir="ltr">Please note that this is not a utility class. It is an algorithm. ALL output that matters is produced after Update(). The fact that the normal is updated in some cases before Update() is coincidental and you should not rely on this behavior. If you are interested in calculating the normal of a plane given 2 vectors, I suggest using a cross product as provided by vtkMath.<div>
<br></div><div>Best,</div><div style>-berk</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 28, 2013 at 7:15 AM, Marco Sambin <span dir="ltr"><<a href="mailto:m.sambin@gmail.com" target="_blank">m.sambin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all.<div><br></div><div>I am using the vtkPlaneSource class in a VTK-derived class. I noticed that the following simple sequence of calls:</div>
<div><br></div><div>=========================</div>
<div>CODE A:</div><div><br></div><div><div>double newO[3];</div><div>double newP1[3];</div><div>double newP2[3];</div><div>double newNormal[3];</div><div><br></div><div>// [...] set new values...</div><div>
<br></div><div>myPlaneSource->SetPoint1(newP1);</div><div>myPlaneSource->SetPoint2(newP2);</div><div>myPlaneSource->SetOrigin(newO);</div><div>myPlaneSource->GetNormal(newNormal);</div></div><div>=========================</div>
<div><br></div><div>finally returns a normal which seems INCORRECT to me.</div><div>On the other side, the following sequence of calls (which differs from CODE A in the position of the SetOrigin() call):</div>
<div><br></div><div><div>=========================</div><div>CODE B:</div><div><br></div><div><div>double newO[3];</div><div>double newP1[3];</div><div>double newP2[3];</div><div>double newNormal[3];</div><div>
<br></div><div>// [...] set new values...</div><div><br></div><div>myPlaneSource->SetOrigin(newO);<br></div><div>myPlaneSource->SetPoint1(newP1);</div><div>myPlaneSource->SetPoint2(newP2);</div><div>myPlaneSource->GetNormal(newNormal);</div>
</div><div>=========================</div><div><br></div><div>finally returns a normal which seems CORRECT.</div><div>After taking a look at vtkPlaneSource.cxx source, I believe that the problem is that while the implementation of the SetPoint1() and SetPoint2() methods finally calls UpdatePlane(), which also updates the normal, the implementation of SetOrigin() does not update the normal. Hence, if SetOrigin() is the last call, the resulting normal is incorrect in my opinion.</div>
<div><br></div><div>Can you please comment?</div><div>Thanks in advance,</div><div><br></div><div>Marco</div><div><br></div></div></div>
<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><br>
<br></blockquote></div><br></div>