[vtkusers] RE: vtkusers digest, Vol 1 #1499 - Reply to message 1. small axes (Massimo Ivani)
Jean-Dominique Barnichon
jdbarnichon at amsatec.com
Fri Jan 17 04:23:16 EST 2003
Hello,
I have got exactly the same problem, and I have partly found the answer
(there is still
an unsolved question reported at the end of this mail).
Firstly I create 2 renderers :
1) "Renderer" : which is the classical renderer (on which model is
displayed)
2) "RendererAxes" : which is the renderer on which the axes will be
displayed.
// create the renderer for the axes
this->RendererAxes = vtkRenderer::New();
this->RenderWindow->AddRenderer(this->RendererAxes);
this->RendererAxes->SetViewport(0,0,0.1,0.1);
this->RendererAxes->InteractiveOff();
Note that this renderer is a portion of the drawing window through the
method SetViewport(0,0,0.1,0.1)
which is exactely what I want, and that the interactor is set inactive with
the method InteractiveOff().
Then I create the axes (code adpated from the book sample) and all the
required stuff
// create axes
vtkAxes* axes = vtkAxes::New();
axes->SetOrigin(0, 0, 0);
// put tubes around them
vtkTubeFilter* axesTubes = vtkTubeFilter::New();
axesTubes->SetInput(axes->GetOutput());
axesTubes->SetRadius(axes->GetScaleFactor()/25.0);
axesTubes->SetNumberOfSides(6);
// Create mapper for tube axes
vtkPolyDataMapper* axesMapper = vtkPolyDataMapper::New();
axesMapper->SetInput(axesTubes->GetOutput());
// create an Actor for axes
vtkActor* axesActor = vtkActor::New();
axesActor->SetMapper(axesMapper);
Then, the axesActor is added to the RendererAxes
// add axes Actor to the Renderer dedicated to Axes
m_pView->RendererAxes->AddProp(axesActor);
Finally, the camera of RendererAxes is set the same as the main Renderer in
order to show
the same rotations
m_pView->RendererAxes->SetActiveCamera(m_pView->Renderer->GetActiveCamera())
;
All this works, but the main problem is that the RendererAxes is also
affected by changes in the view
distance (i.e. zoom), which is not really intented: you would need your axes
to rotate, but not to change size.
Does anybody has an idea on how this can be done?
Thanks in advance,
Jean-Do
-------------------------------------
Jean-Dominique Barnichon
AmsaTec
24 Porte du Grand Lyon
F-01700 Neyron
E-mail : jdbarnichon at amsatec.com
-------------------------------------
Message: 1
From: "Massimo Ivani" <massimo.ivani at mlsw.com>
To: <vtkusers at public.kitware.com>
Date: Thu, 2 Jan 2003 13:31:34 +0100
Subject: [vtkusers] small axes
This is a multi-part message in MIME format.
------=_NextPart_000_0024_01C2B263.44B8BFA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello,
I would like to show a small cube or small axes (always visible) in a =
corner of vtk windows which rotates when I move camera, so user can =
better understand 3D model position. How can I do that?
Thank you
Dr. Massimo Ivani
Media Lab Software
Tel.: +39 0187 517775
Fax: +39 0187 511833
massimo.ivani at mlsw.com
www.mlsw.com <http://www.mlsw.com/>
More information about the vtkusers
mailing list