[vtkusers] can't label poly data
payman labbaf
payman_vtk at yahoo.co.uk
Thu Jan 20 09:01:16 EST 2005
Dear All,
I've been trying to label some points with irregular geometery and topology.
I chose vtkPolyData as it says in the specification that is fine for 0 dimension data.
Now I have a problem with labeling the data.
Could you please have a look at my simplified code and let me know what I'm doing wrong.
//Points
float pointsArray[12] = {1,1,0,1,2,0,2,1,0,2,2,0};
vtkFloatArray *pointFloatArray = vtkFloatArray::New();
pointFloatArray->SetNumberOfComponents(3);
pointFloatArray->SetNumberOfTuples(dims[0]*dims[1]*dims[2]);
pointFloatArray->SetVoidArray(&pointsArray[0],12,1);
vtkPoints *points = vtkPoints::New();
points->SetData(pointFloatArray);
//Vectors
float array[12] = {10,5,0,11,6,0,12,7,0,13,8,0};
vtkFloatArray *vectors = vtkFloatArray::New();
vectors->SetNumberOfComponents(3);
vectors->SetNumberOfTuples(dims[0]*dims[1]*dims[2]);
vectors->SetArray(&array[0],12,1);
//Poly Data
vtkPolyData *polyData = vtkPolyData::New();
polyData->SetPoints(points);
polyData->GetPointData()->SetVectors(vectors);
//Label Mapper
vtkLabeledDataMapper *labelMapper = vtkLabeledDataMapper::New();
labelMapper->SetInput(polyData);
labelMapper->SetLabelModeToLabelVectors();
//Actor
vtkActor2D *actor = vtkActor2D::New();
actor->SetMapper(labelMapper);
The above code works when I'm using vtkStructuredGrid but not for polyData.
(I also tried InsertNextPoint() function for giving the points coordinates to vtkPolyData and that didn't work either)
Many thanks in advance
---------------------------------
ALL-NEW Yahoo! Messenger - all new features - even more fun!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050120/f6197f2f/attachment.htm>
More information about the vtkusers
mailing list