[vtkusers] triangulating a cylinder
debbie larson
debbielarson_9 at hotmail.com
Tue Dec 5 18:15:07 EST 2006
Hi,
I would like to build a vtkPolyData (triangular) representation of a
cylinder. The points that define the cylinder sit on a number N of
perpendicular circles (they are equally spaced).
I dont know how to specify the vtkCellArray for the triangles so that they
match the points. Here it is how I compute the points in the cylinder
-------------------------------------------------------
float pts[number_of_points*N][3];
for (int k=0;k<N;k++)
{
for (int j=0;j<number_of_points;j++)
{
pts[k*number_of_points+j][0]=radius*cos(2*M_PI*j/number_of_points);
pts[k*number_of_points+j][1]=radius*sin(2*M_PI*j/number_of_points);
pts[k*number_of_points+j][2]=k*distance_between_circles;
}
}
vtkFloatArray* coords=vtkFloatArray::New();
coords->SetNumberOfComponents(3);
coords->SetNumberOfTuples(number_of_points*N);
for (int i=0;i<number_of_points*N;i++)
{
coords->SetTuple(i,innerpts[i]);
}
vtkPoints points=vtkPoints::New();
points->SetData(coords);
---------------------------------------------------------------------
I would like to do something like
vtkCellArray* tri=vtkCellArray::New();
and assign the points above to tri. How to do it?
Thanks
deb
_________________________________________________________________
Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday
cash!
http://www.msnholidaychallenge.com/default.aspx?ocid=tagline&locale=en-us
More information about the vtkusers
mailing list