[vtkusers] error with find point
Gonzalo Amadio
gonzaloamadio at gmail.com
Mon Aug 20 16:57:38 EDT 2012
Hello, I have a polydata, and after extracting its boundary edges I want to
traverse them, and for each point in each edge, I want to find the point Id
in the polydata. Something like this :
vtkSmartPointer<vtkFeatureEdges> boundaryEdges =
> vtkSmartPointer<vtkFeatureEdges>::New();
> boundaryEdges->SetInput(polydata);
> boundaryEdges->BoundaryEdgesOn();
> boundaryEdges->FeatureEdgesOff();
> boundaryEdges->ManifoldEdgesOff();
> boundaryEdges->NonManifoldEdgesOff();
> boundaryEdges->Update();
>
vtkSmartPointer<vtkPolyData> edges = boundaryEdges->GetOutput();
>
for(vtkIdType i = 0; i < edges->GetNumberOfCells(); i++)//for each point in
> boundary edges
> {
> vtkSmartPointer<vtkLine> line = vtkLine::SafeDownCast(edges->GetCell(i));
> vtkSmartPointer<vtkPoints> points_line = line->GetPoints(); //2 points
>
double p[3];
> for(int j = 0; j < points_line->GetNumberOfPoints(); j++)
> {
> points_line->GetPoint(j,p);
> vtkIdType idPointCorrespondant = polydata->FindPoint(p);//Error in this
> line
> }
> }
The error I have is in this function (into the file vtkIdList.h) :
inline vtkIdType vtkIdList::InsertNextId(const vtkIdType vtkid)
> {
> if ( this->NumberOfIds >= this->Size ) //the debugger stop in this line
> {
> this->Resize(this->NumberOfIds+1);
> }
> this->Ids[this->NumberOfIds++] = vtkid;
> return this->NumberOfIds-1;
> }
I tried the same code with another polydata and it works, So I can't figure
out what is wrong with my polydata.
Here is the code of the example : http://pastie.org/4558410
Someone can help me?
Thank you!
--
--------
Gonzalo Amadio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120820/23238e55/attachment.htm>
More information about the vtkusers
mailing list