[vtkusers]vtkActor array

David Cole david.cole at kitware.com
Mon Mar 14 08:56:47 EST 2005


> vtkActor **array = new vtkActor* [170];
> array[0]->SetInput(mapper); (mapper is a vtkPolyDataMapper)

Your new is allocating 170 *pointers* that are uninitialized. Before 
dereferencing array[i], you need to allocate all of them with an assigment:
for (i= 0; i<170; ++i)
{
  array[i]= vtkActor::New();
}

Then you can call any vtkActor methods that make sense.

Then, prior to deleting your array, when you are done, you'll need to 
loop through again and call Delete:
for (i= 0; i<170; ++i)
{
  array[i]->Delete();
}

Hope this helps,
David





More information about the vtkusers mailing list