[vtkusers] Removing internal cells !

Sebastien Auclair sxa at fluent.com
Fri Apr 18 12:12:10 EDT 2003


Interesting note:
If we use TwoSidedLightingOn instead of TwoSidedLightingOff, then the
internal facet becomes invisible !

The thing is that we are using TwoSidedLightingOff and removnig the internal
facets is critical for us since the models we are displaying take all our
system memory space.
These internal facets are unecessary and take too much space. There are
really many of them.

Thanks for any help !

________________________________
Seb

----- Original Message -----
From: "Sebastien Auclair" <sxa at fluent.com>
To: "Berk Geveci" <berklist at nycap.rr.com>
Cc: <vtkusers at public.kitware.com>
Sent: Friday, April 18, 2003 11:36 AM
Subject: Re: [vtkusers] Removing internal cells !


> This is the code :
>
> ######################################################################
> /*
>     THE CODE USUALLY PRESENT BEFORE THIS LINE IS NOT RELEVANT FOR THIS
> MAILLED CODE SAMBLE
> */
>  int h, i, pointCount, oldPointCount, polylineCount;
>  vtkPolyData* aGrid = vtkPolyData::New();
>
>
>  polylineCount = m_AllPolylines.count();
>
>  QDictIterator<TK3DPointList> it( m_AllPolylines ); // See QDictIterator
>  it.toFirst () ;
>  aGrid->Allocate(polylineCount, polylineCount );
>  oldPointCount = 0;
>
>  vtkPoints* allPoints = vtkPoints::New();
>  allPoints = getAllPolylinesPoints();
> // This will put in allPoints the following points describing a square:
> /*
>  (0, 0.0 ,0.0, 0.0);
>  (1,  20.0 ,0.0, 0.0);
>  (2,  20.0 ,20.0, 0.0);
>  (3,  0.0 ,20.0, 0.0);
>  (4,  0.0 ,0.0, 0.0);
>
> */
>  vtkIdList* array = vtkIdList::New();
>
>  for (h = 0; h < polylineCount; h++){
>       pointCount = (it.current())->m_points->GetNumberOfPoints ();
>
>       array->SetNumberOfIds(pointCount);
>       for (i = 0; i <  pointCount; i++){
>            array->SetId(i, i + oldPointCount);
>       }
>       aGrid->InsertNextCell (VTK_POLYGON,  array);
>       array->Reset();
>       oldPointCount += pointCount;
>       ++it ;
>  }
>
>  aGrid->SetPoints( allPoints);
>  aGrid->Update();
>
>  vtkGLUTesselatorTriangleFilter* tri =
> vtkGLUTesselatorTriangleFilter::New();
>  tri->SetInput(aGrid);
>  tri->PassVertsOff ();
>  tri->PassLinesOff ();
>  tri->Update();
>
>  vtkReverseSense* reverser = vtkReverseSense::New();
>  reverser->SetInput(tri->GetOutput());
>  reverser->ReverseCellsOn ();
>  reverser->ReverseNormalsOff ();
>  reverser->Update();
>
>  vtkPolyDataNormals* normalA = vtkPolyDataNormals::New();
>  normalA->SetInput(reverser->GetOutput());
>  normalA->Update();
>
>
>  vtkLinearExtrusionFilter* extruder= vtkLinearExtrusionFilter::New();
>  extruder->SetInput(normalA->GetOutput());
>  extruder->SetExtrusionTypeToNormalExtrusion ();
>  extruder->CappingOn ();
>  extruder->SetScaleFactor (-m_thickness);
>  extruder->Update();
>
>  vtkPolyDataNormals* normal = vtkPolyDataNormals::New();
>  normal->SetInput(extruder->GetOutput());
>  normal->Update();
>
> /*
>     THE CODE USUALLY HERE IS NOT RELEVANT FOR THIS MAILLED CODE SAMBLE
> */
>
>
>  aGrid->Delete();
>  array->Delete();
>  tri->Delete();
>  reverser->Delete();
>  normalA->Delete();
>  normal->Delete();
>  extruder->Delete();
>  allPoints->Delete();
> ##################################################################3
>
>
> Thanks !
> __________________________________
> Seb
>
>
>
>
>
> ----- Original Message -----
> From: "Berk Geveci" <berklist at nycap.rr.com>
> To: "Sebastien Auclair" <sxa at fluent.com>
> Sent: Thursday, April 17, 2003 4:11 PM
> Subject: Re: [vtkusers] Removing internal cells !
>
>
> > > Yes i'am using vtkLinearExtrusionFilter.
> > > The polygons are complex and often non-convex so before being
extruded,
> they
> > > are passed through vtkGLUTesselatorTriangleFilter.
> > >
> > > When displayed with transparency, we can see the internal facets !
> >
> > hmm. I wonder if this has something to do with the way
> > tesselation is done (duplicate points, edges etc.). Can you
> > reproduce this with one simple polygon (and if you can,
> > can you write it to a file and send it to me) ?
> >
> > -Berk
> >
> >
>




More information about the vtkusers mailing list