[vtkusers] how to construct vktCell with vtkPoints
Emmanouil Moschidis
moshman65 at yahoo.com
Tue May 1 07:38:33 EDT 2007
Hi
this is a piece of code that should work...
vtkPoints *cloudPoints=new vtkPoints;
vtkCellArray *cloudCells=new vtkCellArray;
vtkPolyData *cloudPData=new vtkPolyData;
cloudPoints->SetDataTypeToDouble();
cloudPoints->SetNumberOfPoints(numberOfVTKPoints);
for(int i=0; i<(numberOfVTKCells*3); i++)
{
cloudPoints->SetPoint(i,vtkStoredPointsBuffer[i].getX(),vtkStoredPointsBuffer[i].getY(),vtkStoredPointsBuffer[i].getZ());
}
cloudCells->InsertNextCell(numberOfVTKPoints);
for (int i=0; i<numberOfVTKPoints; i++)
{
cloudCells->InsertCellPoint(i);
}
cloudPData->SetPoints(cloudPoints);
cloudPData->SetLines(cloudCells);
the only weird thing you may see is these getX(), getY(), getZ() methods. The reason why i use these methods is that i store my points in std::vector<Point3D>
where Point3D is a custom class for 3D points (in your case you use vtkPoints).
Try it and tell me if it worked. I am not 100% this is the correct way though
Good luck :-)
ѧ־ Ñî <shulo1978 at hotmail.com> wrote: Hi all, I extract vtkpoints from a polydata and want to reconstruct them
back into vtkCell. Can anyone give me some hint to do this? The points are
taken out based on some conditions so I can't use getCell from vtkpolydata
to take the cell straignthaway. Thank you!
_________________________________________________________________
Could you be the guest MSN Movies presenter? Click Here to Audition
http://www.lightscameraaudition.co.uk
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070501/141563b6/attachment.htm>
More information about the vtkusers
mailing list