[vtkusers] how to construct vktCell with vtkPoints

ѧ־ Ñî shulo1978 at hotmail.com
Tue May 1 13:26:22 EDT 2007


Thank you. It does work. By the way, do you know any filter like 
threshfilter can filter vtkPolyData but return structured polydata instead 
of unstructured? Cheers

>From: Emmanouil Moschidis <moshman65 at yahoo.com>
>To: "ѧ־" "Ñî" <shulo1978 at hotmail.com>
>CC: vtkusers at vtk.org
>Subject: Re: [vtkusers] how to construct vktCell with vtkPoints
>Date: Tue, 1 May 2007 04:38:33 -0700 (PDT)
>
>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.

_________________________________________________________________
Txt a lot? Get Messenger FREE on your mobile.  
https://livemessenger.mobile.uk.msn.com/




More information about the vtkusers mailing list