[vtkusers] Filling vtkPoints and vtkCellArray fast
Matt
pspmatt at gmail.com
Fri Jan 15 11:21:01 EST 2010
Hello,
I have recently started using VTK. First, let me say thanks! It is amazing.
I am working on an application in ITTVIS IDL that will communicate with a
DLL (C++) that contains VTK code.
I have the DLL and the communication working fine and am able to pass data
between the programs.
I want to make a bunch of polygons and pass them through the generate tube
filter before passing it back to IDL.
I am passing two arrays from IDL:
1) Array of points in floats. 1D. Form: X0 Y0 Z0 X1 Y1 Z1 X2 Y2 Z2
2) Array of connectivity in int. 1D Form: N P0 P1 P2 N P1 P3 N P2
P3
** I think the data is in the form that it is represented in memory in VTK.
(As in pg. 126 4th edition, OO approach to 3D graphics)
The usual approach would be to create a vtkPolyData array (for the
polygons), vtkPoints, and a vtkCellArray for connectivity).
And, then to fill them using vtkPoints->InsertPoint,
vtkCellArray->InsertNextCell, and then vtkPolyData->setPoints.
However, I need this to be very effcient as I may be calling these routines
repeatedly. Given, that the data is almost in the form that VTK expects.
I want to be able to stuff the data in whole vs point by point, cell by
cell.
I can't seem to find a good explanation on how I would go about doing this.
There seems to be a ->setData method in vtkPoints class but it takes a
vtkDataArray and I currently just have a plain old array of floats.
I think the same goes for setCells in the vtkCellArray class.
Could someone give me a quick example of the few lines of code it would take
to impelement this. Or,, point me to a resource that shows an example of
this
Thanks
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100115/6d0581eb/attachment.htm>
More information about the vtkusers
mailing list