Here's what I have done: //output is a vtkPolyData
int nbComponents = 2; vtkSmartPointer<vtkFloatArray> dataToAdd = vtkSmartPointer<vtkFloatArray>::New(); vtkIdType nbElems = output->GetNumberOfCells(); int size = nbElems * nbComponents; dataToAdd->SetNumberOfComponents(2); dataToAdd->SetNumberOfTuples(size); dataToAdd->SetName(name); int cpt = 0; for(unsigned int i = 0; i < values.size(); i += 2) { dataToAdd->InsertTuple2(cpt, values[i], values[i+1]); cpt++; } output->GetCellData()->AddArray(dataToAdd); Everything is ok and I can see elements that are colored corresponding to the magnitude, x and y components. But now, If I want to display gliph of these velocities I can't. Only attibutes attached to the points are presents. So, What is the way to display gliphs of attributes that are attached to some elements. Thank you. ________________________________ De : Andy Bauer <andy.ba...@kitware.com> À : R M <mlok...@yahoo.fr> Cc : paraview@paraview.org Envoyé le : Mar 12 octobre 2010, 19h 13min 16s Objet : Re: [Paraview] How to add vector/scalar field as attributes to a vtkPointSet (vtkPolyData, ...)? For the velocity array you'll need to set the number of components. You probably want to set the number of components to 3 for both 2D and 3D so that ParaView can manipulate the vector quantities (for 2D just set the last component to 0). Using the glyph filter will give you arrows for showing the velocity magnitude and direction. On Tue, Oct 12, 2010 at 12:08 PM, R M <mlok...@yahoo.fr> wrote: Hi, > >Like the title say, I would to like to add some attributes to a vtkPointSet >(vtkPolyData and vtkUnstructuredGrid). >The attributes are vector(2D, 3D,...) field or scalar field. > >For a scalar Field, If I want to add an attribute to the cells , I do: >output->GetCellData()->AddArray( data) and >output->GetPointData()->AddArray(donnees); for the points >For the moment it is ok, because I can select them in Paraview. > >But now, I have a 2D (or 3D) vector field (velocity) and I would to add the >velocity field for the points or the cells. How can I do that ? >Moreover, if I want to show somme arrow (to show the direction of the vectors) >should I use the glyph filter ? > >Thank you. > > > >_______________________________________________ >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 ParaView Wiki at: >http://paraview.org/Wiki/ParaView > >Follow this link to subscribe/unsubscribe: >http://www.paraview.org/mailman/listinfo/paraview > >
_______________________________________________ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview