[vtkusers] Arrays and double arrays of VTK pointers
Roberto De Leo
roberto.deleo at howard.edu
Fri Aug 19 14:42:49 EDT 2016
Hi all,
I'm using VTK for some topological computation on surfaces and I need to
use arrays and double arrays (matrices) of pointers of VTK objects. I
read similar questions on this ML in the past years but no very
satisfying (for me) answer.
With some effort I did find a way to do that but I know very little C++
and so possibly my way is unsafe and might cause some problem I cannot
foresee now, so I'd be very glad if some of you more C++ knowledgeable
could give a look to the code below and let me know if it's "safe":
<--- Example: 1-dim array of N pointers to vtkPolyData
vtkPolyData *p[N];
for( int i=0; i<N; i++ )
p[i] = vtkPolyData::New()
---------------->
<--- Example: 2-dim array of NxM pointers to vtkPolyData
vtkPolyData ***p = new vtkPolyData** [N];
for( int i=0; i<N; i++ ){
p[i] = new vtkPolyData* [M];
for( int j=0; j<M; j++ )
p[i][j] = vtkPolyData::New();
}
---------------->
Thanks,
Roberto De Leo
More information about the vtkusers
mailing list