[vtkusers] vtkIdFilter : Is it possible to modify the start of id numbering ?

Jean-Do Barnichon jeando.barnichon at free.fr
Sun Dec 3 05:19:38 EST 2006


Hi all,

I'm using vtkIdFilter to display the point ids of a mesh, which works 
fine (see code below).
In the output window, the points are well added to the mesh at their 
correct locations, with a numbering that starts from 0.
My question is :
would it be possible to make the displayed point numbers starting from 1 
instead of 0?

Any idea or hint welcome.
Thanks,
Jean-Do
...
            // Create IdFilter
            vtkIdFilter *ids = vtkIdFilter::New();
            ids->SetInput(m_pMeshPolyData);
            ids->PointIdsOn();

            // Create labels for points
            vtkSelectVisiblePoints *visPts = vtkSelectVisiblePoints::New();
            visPts->SetInputConnection(ids->GetOutputPort());
            visPts->SetRenderer(Renderer);

            // Create the mapper to display the point ids.  Specify the
            // format to use for the labels.  Also create the associated 
actor.
            vtkLabeledDataMapper *ldm = vtkLabeledDataMapper::New();
            ldm->SetInputConnection(visPts->GetOutputPort());
            ldm->SetLabelFormat("%g");
            ldm->SetLabelModeToLabelFieldData();
            (ldm->GetLabelTextProperty())->SetColor(1.,0.,0.);
            vtkActor2D *pointLabels = vtkActor2D::New();
            pointLabels->SetMapper(ldm);

            // Add actor
            Renderer->AddActor(pointLabels);
...



More information about the vtkusers mailing list