Bonjour,

Je débute avec VTK et j'ai du mal à afficher un nuage de points 2D. Je suis parti du code d'exemple suivant http://www.itk.org/Wiki/VTK/Examples...ng/ScatterPlot.
Ce code fonctionne très bien avec plusieurs plots, mais lorsque je tente avec un seul plot, les points ne s'affichent plus.

Voici le code fautif:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
void Window::afficher_particules( std::vector<Particule>& part )
{
 
  vtkSmartPointer<vtkTable> table = vtkSmartPointer<vtkTable>::New();
 
  vtkSmartPointer<vtkFloatArray> arrX = vtkSmartPointer<vtkFloatArray>::New();
  arrX->SetName("X");
  table->AddColumn( arrX );
 
  vtkSmartPointer<vtkFloatArray> arrY = vtkSmartPointer<vtkFloatArray>::New();
  arrY->SetName("Y");
  table->AddColumn( arrY );
 
  int size = part.size();
 
  table->SetNumberOfRows(size);
  for( int i=0 ; i<size ; i++ )
    {
      table->SetValue( i, 0, part[i].position(0) );
      table->SetValue( i, 1, part[i].position(1) );
    }
 
  vtkPlot* points = chart->AddPlot( vtkChart::POINTS );
 
  points->SetInputData( table, 0, 1 );
  points->SetColor( 0, 0, 0, 255 );
  points->SetWidth( 1.0 );
  vtkPlotPoints::SafeDownCast(points)->SetMarkerStyle(vtkPlotPoints::CIRCLE);
 
  view->GetRenderWindow()->SetMultiSamples(0);
  view->GetInteractor()->Initialize();
  view->GetInteractor()->Start();
 
}
Quelqu'un saurait-il résoudre mon problème ?
Merci d'avance,

Martin