[vtkusers] problem using vtkGeometryFilter

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Thu Aug 26 17:30:03 EDT 2004





Hi Matt and Nikhil,
   OK, on closer inspection my code worked on an unstructured grid that
only contained 3D cells. I am not sure what your pipeline delivers, but if
it has 0,1 or 2D cells they will be passed straight through
vtkGeometryFilter.

To get only the visible parts of a surface you will have to derive a new
class (or use vtkProgrammableFilter?). Dot product of cell normal with view
position could give foward facing cells, but wont distinguish cells
occluded by others... you could use a second pass and test for intersection
with a line between view position and cell...

  Dave P

nikhil butala <nvbutala at yahoo.com> wrote on 27/08/2004 08:00:34:

> With reference to the messages below:
>
> I tried using the vtkGeometryFilter to extract just the outer
> surface of an unstructured grid. But this doesn't seem to be
> working. Can anyone tell me what needs to be changed in the code below?
>
>
> vtkDataSetReader *reader1 = vtkDataSetReader::New();
>    reader1->SetFileName ("C:/..../trial.vtk");
>    reader1->Update();
>
> vtkConnectivityFilter *connect = vtkConnectivityFilter::New();
>  connect->SetInput(reader1->GetOutput() );
>  connect->SetExtractionModeToAllRegions();
>
> vtkExtractUnstructuredGrid *extractGrid =
vtkExtractUnstructuredGrid::New();
>   extractGrid->SetInput(connect->GetOutput());
>
> vtkGeometryFilter *gFilter = vtkGeometryFilter::New();
>   gFilter->SetInput(extractGrid->GetOutput());
>
> vtkPolyDataMapper *visMapper = vtkPolyDataMapper::New();
>    visMapper->SetInput(gFilter->GetOutput() );
>    visMapper->ScalarVisibilityOff();
>
> vtkActor *actor = vtkActor::New();
> actor->GetProperty()->SetColor(0,0.8,0);
>  actor->GetProperty()->SetAmbient(0.8 );
>  actor->GetProperty()->SetRepresentationToWireframe();
>  actor->SetMapper( visMapper );
>
> Thanks,
> Matt and Nikhil
>
>
>
> Hi Matt,
>   I have used vtkGeometryFilter on an unstructured grid, this just
extracts
> the outer surface... not quite the same as only the visible parts but
could
> be useful, or a good start on what you want?
> Dave P
>
> vtkusers-bounces at vtk.org wrote on 18/08/2004 08:17:15:
>
> > I am using a vtkPolyDataSetReader to read unstructured
> > grid information. Then a vtkPolyDataSetMapper to
> > create an actor to display a mesh of an object. I am
> > looking for a way to display only the parts of the
> > mesh that would be actually visable ( just the front
> > face of the object). I have looked through the docs
> > and searched the archive, but I was unable to find
> > anything.
> >
> > If anyone knows of a method to accomplish this I would
> > appreciate the help.
> >
> > -Matt_______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.
> kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list