[vtkusers] triangulating a cylinder

Burlen burlen at apollo.sr.unh.edu
Wed Dec 6 16:02:03 EST 2006


Hi, did you figure this out yet? Take a look at page 9 of this 
http://www.vtk.org/pdf/file-formats.pdf 
It shows how to define different cell types by hand in the context of creating 
a legacy file, but its applicable to generating polydata as well.
good luck!!


On Tuesday 05 December 2006 06:15 pm, debbie larson wrote:
> 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
>
> _______________________________________________
> 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

-- 

Burlen Loring
Space Science Center
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
39 College Road, Durham, NH 03824
Phone: 603-862-1140



More information about the vtkusers mailing list