[vtkusers] Problem with vtkImplicitPlaneWidget2: can't compute normals

Sebastian Gatzka sebastian.gatzka at stud.tu-darmstadt.de
Mon Mar 1 05:42:46 EST 2010


Hello World.

I'm facing some problems using the vtkImplicitPlaneWidget2.
I'm basically using it like suggested in the examples 
(http://www.vtk.org/Wiki/VTK/Examples/Widgets/ImplicitPlaneWidget2),
with the difference that I'm not clipping but cutting the domain.

The widget is displayed when pressing the 'i'-key and I can translate 
its center without problem.
But when trying to move the normal I get a whole load of errors like 
this each time I move the mouse:

Generic Warning: In ..\..\Vtk\Filtering\vtkPolyLine.cxx, line 104
Coincident points in polyline...can't compute normals

Warning: In ..\..\Vtk\Graphics\vtkTubeFilter.cxx, line 225
vtkTubeFilter (06798380): Could not generate normals for line. Skipping 
to next.

Despite the errors the plane correct clip is displayed, but the 
representation of the plane itself is not updated.
Have a look at the screenshot attached.

I think the problem is with the link between the 
vtkImplicitPlaneRepresentation, vtkImplicitPlaneWidget2 and the actual 
plane.
The actual plane is set like this:

vtkPlane *plane = vtkPlane::New();
plane->SetOrigin(sGrid->GetCenter());
plane->SetNormal(1,0,0);

I think the trouble is that this plane is not updated during the 
callback in

class vtkIPWCallback : public vtkCommand
{
public:
   static vtkIPWCallback *New()
     { return new vtkIPWCallback; }
   virtual void Execute(vtkObject *caller, unsigned long, void*)
     {
     vtkImplicitPlaneWidget2 *planeWidget =
       reinterpret_cast<vtkImplicitPlaneWidget2*>(caller);
     vtkImplicitPlaneRepresentation *rep =
       
reinterpret_cast<vtkImplicitPlaneRepresentation*>(planeWidget->GetRepresentation());
     rep->GetPlane(this->Plane);
     }
   vtkIPWCallback():Plane(0),Actor(0) {}
   vtkPlane *Plane;
   vtkActor *Actor;
  };

Obviously there is done some updating on the widget and the plane 
representation itself.
Does anybody know how to update the plane as well?

Sebastian


-------------- next part --------------
A non-text attachment was scrubbed...
Name: iplane.png
Type: image/png
Size: 21927 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100301/efe619c0/attachment.png>


More information about the vtkusers mailing list