[vtkusers] 2DAxisActor
Louis Desjardins
lost_bits1110 at hotmail.com
Wed May 19 10:08:48 EDT 2004
Thanks Cedric for your response,
Does this mean that people do not use vtkAxisActor2D?
Then how do I get ticks and labels on my axes?
Thanks again,
Louis
>
>
>Hi Louis,
>
>It is perhaps not the answer that you need but it can help you, for a 3D
>axis :
>
>//ORIGIN AXES
>vtkAxes *axes = vtkAxes::New();
> axes->SetOrigin(0,0,0);
> axes->SetScaleFactor(50);
>
>vtkPolyDataMapper *axesMapper = vtkPolyDataMapper::New();
> axesMapper->SetInput(axes->GetOutput());
>
>vtkProperty *propline = vtkProperty::New();
> propline->SetColor(1,0,0);
>
>//Actor Origin
> vtkActor *axesActor = vtkActor::New();;
> axesActor->SetMapper(axesMapper);
> axesActor->SetProperty(propline);
>
>// the renderers and the render window
>vtkRenderer *ren1 = vtkRenderer::New();
>
>vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(ren1);
> renWin->SetSize(1200,500); //size o f the window
>
>// an interactor
>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
>
>ren1->AddActor(axesActor);
>ren1->SetBackground(1,1,1); // Background color white
>ren1->SetViewport(0,0,0.5,1);
>
>renWin->Render();
>
>// begin mouse interaction
>iren->Start();
>
>
>//////////////////////////////////////////////////////////////////
>If you want to create just a line :
>
>//LINE
> vtkLineSource *line = vtkLineSource::New();
> line->SetPoint1(15,-5,32);
> line->SetPoint2(15,50,32);
> line->SetResolution(30);
>
> vtkTubeFilter *tuber = vtkTubeFilter::New();
> tuber->SetInput(line->GetOutput());
> tuber->SetRadius(0.5);
>
> vtkPolyDataMapper *lineMapper = vtkPolyDataMapper::New();
> lineMapper->SetInput(tuber->GetOutput());
>
> vtkProperty *propline = vtkProperty::New();
> propline->SetColor(1,0,0);
>
>vtkActor *lineActor = vtkActor::New();;
> lineActor->SetMapper(lineMapper);
>
> // a renderer and render window
> vtkRenderer *ren1 = vtkRenderer::New();
>
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(ren1);
>
> // an interactor
> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
>
> // add the actor to the scene
> ren1->AddActor(lineActor);
> ren1->SetBackground(1,1,1); // Background color white
>
> // render an image (lights and cameras are created automatically)
> renWin->Render();
>
> // begin mouse interaction
> iren->Start();
>
>Regards,
>
>
>
>Cédric,
>
>Dr, Phd,
>Marie Curie Fellow, post doctorate
>Agfa Gevaert, RDM/Physics & Analytics
>+ 32 (0) 3 444 3077,
>cedric.marchessoux at agfa.com
>http://www.marchessoux.com
>
>
>|---------+---------------------------->
>| | "Louis |
>| | Desjardins" |
>| | <lost_bits1110 at ho|
>| | tmail.com> |
>| | Sent by: |
>| | vtkusers-admin at vt|
>| | k.org |
>| | |
>| | |
>| | 18/05/2004 23:24 |
>| | |
>|---------+---------------------------->
>
> >------------------------------------------------------------------------------------------------------------------------------|
> |
> |
> | To: vtkusers at vtk.org
> |
> | cc:
> |
> | Subject: [vtkusers] 2DAxisActor
> |
>
> >------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>
>Hi vtkusers
>i just want to display an xy axis on my screen so i have an object of
>vtk2DAxisActor :
>
> XYAxisActor->SetPoint1(10, 100);
> XYAxisActor->SetPoint2(10, 100);
> XYAxisActor->SetRange(5, 40);
> XYAxisActor->AxisVisibilityOn();
> XYAxisActor->TickVisibilityOn();
> XYAxisActor->LabelVisibilityOn();
> XYAxisActor->RenderOverlay( Ren1 );
>
>and then I add this actor to my Renderer but nothign appears?
>Do you see anything wrong with the above code?
>Thanks
>
>_________________________________________________________________
>
_________________________________________________________________
Best Restaurant Giveaway Ever! Vote for your favorites for a chance to win
$1 million! http://local.msn.com/special/giveaway.asp
More information about the vtkusers
mailing list