[vtkusers] Automatic building of Cubes

Joseph Melnyk JMelnyk at pile.com
Fri Feb 11 10:34:09 EST 2011


> -----Original Message-----
> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On
> Behalf Of Rene_Wohlgethan
> 
> I´ve got a problem again and i don´t know how to solve it.
> i want to do a procedure like this
> 
> for(i=0; i<=x, i++)
> vtkCubeSource *cube[i] = vtkCubeSource::New();
> 
> but i can´t do it like this, because cube needs a constant where "i" is.
> Is there a way to build a Vector or Array of Cubes?

You want an array of vtkCubeSource *'s:

vtkCubeSource **cubes = new vtkCubeSource * [x];
for(int i=0; i < x ;i++)
	cubes [i] = vtkCubeSource::New();

Make sure you delete what you allocated (using another for loop).

__Scanned by MessageLabs


More information about the vtkusers mailing list