[vtkusers] Strange behavior in vtkPlaneSource (maybe bug?)

Marco Sambin m.sambin at gmail.com
Thu Mar 28 07:15:16 EDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130328/043ff481/attachment.htm>


More information about the vtkusers mailing list