[vtkusers] problems using vtkSplineWidget

Wouter Lindhoud w.m.lindhoud at gmail.com
Thu Feb 15 10:05:17 EST 2007


Hi all!

I'm facing more than one difficulty using and controlling the vtkSplineWidget.

Problem 1: I'm setting the size of the handles (see code below), and
that works fine untill I move one of the handles, then the size all
handles become around 2 times larger... It cannot be fixed by setting
the size again..

Problem 2: I added handles by using InitializeHandles(see code below).
The handles looked fine, but the line was drawn through only 5 instead
of the +-30 handles. Till I move a handle, then it's drawn
correctly... I solved the problem by using:
spline->On(); spline->Off(); spline->On();
But I hope this is not the right way to do it...

Anybody knows how to solve problem 1, or more general: does anybody
has more documentation on the vtkSplineWidget than the available
Doxygen documentation, threads on this mailing list, the examples, the
tests, and the VTK user guide?

By the way: Methods like ProjectToPlaneOn(),
SetProjectionNormalToZAxes() and SetProjectionPosition(0) do not have
effect in my case. Possibly because I'm using the
vtkInteractorStyleImage as the interactor.

Many thanks in advance.
Cheers,
Wouter

--- code -->

CreateSplineWidget(vtkSplineWidget* spline, vtkPoints* points) {
   //configure the spline widget
   spline->SetCurrentRenderer( renderer );
   spline->SetDefaultRenderer( renderer );
   spline->SetInteractor( iren );
   double bnds[6];
   points->GetBounds( bnds );
   spline->PlaceWidget( bnds[0], bnds[1], bnds[2], bnds[3], bnds[4], bnds[5] );
   //spline->SetProjectionNormalToZAxes();	//not needed
   //spline->SetProjectionPosition(); //not needed

   //define properties handles
   double bnds[6];
   points->GetBounds( bnds );
   spline->PlaceWidget( bnds[0], bnds[1], bnds[2], bnds[3], bnds[4], bnds[5] );

   //define properties handles
   spline->SetHandleSize( 0.005 );
   vtkProperty* prop = vtkProperty::New();
   prop->SetColor( 0.01, 0.9, 0.01 );
   spline->SetHandleProperty( prop );
   spline->SetSelectedHandleProperty( prop );

   //set handles
   spline->SetNumberOfHandles(points->GetNumberOfPoints()); //not needed
   spline->InitializeHandles(points);

   //show spline
   spline->On();
   spline->Off();
   spline->On();
}



More information about the vtkusers mailing list