Rendering a StructuredGrid as a solid?
Paul Hsieh
pahsieh at usgs.gov
Tue Jul 27 16:56:49 EDT 1999
I think you want to use a vtkGeometryFilter instead of a vtkStructuredGridGeometryFilter.
vtkGeometryFilter will give you the surface of your grid. If you use
vtkStructuredGridFilter and set the extent to a "volume", you end up with
a grid of points, which is what you saw.
Jim Moore wrote:
>
> I think that wholeFilter needs the following:
>
> wholeFilter SetExtent 0 [expr $n0-1] 0 [expr $n0-1] 0 [expr$n0-1]
>
> This will force it to create the planes of the geometry for the mapper (as I understand it).
>
> Good luck,
> Jim
>
>
> drew at pixar.com wrote:
>
> > I've been trying to do something simple but don't seem to be
> > having much luck. I want to display the surface of a StructuredGrid
> > as a solid (or even a wireframe). When I execute the code below
> > all I get is a 5x5x5 grid of points. Anyone have any idea what
> > I'm doing wrong?
> >
> > Drew
> > drew at pixar.com
> >
> > #!/usr/local/bin/vtk
> >
> > catch {load vtktcl}
> >
> > # create a window to render into
> > vtkRenderWindow renWin
> > vtkRenderer ren1
> > renWin AddRenderer ren1
> > vtkRenderWindowInteractor iren
> > iren SetRenderWindow renWin
> >
> > set n0 5
> > set n0m1 [expr $n0 - 1]
> > vtkFloatPoints points
> > for {set x 0} {$x < $n0} {incr x} {
> > for {set y 0} {$y < $n0} {incr y} {
> > for {set z 0} {$z < $n0} {incr z} {
> > points InsertNextPoint [expr (1.0/$n0m1) * $x] \
> > [expr (1.0/$n0m1) * $y] \
> > [expr (1.0/$n0m1) * $z]
> > }
> > }
> > }
> >
> > #
> > # The whole enchilada
> > vtkStructuredGrid grid
> > grid SetDimensions $n0 $n0 $n0
> > grid SetPoints points
> >
> > vtkStructuredGridGeometryFilter wholeFilter
> > wholeFilter SetInput grid
> >
> > vtkDataSetMapper wholeMapper
> > wholeMapper SetInput [wholeFilter GetOutput]
> >
> > vtkActor theWhole
> > theWhole SetMapper wholeMapper
> > [theWhole GetProperty] SetRepresentationToSurface
> >
> > ren1 AddActor theWhole
> >
> > # Render an image; since no lights/cameras specified, created automatically
> > renWin Render;
> >
> > # Begin mouse interaction
> > iren Start;
> >
> > -----------------------------------------------------------------------------
> > This is the private VTK discussion list. Please keep messages on-topic.
> > Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
> > To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
> > <majordomo at gsao.med.ge.com>. For help, send message body containing
> > "info vtkusers" to the same address. Live long and prosper.
> > -----------------------------------------------------------------------------
>
> --
> James C Moore, Vice President
> URS Technologies, LLC
> ph: 614-540-8041, jmoore at qn.net
>
>
-----------------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>. For help, send message body containing
"info vtkusers" to the same address. Live long and prosper.
-----------------------------------------------------------------------------
More information about the vtkusers
mailing list