[vtk-developers] Error with vtkDelaunay3D filter
XiongXiang Zhang
zhangxx110 at 126.com
Tue Nov 13 21:44:50 EST 2012
Hi,
We try to creates a tetrahedral mesh from unorganized points with vtkDelaunay3D filter. If the number of points is
very small(64*64*2), the filter work well. But error displays when the number is larger(256*256*2). The following is our code:
int dims[3];
dims[0]=256;
dims[1]=256;
dims[2]=2;
//instance vtkPoints
vtkPoints * points = vtkPoints::New();
for(int k=0;k<dims[2];k++)
for(int j=0;j<dims[1];j++)
for(int i=0;i<dims[0];i++)
{
points->InsertPoint(k*dims[1]*dims[0]+j*dims[0]+i,(double)i*0.95,(double)j*0.95,(double)k*1.5);
}
//instance vtkPolyVertex
vtkPolyVertex * polyvertex = vtkPolyVertex::New();
polyvertex->GetPointIds()->SetNumberOfIds(dims[0]*dims[1]*dims[2]);
for(int i=0;i<dims[0]*dims[1]*dims[2];i++)
{
polyvertex->GetPointIds()->SetId(i,i);
}
//instance vtkUnstructuredGrid
vtkUnstructuredGrid * grid=vtkUnstructuredGrid::New();
grid->SetPoints(points);
grid->InsertNextCell(polyvertex->GetCellType(), polyvertex->GetPointIds());
//Set scalars for grid
vtkUnsignedCharArray *dataArray=vtkUnsignedCharArray::New();
for(int i=0;i<dims[0]*dims[1]*dims[2];i++)
{
dataArray->InsertNextTuple1(i%128+128);
}
vtkPointData* pointdata=grid->GetPointData();
pointdata->SetScalars(dataArray);
//vtkDelaunay3D filter
vtkSmartPointer<vtkDelaunay3D> delaunay3D=vtkSmartPointer<vtkDelaunay3D>::New();
delaunay3D->SetInput(grid);
delaunay3D->SetTolerance(0.001);
delaunay3D->SetAlpha(100);
vtkUnstructuredGrid *delnoutput=delaunay3D->GetOutput();
delnoutput->Update();
The error is:
"The instruction at 0x00581eed referenced memory at 0x17879000. The memory could not be read. "
The version of VTK is 5.10.0, which is compiled from source, our systerm is Windows XP (SP3).
How can we solve this problem, and how much number of points can vtkDelaunay3D do?
Thakns!
XiongXiang Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20121114/ee36fe53/attachment.html>
More information about the vtk-developers
mailing list