[vtkusers] How Get data after vtkDelaunay3D class use
Amit Dhaduk
amit at sahajanandsoftware.com
Fri Apr 15 01:40:13 EDT 2005
Hello,
I have use vtkDelaunay3D class to generate unstructuredgrid data from my point cloud(un organized) data. I want tetrahedra, triangles, edges, and vertices data from
vtkDelaunay3D->GetOutput(). As I use vtkDataSet->GetNumberOfPoints() and vtkDataSet->GetNumberOfCells, I always get result 0. I also implement
vtkDelaunay3D->GetOutput() in vtkPolydata form by vtkExtractUnstructuredGrid - vtkGeometryFilter - pPolydatanorm->GetOutput(),
but get the result nothing. I want output data to use display that data in my own way insted use vtkPolyDataMapper and render by actor and camera class.
Can anyone tell me that how I get tetrahedra, triangles, edges, and vertices data information from vtkDelaunay3D->GetOutput() as I can use it my own way to display these data in OpenGL.
My implement is as below.
/////////////////////
vtkPoints *pvtkPoints = vtkPoints::New();
vtkPoints *pvtkPoints1 = vtkPoints::New();
CString csFile;
FILE *fData=fopen("C:\\dataxyz.txt","r");
FILE *fmathData=fopen("C:\\datamath.txt","w");
int cnt=0;
while(!feof(fData))
{
float x,y,z;
if(fscanf(fData,"%f %f %f",&x,&y,&z)!=3)
{
break;
}
pvtkPoints->InsertPoint(cnt,x,y,z);
cnt++;
}
fclose(fData);
vtkPolyData* pvtkPolyData = vtkPolyData::New();
pvtkPolyData->SetPoints(pvtkPoints);
vtkSPDF = vtkDelaunay3D::New();
vtkSPDF->SetInput(pvtkPolyData);
vtkSPDF->SetAlpha(5);
vtkSPDF->SetTolerance(1);
vtkSPDF->BoundingTriangulationOn();
vtkSPDF->SetTolerance(1.0f);
vtkSPDF->SetOffset(2.5f);*/
dataSet = vtkUnstructuredGrid::New();
// OutPut = vtkSPDF->GetOutput();
vtkPolydata *dataSet = vtkPolydata::New();
dataSet = vtkSPDF->GetOutput();
dataSet ->GetNumberOfCells(); -------------The result is nothing as always 0.
vtkExtractUnstructuredGrid *pEXGrid = vtkExtractUnstructuredGrid::New();
pEXGrid->SetInput(dataSet);
pEXGrid->CellClippingOff();
pEXGrid->SetCellMinimum(0);
pEXGrid->SetCellMaximum(23);
vtkGeometryFilter *pGeo = vtkGeometryFilter::New();
pGeo->SetInput(pEXGrid->GetOutput());
pGeo->MergingOn();
vtkPolyDataNormals *pPolydatanorm = vtkPolyDataNormals::New();
pPolydatanorm->SetInput(pGeo->GetOutput());
pPolydatanorm->SetFeatureAngle(60);
pPolydatanorm->ComputeCellNormalsOn();
vtkPolydata *p=vtkPolydata ::New;
p = pPolydatanorm->GetOutput();
p->GetNumberOfCells(); -----------------The result is 0 always.
/////////////////////
Thanks in adv.
Amit Dhaduk
SSPL.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050415/40aab5fb/attachment.htm>
More information about the vtkusers
mailing list