[vtkusers] Constraining vtkLineWidget2

Andrew Godfrey godfrey at aerosft.com
Wed Aug 23 16:23:12 EDT 2006

Using the CVS version of VTK...

1) can I constrain vtkLineWidget2 to translate in the x,y, or z direction?
2) can I constrain the widget to remain inside a bounding box?

I've tried doing this using the vtkLineRepresentation functions.

For 1), my pseudo-code looks like this (note: I recompiled VTK with a 
friend class to access the protected members):

    vtkLineWidget2 *lineWidget = vtkLineWidget2::New();
    vtkHandleRepresentation *handle1Rep = <cast here> 

The widget still moves in any direction. I'm not sure what ConstrainedOn 

For 2), my pseudo-code looks like this:

    double bounds[6];
    bounds[0] = bounds[2] = bounds[4] = 0;
    bounds[1] = bounds[3] = bounds[5] = 1;

    vtkLineRepresentation *lineRep = lineWidget->GetRepresentation();
The widget still moves around unconstrained.

Thanks for the help.

More information about the vtkusers mailing list