[vtkusers] Add a new scalar and array to vtkPolyData

David Doria daviddoria at gmail.com
Thu Feb 9 08:48:29 EST 2012


On Thu, Feb 9, 2012 at 12:43 AM, Ahmad <falahatpisheh at gmail.com> wrote:
> I came to the following solution to extend 2D coordinate data to 3D
> coordinate. Do you think there is a better way than looping through all the
> points to add the value of z by the following code?
>
> for-loop-through-all-points (i):
>    double temp[3];
>    polydata->GetPoints()->GetPoint(i,temp) ;
>    temp[2]=z[i];
>    polydata->GetPoints()->SetPoint(i,temp[0],temp[1],temp[2]) ;
> end-for-loop

You could also use:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/TextAnalysis/ConcatenateArray

but if you'd have to construct the second array anyway I don't think
it would be any better.

David



More information about the vtkusers mailing list