[vtkusers] Strange behavior in vtkPlaneSource (maybe bug?)
Berk Geveci
berk.geveci at kitware.com
Tue Apr 2 11:19:50 EDT 2013
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.
Best,
-berk
On Thu, Mar 28, 2013 at 7:15 AM, Marco Sambin <m.sambin at gmail.com> wrote:
> Hi all.
>
> I am using the vtkPlaneSource class in a VTK-derived class. I noticed that
> the following simple sequence of calls:
>
> =========================
> CODE A:
>
> double newO[3];
> double newP1[3];
> double newP2[3];
> double newNormal[3];
>
> // [...] set new values...
>
> myPlaneSource->SetPoint1(newP1);
> myPlaneSource->SetPoint2(newP2);
> myPlaneSource->SetOrigin(newO);
> myPlaneSource->GetNormal(newNormal);
> =========================
>
> finally returns a normal which seems INCORRECT to me.
> On the other side, the following sequence of calls (which differs from
> CODE A in the position of the SetOrigin() call):
>
> =========================
> CODE B:
>
> double newO[3];
> double newP1[3];
> double newP2[3];
> double newNormal[3];
>
> // [...] set new values...
>
> myPlaneSource->SetOrigin(newO);
> myPlaneSource->SetPoint1(newP1);
> myPlaneSource->SetPoint2(newP2);
> myPlaneSource->GetNormal(newNormal);
> =========================
>
> finally returns a normal which seems CORRECT.
> 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.
>
> Can you please comment?
> Thanks in advance,
>
> Marco
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130402/5602a24a/attachment.htm>
More information about the vtkusers
mailing list