[vtkusers] Converting Points to Vertices

Asad A. Abu-Tarif asad at cat.rpi.edu
Fri Feb 23 13:33:18 EST 2001


Hi Erik,
I'm assuming that your points are stored in a vtkPoints data structure.
You will need to create a vtkPolyData and set points to the vtkPoints
You will need to create a vtkCellArray and add the points then use
SetVerts

Here is an example (in C++):

===============================================================
vtkPolyData *PointsPoly=vtkPolyData::New();
vtkPoints *Points=vtkPoints::New();
vtkCellArray *Verts=vtkCellArray::New();

// Fill your points in 'Points'

int NumberOfVerts= // Fill hte number of points in here;

for(int i=0;i<NumberOfVerts;i++)
{
	int Id=i;
	Verts->InsertNextCell(1,&Id);
}

PointsPoly->SetPoints(Points);
PointsPoly->SetVerts(Verts);
==============================================================

Good luck
Asad

Erik Sobel wrote:
> 
> Can anyone tell me how to convert a data set containing only Points into a
> data set with a Vertex for each point.
> 
> Thanks,
> Erik
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers




More information about the vtkusers mailing list