[vtkusers] vtkCoordinate and a simple test program

Isidro Moreno morenoisidro at yahoo.com.ar
Mon Jun 25 12:30:54 EDT 2007


Hello! I've made a simple VTK/C++ test program. It's just a 2D line. Now, I don't know how to make the line size change since I've tried many methods; and changing vtkActor's coordinate system (vtkActor2D's), but no results. I even wonder what coordinate system is vtkLineSource defined in (see code below).

Here's my code:

vtkLineSource *line=vtkLineSource::New();
    line->SetPoint1(20.0,20.0,0.0);    // what Coordinate System??
    line->SetPoint2(80.0,150.0,0.0);  // what Coordinate System??

vtkPolyDataMapper2D *mapper=vtkPolyDataMapper2D::New();
    mapper->SetInput(line->GetOutput());

vtkActor2D *actor=vtkActor2D::New();
    actor->SetMapper(mapper);
    actor->GetProperty()->SetColor(1.0,0.0,0.0);
    actor->SetWidth(0.5);    // Doesn't work!!
    actor->SetHeight(0.5);   // Doesn't work!!

vtkRenderer *render=vtkRenderer::New();
vtkRenderWindow *win=vtkRenderWindow::New();
    win->AddRenderer(render);

vtkRenderWindowInteractor *interac=vtkRenderWindowInteractor::New();
    interac->SetRenderWindow(win);

    render->AddActor2D(actor);
    render->SetBackground(0.1,0.2,0.4);

    win->Render();

    interac->Initialize();
    interac->Start();

line->Delete();
mapper->Delete();
actor->Delete();
render->Delete();
win->Delete();
interac->Delete();

I want to make the line resize when changing windows size. I'd be very grateful if somebody could help me with this. Thanks!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070625/10c928a5/attachment.htm>


More information about the vtkusers mailing list