[vtk-developers] 2 ways of representing lines

Lisa Avila lisa.avila at kitware.com
Tue Aug 6 15:10:52 EDT 2002


Hello Dean,

I don't have time to look into this today - but I think we should fix the 
culler if it is doing the wrong thing rather than having you use a 
work-around in your code. I believe the problem is that the culler is 
looking at area covered by the primitive on the screen and a line reports 
bounds that are equal in some direction (for axis-aligned lines). I think 
this can be fixed fairly simply - but I probably can't get to it for a day 
or two.

Lisa



At 02:53 PM 8/6/2002, Dean Inglis wrote:
>Hi all,
>
>I have a workaround for a long-standing pb with representing straight lines
>in VTK.  I recently added cross-hairs to vtkImagePlaneWidget wherein the
>pipeline for the cross-hairs is basically:
>
><to store it>
>   vtkPoints          *CursorPoints;
>   vtkPolyData        *CursorPolyData;
>   vtkPolyDataMapper  *CursorMapper;
>   vtkActor           *CursorActor;
>
><and to generate it>
>   // Construct initial points
>   this->CursorPoints->SetNumberOfPoints(4);
>
>   this->CursorPolyData->SetPoints(this->CursorPoints);
>
>   this->CursorMapper->SetInput(this->CursorPolyData);
>   this->CursorMapper->SetResolveCoincidentTopologyToPolygonOffset();
>
>   this->CursorActor->SetMapper(this->CursorMapper);
>   this->CursorActor->PickableOff();
>
>   vtkCellArray *cells = vtkCellArray::New();
>   cells->Allocate(cells->EstimateSize(2,2));
>   vtkIdType pts[2];
>   pts[0] = 0; pts[1] = 1;       // horizontal segment
>   cells->InsertNextCell(2,pts);
>   pts[0] = 2; pts[1] = 3;       // vertical segment
>   cells->InsertNextCell(2,pts);
>
>   this->CursorPolyData->SetLines(cells);
>   this->CursorPolyData->Modified();
>   cells->Delete();
>
><snip>
>
>Well, if one zooms in on a vtkImagePlaneWidget, the image data can still be
>queried (i.e. the picking is functional) but the cross-hairs disappear.  Try
>/Examples/GUI/Tcl/ImagePlaneWidget.tcl without the line:
><snip>
>[ren1 GetCullers] RemoveAllItems
><snip>
>
>Hmmmmm.  I am considering changing the representation of the cross-hairs to
>avoid this messing about with the cullers:
><new representation>
>   vtkLineSource      *CursorLine1;
>   vtkLineSource      *CursorLine2;
>   vtkAppendPolyData  *CursorPolyData;
>   vtkPolyDataMapper  *CursorMapper;
>   vtkActor           *CursorActor;
><snip>
>
>I've tested and it works.  Any thoughts before I make this change?
>
>Dean
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Dean Inglis, Ph.D.
>Clinical Research Unit
>25 Charlton Avenue East, Unit 610
>Hamilton, ONT, L8N 1Y2
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers




More information about the vtk-developers mailing list