[vtkusers] Adding two SCALARS into on vtkPolyData

David Doria daviddoria at gmail.com
Thu Jan 5 08:02:04 EST 2012


On Wed, Jan 4, 2012 at 10:47 PM, Forrest Sheng Bao <forrest.bao at gmail.com>wrote:

> Hi,
>
> I am trying to associate two scalars to points of a vtkPolyData object
> (i.e., I want to see two SCALARS blocks in POINTDATA segment in the output
> VTK file).
>
> Suppose I have a vtkPolyData pointer
>
> vtkPolyData* mesh;
>
> and two vtkDoubleArray pointers
>
>  vtkDoubleArray* depth;
>  vtkDoubleArray* curv;
>
> This is what I do:
>
> depth->SetName("Depth");
> mesh->GetPointData()->SetScalars(depth);
> curv->SetName("Curvature");
> mesh->GetPointData()->AddArray(curv)
>
> Sure, that is fine.
You could equivalently do:

mesh->GetPointData()->AddArray(depth);
mesh->GetPointData()->AddArray(curv)

mesh->GetPointData()->SetActiveScalars("Depth");

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120105/e644211c/attachment.htm>


More information about the vtkusers mailing list