[vtkusers] How to delete a line ?

luciangoron luciangoron at gmail.com
Thu May 14 08:04:31 EDT 2009


I have a simple code here:

I "print" 2 lines, and than I want to "delete" the first one... (I want to
NOT see it anymore)

#include "../common/CommonVTKRoutines.h"
#include "../common/CommonANNRoutines.h"
#include "../common/Common3DGeomRoutines.h"
#include "../common/CommonIORoutines.h"
#include "../common/CommonTerminalRoutines.h"
#include "../common/ANN-VTK.h"

using namespace cANN;
using namespace std;

int main (int argc, char** argv)
{
  // create vtk renderer and vtk interactor //
  vtkRenderer *ren = vtkRenderer::New ();
  ren->SetBackground (0, 0, 0);
  vtkRenderWindowInteractor *iren = CreateRenderWindowAndInteractor (ren,
"TEST", argc, argv);
  
  // first line //
  vtkLineSource *line1 = vtkLineSource::New();
  line1->SetPoint1 (1.0, 1.0, 1.0);
  line1->SetPoint2 (1.5, 1.5, 1.5);
  vtkActor *actor1 = createActorFromDataSet (line1->GetOutput(), false);
  actor1->GetProperty()->SetColor (1, 0, 0);
  ren->AddActor(actor1);
  
  // do a refresh //
  iren->Render();
  iren->Start();
  
  // second line //
  vtkLineSource *line2 = vtkLineSource::New();
  line2->SetPoint1 (0.5, 1.0, 1.5);
  line2->SetPoint2 (1.5, 1.0, 0.5);
  vtkActor *actor2 = createActorFromDataSet (line2->GetOutput(), false);
  actor2->GetProperty()->SetColor (0, 1, 0);
  ren->AddActor(actor2);
  
  // do a refresh //
  iren->Render();
  iren->Start();
  
  // suppose to delete de line //
  line1->Delete();
  actor1->Delete();
  
  // do a refresh //
  iren->Render();
  iren->Start();
  
  return 0;
}

PS : Please do not send me suggestions such as : 

" Why don't you color the line which you want to delete in black.. "

Thanks in advance !
-- 
View this message in context: http://www.nabble.com/How-to-delete-a-line---tp23501139p23501139.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list