[vtkusers] from vtkPolyData into vtkFloatArray

Cory Quammen cquammen at cs.unc.edu
Thu May 8 08:43:43 EDT 2008


Dmitri,

I'm assuming you are talking about getting scalar values from the
points in the vtkPolyData object. This ought to do it:

vtkPolyData *polyData = ...;
vtkDataArray *array = polyData->GetPointData()->GetScalars();

If your polydata has float data, you'll want to cast your vtkDataArray
vtkFloatArray. I believe this can be done with

vtkFloatArray *array =
vtkFloatArray::SafeDownCast(polyData->GetPointData()->GetScalars());

Otherwise, you'll have to downcast to the correct array type then copy
and cast into a new vtkFloatArray.

Hope this helps,
Cory

On Thu, May 8, 2008 at 5:30 AM, Dmitri Danewitz
<d.danewitz at fh-wolfenbuettel.de> wrote:
> Hi all!
>
>  Does somebody know how to put the Data from vtkPolyData into
>  vtkFloatArray?
>
>  Thanks!
>
>  Dmitri
>  _______________________________________________
>  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
>



-- 
Cory Quammen
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen



More information about the vtkusers mailing list