[vtkusers] How to merge plane and lines together?

Amy Squillacote amy.squillacote at kitware.com
Wed Apr 26 09:24:15 EDT 2006


You could also try using the SetResolveCoincidentTopology methods in 
vtkMapper (i.e., SetResolveCoincidentTopologyToPolygonOffset or 
SetResolveCoincidentTopologyToShiftZBuffer).  From vtkMapper.h:

   // Description:
   // Set/Get a global flag that controls whether coincident topology (e.g., a
   // line on top of a polygon) is shifted to avoid z-buffer resolution (and
   // hence rendering problems). If not off, there are two methods to choose
   // from. PolygonOffset uses graphics systems calls to shift polygons, but
   // does not distinguish vertices and lines from one another. ShiftZBuffer
   // remaps the z-buffer to distinguish vertices, lines, and polygons, but
   // does not always produce acceptable results. If you use the ShiftZBuffer
   // approach, you may also want to set the ResolveCoincidentTopologyZShift
   // value. (Note: not all mappers/graphics systems implement this
   // functionality.)
   static void SetResolveCoincidentTopology(int val);
   static int  GetResolveCoincidentTopology();
   static void SetResolveCoincidentTopologyToDefault();
   static void SetResolveCoincidentTopologyToOff()
     {SetResolveCoincidentTopology(VTK_RESOLVE_OFF);}
   static void SetResolveCoincidentTopologyToPolygonOffset()
     {SetResolveCoincidentTopology(VTK_RESOLVE_POLYGON_OFFSET);}
   static void SetResolveCoincidentTopologyToShiftZBuffer()
     {SetResolveCoincidentTopology(VTK_RESOLVE_SHIFT_ZBUFFER);}

- Amy

At 09:11 AM 4/26/2006, Burlen wrote:
>Hi, if the line lies on the plane then try setting the plane's alpha to
>something less than 1 & see if that takes care of it.
>
>On Tuesday 25 April 2006 10:42 pm, hp.shen wrote:
> > Hi,all
> >
> > I drew a plane using vtkPlaneSource, and draw a line(with a different
> > color) on the plane. When I rotate them I found some parts of the line
> > was covered by the plane at
> > some view angles and the line flickered. I don't know whether there are
> > some tricks to solve the problem?
> >
> > Any idea is appreciated!
> >
> > Peace
> >
> > #Codes
> > package require vtk
> > package require vtkinteraction
> >
> > vtkRenderer ren1
> > vtkRenderWindow renWin
> >     renWin AddRenderer ren1
> > vtkRenderWindowInteractor iren
> >     iren SetRenderWindow renWin
> > ren1 SetBackground 0 0 0
> > renWin SetSize 400 400
> > iren AddObserver UserEvent {wm deiconify .vtkInteract}
> > iren Initialize
> > wm withdraw .
> >
> > #plane
> > vtkPlaneSource plane
> >     plane SetResolution 1 1
> >
> >        vtkPolyDataMapper planemap
> >            planemap SetInputConnection [plane GetOutputPort]
> >        vtkActor planeact
> >            planeact SetMapper planemap
> >            [planeact GetProperty] SetColor 0.5 0.5 0.5
> >
> >
> > #line
> > vtkPoints pts
> > pts InsertNextPoint 0 1 0
> > pts InsertNextPoint 0 -1 0
> >
> > vtkCellArray line
> >               line InsertNextCell 2
> >          line InsertCellPoint 0
> >          line InsertCellPoint 1
> >
> > vtkPolyData data
> >            data SetPoints pts
> >            data SetLines line
> >
> > vtkDataSetMapper map
> >              map SetInput data
> >
> > vtkActor lineact
> >                 lineact SetMapper map
> >                 [lineact GetProperty] SetColor 1 1 1
> >
> > #Draw
> > ren1 AddActor planeact
> > ren1 AddActor lineact
>
>--
>
>Burlen Loring
>Space Science Center
>Institute for the Study of Earth, Oceans, and Space
>University of New Hampshire
>39 College Road, Durham, NH 03824
>Phone: 603-862-1140
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
>http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list