[vtk-developers] SplineWidget

Gerrick Bivins gbivins at objectreservoir.com
Thu Jul 17 16:59:03 EDT 2008


Hello,
I¹ve been trying to wrap my head around vtkSplineWidget the last couple of
days. Basically I¹d like to project the spline to
 an arbitrarily oriented plane, which is associated with a
vtkImplicitPlaneWidget...I ran into a couple of issues:

1) To use vtkSplineWidget::SetNormalProjectionToOblique() requires a
vtkPlaneSource...I couldn¹t find another route other than to create a
vtkPlaneSource and continually update the normal and origin
        with the normal and origin from my vtkImplicitPlaneWidget. Seems
like overkill...

2) The ProjectToPlane method didn¹t keep the spline on the plane when the
normal¹s x or y component went < 0. I figured there was a calculation in
Wigdets that wasn¹t handling these cases after an arccos or cos (for dot
product) calculation
     but I couldn¹t track it down.

3) PlaceWidget(bounds) had some strange behaviors based on what the state of
ProjectToPlaneOff or ProjectToPlaneOn and if the projection was to be set to
an arbitrary plane or not.
For instance, if projection was on and the plane is arbitrary, the
PlaceWidget(bounds) call didn¹t put the spline on the polydata only in the
same plane. However if it was set to an orthoganal plane,
PlaceWidget(bounds) would place it correctly....
On the other hand, if projection is on and the plane is arbitrary,
manipulation of the implicitplanewidget would properly move the spline,
keeping it locked in the correct plane(just not mapped onto the finite rep
of the plane)
BUT the spline doesn¹t resize  with the plane...However switching to
orthoganal plane projection would resize the spline correctly but the
problem mentioned above in 2) occurs...

I was able to get around the second problem by modifying the
ProjectPointsToPlane method to a more general formula, basically calculate
the offset(positive or negative) of each handle point from the plane, then
move
the point along the normal by the offset. This keeps the points in the plane
at all times no matter what type of projection is selected. However, the
line itself doesn¹t update until one of the handles is moved.
I made some other changes to PlaceWidget(bounds) to get around this but I¹ve
hacked at VTK source enough now to get things working for me, I wanted to
ask someone if I¹m doing things in correctly. Is there an easier way to set
this up?

Any advice/help would be greatly appreciated!
Gerrick

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtk-developers/attachments/20080717/db862944/attachment.htm>


More information about the vtk-developers mailing list