[vtkusers] vtkActor2D ignores SetPosition2() methods

Isidro Moreno morenoisidro at yahoo.com.ar
Wed Jun 27 00:08:40 EDT 2007


I've been trying so hard, and It seems vtkActor2D ignores SetPositon2() 
method (or vtkActor2D->GetPosition2Coordinate->SetValue(x,y) method - see 
HTML vtkActor2D help). Could somebody help me if this is what's actually 
happening?


> OK Mark, thank you very much. It's a simple issue, but It has deep 
> theoretical contents, so I'd very very grateful if not only you but also 
> someone else can help me since I'm learning VTK and don't have much 
> experience. There must be somebody who get over this easily.
>
> Thank you again!
>
>> Oh ok I see what you're trying to do. I've never done this before
>> though so I can't offer any advice. I'll give it a try sometime this
>> week if you haven't figured it out and let you know what I find,
>>
>> Mark
>>
>> On 6/26/07, Isidro Moreno <morenoisidro at yahoo.com.ar> wrote:
>>> Mark,
>>>
>>>    SetWidth() and SetHeight() methods (vtkProp's methods),define the
>>> dimensions of the rectangle in which the line is drawn (it could be not 
>>> a
>>> line, but also a circle, a polygon, etc.). In fact, that rectangle is 
>>> which
>>> I want to autoscale when window's size changes. As a result, the line 
>>> would
>>> fit to it. That's what I've understood till now. But I could be wrong...
>>>
>>> Isidro
>>>
>>>
>>> >I thought all coordinates are mapped directly to the opengl coordinate
>>> > system unless you're doing it in 'screen coordinates' of the VTK
>>> > render window - I think for example some of the caption actors use
>>> > that.
>>> >
>>> > As for the line thickness, I thought there was a different property of
>>> > the line to set (setting the actor width height won't change anything)
>>> > - something along the lines of:
>>> >
>>> >    your_line->GetProperty()->SetLineWidth(5000000);
>>> >
>>> > SetLineWidth() seems to be a method of vtkProperty.
>>> >
>>> > I haven't worked with VTK in a few months but I hope my vague memories
>>> > help a bit,
>>> >
>>> > Mark
>>> >
>>> > On 6/26/07, Isidro Moreno <morenoisidro at yahoo.com.ar> wrote:
>>> >>
>>> >>
>>> >> 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. 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!! - The same happens 
>>> >> with vtkActor2D->GetPosition2Coordinate->SetValue(double width , 
>>> >> double height)
>>> >>     actor->SetHeight(0.5);   // Doesn't work!! - The same happens 
>>> >> with vtkActor2D->GetPosition2Coordinate->SetValue(double width , 
>>> >> double height)
>>> >>
>>> >> 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!!!
>>> >> _______________________________________________
>>> >> This is the private VTK discussion list.
>>> >> Please keep messages on-topic. Check the FAQ at:
>>> >> http://www.vtk.org/Wiki/VTK_FAQ
>>> >> Follow this link to subscribe/unsubscribe:
>>> >> http://www.vtk.org/mailman/listinfo/vtkusers
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > No virus found in this incoming message.
>>> > Checked by AVG Free Edition. Version: 7.5.472 / Virus Database:
>>> > 269.9.1/857 - Release Date: 20/6/2007 14:18
>>> >
>>>
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at: 
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>
>>
>> -- 
>> No virus found in this incoming message.
>> Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 
>> 269.9.1/857 - Release Date: 20/6/2007 14:18
>>
> 




More information about the vtkusers mailing list