[vtk-developers] informations about vtkContourWidget

Nicolas Sarrasin nsarrasin at phenix-systems.com
Tue May 11 12:32:48 EDT 2010


Hi all,

I am new with VTK and I have some questions concerning /vtkContourWidget/.

I built a quick project wich use vtkContourWidget to display a contour 
on a sphere :

/    //définition de la sphere

     vtkSphereSource* theSphere = vtkSphereSource::New();

     vtkPolyDataMapper * sphereMapper = vtkPolyDataMapper::New();
     sphereMapper->SetInput(theSphere->GetOutput());

     vtkLODActor* sphereActor = vtkLODActor::New();
     sphereActor->SetMapper( sphereMapper);

     vtkRenderer *renderer1 = vtkRenderer::New();
     renderer1->AddActor(sphereActor);

     vtkRenderWindow *renWin = vtkRenderWindow::New();
     renWin->AddRenderer(renderer1);

     vtkRenderWindowInteractor *rendIter = vtkRenderWindowInteractor::New();
     rendIter->SetRenderWindow(renWin);

     // Here comes the image actor constrained handle widget stuff.....
     vtkContourWidget *widget = vtkContourWidget::New();
     widget->SetInteractor(rendIter);

     vtkSmartPointer<vtkLinearContourLineInterpolator> contourStyle = 
vtkSmartPointer<vtkLinearContourLineInterpolator>::New();

     vtkOrientedGlyphContourRepresentation *rep 
=vtkOrientedGlyphContourRepresentation::SafeDownCast( 
widget->GetRepresentation() );
     rep->SetLineInterpolator(contourStyle);

     //on définit un Placer pour forcer le contour a etre sur la sphere
     vtkPolyDataPointPlacer * spherePlacer = vtkPolyDataPointPlacer::New();
     spherePlacer->AddProp(sphereActor);
     rep->SetPointPlacer(spherePlacer);

     renWin->Render();
     rendIter->Initialize();
     widget->EnabledOn();
     rendIter->Start();/

_My questions :_

   1. The points of the contour are well positionned on the sphere but
      it's not the case for the spans defining the contour. Is there a
      way to force the entire contour (points + spans) to be on the sphere ?
   2. How can I get the geometry of the vtkContourWidget ? I saw in the
      documentation, the /GetSpan /function of
      vtkContourLineInterpolator but only returns one span. My goal is
      to compute an extrusion (via /vtkLinearExtrusionFilter/) on this
      contour.

Thanks by advance,

Nicolas


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100511/baf60656/attachment.html>


More information about the vtk-developers mailing list