[vtkusers] closed polygon from splinewidget

Michael Knopke Michael.Knopke at gmx.de
Fri Feb 2 05:46:41 EST 2007


Hi,

I want to probe a dataset with the vtkSplineWidget. But I don't know how to get the closed surface (inside of closed spline).

I use the vtkSplineWidget to create a closed Spline and get the corresponding PolyData (->GetPolyData())from the spline. If I visualize it, I can see that it is a closed Spline (->ClosedOn() was set in vtkSplineWidget) but only as a line like a Circle or whatever you form with it.

What I need is the complete Surface e.g. a disk

 

The way I tried is this:

 

1.)     create a PolyLine (should be closed) from the PolyData.

2.)     create vtkCellArray and create new polygon from PolyLine and Array

3.)     Tessalate the polgon // gives ERROR

 

Now when I test to triangulate the new Polygon I get an error that the vtkTriangleFilter is working on a degenerated polygon.

 

Here is the code snippet:

 

       // the spline returns polydata (which can be shown once mapped, it    forms a circle)

       NewSpline->GetPolyData(NewPoly);

       
       // creating a PolyLine from the polydata (not sure if correct)

       int pointCount = NewPoly->GetPoints()->GetNumberOfPoints();

 

       aPolyLine = vtkPolyLine::New();

       aPolyLine->GetPointIds()->SetNumberOfIds(pointCount);

 

       int* pntIds = new int[pointCount];

       for (unsigned int i = 0; i < (int)pointCount; i++)

       {

        pntIds[i] = i;

        }

 

       aPolyLine->Initialize(pointCount, pntIds, NewPoly->GetPoints());

 

       vCA = vktCellArray::New();

       vCA->InsertNextCell(aPolyLine);

 

       

       // this is from Examples capCow and should create a Polygon from closed PolyLine ( I also tried the vtkStripper to create a closed PolyLine but didn’t help)

       tempPoly = vtkPolyData::New();

       tempPoly->SetPoints(aPolyLine->GetPoints());

       tempPoly->SetPolys(vCA);

 

 

       triangleFilter->SetInput(tempPoly);

       triangleFilter->Update();  // ERROR vtkPolygon (94564696): Degenerate polygon encountered during triangulation


Can anybody help?

Thanks alot

Michael
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer



More information about the vtkusers mailing list