[vtkusers] Get/Set values Vector Data
Allen Sanderson
allen at sci.utah.edu
Tue Mar 17 09:25:05 EDT 2015
Here is some sample code:
vtkDoubleArray *velocityArray = vtkDoubleArray::New();
velocityArray->SetName(var.c_str());
// NOTE: you want to set the number of components BEFORE setting the number of Tuples so memory is correctly allocated.
velocityArray->SetNumberOfComponents(3);
velocityArray->SetNumberOfTuples(nTuples);
polydata->GetPointData()->AddArray(velocityArray);
double dx, dy, dz;
Loop: velocityArray->SetTuple3(index, dx, dy, dz);
Where : 0<= index < nTuples
velocityArray->Delete();
The get would be:
double *velocity = velocityArray->GetTuple3(l);
Cheers,
Allen
Allen Sanderson
SCI Institute
University of Utah
www.sci.utah.edu
On Mar 17, 2015, at 1:03 PM, Chiranjib Sur <sur.chiranjib at gmail.com> wrote:
> Hi All,
> I want to assign values (3 component vector) to all in a polydata set.
> I found the email thread where the solution for a one component scalar data is explained (http://vtk.1045678.n5.nabble.com/Get-Set-values-in-scalar-data-td3259506.html)
>
> Anybody can help explaining how to do this for a 3-component vector data type.
>
> Thanks in advance.
>
> Chiranjib Sur
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150317/dedbef1b/attachment.html>
More information about the vtkusers
mailing list