[vtkusers] How to merge plane and lines together?

Burlen burlen at apollo.sr.unh.edu
Wed Apr 26 09:11:48 EDT 2006


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



More information about the vtkusers mailing list