[vtkusers] Exception throw with vtkPolygonalSurfaceContourLineInterpolator

Nicolas Sarrasin nsarrasin at phenix-systems.com
Thu Jan 13 13:06:04 EST 2011


Hi all,

I'm coding an application to select edges on a vtkPolyData.

For my needs, I first have to build a wireframe vtkPolyData of the input 
(vtkPolyline->GetPointIds(...); 
vtkCellArray->InsertNextCell(vtkPolyLine); vtkPolyData->SetPoints(..); 
vtkPolyData->SetLines(vtkCellArray);...)

This part is ok. Then I use vtkContourWidget with 
vtkPolygonalSurfacePointPlacer and 
vtkPolygonalSurfaceContourLineInterpolator :


     vtkSmartPointer<vtkContourWidget> contourWidget = 
vtkSmartPointer<vtkContourWidget>::New();
     contourWidget->SetInteractor(interactor);

     vtkSmartPointer<vtkOrientedGlyphContourRepresentation> rep =
         
vtkOrientedGlyphContourRepresentation::SafeDownCast(contourWidget->GetRepresentation());
     rep->GetLinesProperty()->SetColor(1, 0.2, 0);
     rep->GetLinesProperty()->SetLineWidth(3.0);

     vtkSmartPointer<vtkPolygonalSurfacePointPlacer> pointPlacer =
         vtkSmartPointer<vtkPolygonalSurfacePointPlacer>::New();
     pointPlacer->AddProp(actor);
     pointPlacer->GetPolys()->AddItem( my_polydata );

     vtkSmartPointer<vtkPolygonalSurfaceContourLineInterpolator> 
interpolator =
         vtkSmartPointer<vtkPolygonalSurfaceContourLineInterpolator>::New();
     interpolator->GetPolys()->AddItem( my_polydata );

rep->SetPointPlacer(pointPlacer);
     rep->SetLineInterpolator(interpolator);

     contourWidget->EnabledOn();

When I pick one point it's ok but after the second picking I get an 
exception  : "vector subscript out of range" thrown in the function 
vtkDijkstraGraphGeodesicPath::TraceShortestPath().

It appears only if I the LineInterPolator is 
vtkPolygonalSurfaceContourLineInterpolator. It seems that Dijkstra can't 
find the path allong the lines.

So I'm asking where does this comes from ?

When I compute a vtkpolyDataConnectivityFilter, it says me I have only 
one region, so my data is right connected (i means I have no holes on my 
polylines).

Is there a filter I can pass to my polydata to make it works ??

Thanks by advance for helping me.

Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110113/64e7baa1/attachment.htm>


More information about the vtkusers mailing list