<div dir="ltr"><div><div>Dear all<br><br></div> I am using vtkDelaunay3D filter to create a mesh surface. However, the input points for vtkDelaunay3D will be dynamically changed. Please see the attached code. <br><br>void radCanvas::SetLocalParetoPoints(vector<Point3D> & pts)<br>{<br> //LocalParetoPoints is defined as vtkPoints<br> LocalParetoPoints->Initialize();<br> LocalParetoPoints->SetNumberOfPoints(pts.size());<br> for (int i=0; i<pts.size(); i++)<br> LocalParetoPoints->SetPoint(i, <a href="http://pts.at">pts.at</a>(i).x, <a href="http://pts.at">pts.at</a>(i).y, <a href="http://pts.at">pts.at</a>(i).z);<br> <br></div> //LocalParetoPoly is defined as vtkPolyData<br><div> LocalParetoPoly->Modified();<br><br></div><div> //LocalParetoDelaunay is defined as vtkDelaunay3D<br></div><div> LocalParetoDelaunay->SetInputConnection(LocalParetoPoly->GetProducerPort());<br> <br> //LocalParetoFilter is defined as vtkDataSetSurfaceFilter<br> LocalParetoFilter->SetInputConnection(LocalParetoDelaunay->GetOutputPort());<br> LocalParetoFilter->Modified();<br> LocalParetoFilter->Update();<br>}<br><br></div><div> For the first time when this program is imported with a set of 3d points, the program is working very well. However, if I modified points and imported into this function again, the program will be crashed. I attached the errors in the below where the program stopped at the line highlighted in red. I have checked a few local variables, where closestPoint = -1 and *cells is not defined. <br><br>//==============================================================<br> vtkIdType vtkDelaunay3D::FindEnclosingFaces(double x[3],<br> vtkUnstructuredGrid *Mesh,<br> vtkIdList *tetras,<br> vtkIdList *faces,<br> vtkIncrementalPointLocator *locator)<br>{<br> vtkIdType tetraId, i, numTetras;<br> int j, insertFace;<br> vtkIdType p1, p2, p3, nei;<br> int hasNei;<br> vtkIdType *tetraPts, npts;<br> vtkIdType closestPoint;<br> double xd[3]; xd[0]=x[0]; xd[1]=x[1]; xd[2]=x[2];<br><br> // Start off by finding closest point and tetras that use the point.<br> // This will serve as the starting point to determine an enclosing<br> // tetrahedron. (We just need a starting point<br> if ( locator->IsInsertedPoint(x) >= 0 ) <br> {<br> this->NumberOfDuplicatePoints++;<br> return 0;<br> }<br><br> closestPoint = locator->FindClosestInsertedPoint(x);<br> vtkCellLinks *links = Mesh->GetCellLinks();<br> int numCells = links->GetNcells(closestPoint);<br> vtkIdType *cells = links->GetCells(closestPoint);<br> if ( numCells <= 0 ) //shouldn't happen<br> {<br> this->NumberOfDegeneracies++;<br> return 0;<br> }<br> else<br> {<br> <font size="4"> <span style="background-color:rgb(255,0,0)"><b>tetraId = cells[0];</b></span></font><br> }<br> <br> // Okay, walk towards the containing tetrahedron<br> tetraId = this->FindTetra(Mesh,xd,tetraId,0);<br> if ( tetraId < 0 ) <br> {<br> this->NumberOfDegeneracies++;<br> return 0;<br> }<br></div><div>//==============================================================<br><br></div><div> Can anyone tell me how to fix this issue? Thank you. <br><br></div><div><div><div>-- <br><div class="gmail_signature">Sincerely<br>Jianfei Liu</div>
</div></div></div></div>