[vtkusers] vtkDelaunay3D

liu jianfei flair.liu at gmail.com
Wed Nov 12 15:26:01 EST 2014


Dear all

    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.

void radCanvas::SetLocalParetoPoints(vector<Point3D> & pts)
{
    //LocalParetoPoints is defined as vtkPoints
    LocalParetoPoints->Initialize();
    LocalParetoPoints->SetNumberOfPoints(pts.size());
    for (int i=0; i<pts.size(); i++)
        LocalParetoPoints->SetPoint(i, pts.at(i).x, pts.at(i).y, pts.at
(i).z);

    //LocalParetoPoly is defined as vtkPolyData
    LocalParetoPoly->Modified();

    //LocalParetoDelaunay is defined as vtkDelaunay3D

LocalParetoDelaunay->SetInputConnection(LocalParetoPoly->GetProducerPort());

    //LocalParetoFilter is defined as vtkDataSetSurfaceFilter

LocalParetoFilter->SetInputConnection(LocalParetoDelaunay->GetOutputPort());
    LocalParetoFilter->Modified();
    LocalParetoFilter->Update();
}

   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.

//==============================================================
    vtkIdType vtkDelaunay3D::FindEnclosingFaces(double x[3],
                                            vtkUnstructuredGrid *Mesh,
                                            vtkIdList *tetras,
                                            vtkIdList *faces,
                                            vtkIncrementalPointLocator
*locator)
{
  vtkIdType tetraId, i, numTetras;
  int j, insertFace;
  vtkIdType p1, p2, p3, nei;
  int hasNei;
  vtkIdType *tetraPts, npts;
  vtkIdType closestPoint;
  double xd[3]; xd[0]=x[0]; xd[1]=x[1]; xd[2]=x[2];

  // Start off by finding closest point and tetras that use the point.
  // This will serve as the starting point to determine an enclosing
  // tetrahedron. (We just need a starting point
  if ( locator->IsInsertedPoint(x) >= 0 )
    {
    this->NumberOfDuplicatePoints++;
    return 0;
    }

  closestPoint = locator->FindClosestInsertedPoint(x);
  vtkCellLinks *links = Mesh->GetCellLinks();
  int numCells = links->GetNcells(closestPoint);
  vtkIdType *cells = links->GetCells(closestPoint);
  if ( numCells <= 0 ) //shouldn't happen
    {
    this->NumberOfDegeneracies++;
    return 0;
    }
  else
    {
    *tetraId = cells[0];*
    }

  // Okay, walk towards the containing tetrahedron
  tetraId = this->FindTetra(Mesh,xd,tetraId,0);
  if ( tetraId < 0 )
    {
    this->NumberOfDegeneracies++;
    return 0;
    }
//==============================================================

   Can anyone tell me how to fix this issue? Thank you.

-- 
Sincerely
Jianfei Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141112/4a0a1423/attachment.html>


More information about the vtkusers mailing list