[vtkusers] 3D axis that follows main actor

Jim Peterson jimcp at cox.net
Thu Sep 9 20:06:43 EDT 2010


I  tried this in Java and found that I get a segmentation fault if I add 
the use the vtkOrientationMarkerWidget SetInteractor(iren) before 
associating the renderWindowInteractor to the renderWindow. If I have 
set the renderWindowInteractor to the renderWindow the orientation 
widget works that is, this sequence displays the scene:

    rw.AddRenderer(ren1);
    rw.SetInteractor(iren);
 
    oAxes = new vtkAxesActor();
    oWidget = new vtkOrientationMarkerWidget();
  oWidget.SetOutlineColor( 0.9300, 0.5700, 0.1300 );
  oWidget.SetOrientationMarker( oAxes );
  oWidget.SetInteractor( iren );
  oWidget.SetViewport( 0.0, 0.0, 0.2, 0.2 );
  oWidget.SetEnabled( 1 );

This one gets a segment fault:

    rw.AddRenderer(ren1);

    oAxes = new vtkAxesActor();
    oWidget = new vtkOrientationMarkerWidget();
  oWidget.SetOutlineColor( 0.9300, 0.5700, 0.1300 );
  oWidget.SetOrientationMarker( oAxes );
  oWidget.SetInteractor( iren );
  oWidget.SetViewport( 0.0, 0.0, 0.2, 0.2 );
  oWidget.SetEnabled( 1 );

    rw.SetInteractor(iren);
 
The one curiousity is after adding the orientation widget, I needed to 
add ResetCamera() to the renderer before  calling Start() for the 
interactor to get the full scene to render.

I am not sure whether the order of creation dependency is a bug or not 
with the orientation widget.

Rodrigo Valiña Gutiérrez wrote:
> On Thu, Sep 9, 2010 at 2:22 PM, Bill Lorensen <bill.lorensen at gmail.com 
> <mailto:bill.lorensen at gmail.com>> wrote:
>
>     Try this:
>     http://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/DisplayCoordinateAxes#AxesIndicator.cxx
>     or for a more sophisticated "axes", this:
>     http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/OrientationMarkerWidget
>
>
> Thanks, I think that it should do, but it keeps giving me Segmentation 
> Fault...
>
> With Python 2.6.5, VTK 5.2.1-14ubuntu4, and Ubuntu 10.04, and this code:
>
> axes = vtk.vtkAxesActor()
> vomw = vtk.vtkOrientationMarkerWidget()
> vomw.SetOutlineColor( 0.9300, 0.5700, 0.1300 )
> vomw.SetOrientationMarker( axes )
> #vomw.SetDefaultRenderer( self.ren )
> vomw.SetInteractor( self.iren )
> vomw.SetViewport( 0.0, 0.0, 0.4, 0.4 )
> vomw.SetEnabled( 1 )
> vomw.InteractiveOn( )
>
> It crashes:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0530497d in vtkRenderer::GetActiveCamera() () from 
> /usr/lib/libvtkRendering.so.5.2
> (gdb) bt
> #0  0x0530497d in vtkRenderer::GetActiveCamera() () from 
> /usr/lib/libvtkRendering.so.5.2
> #1  0x07b3f05a in 
> vtkOrientationMarkerWidget::ExecuteCameraUpdateEvent(vtkObject*, 
> unsigned long, void*) ()
>    from /usr/lib/libvtkWidgets.so.5.2
> #2  0x07b40499 in 
> vtkOrientationMarkerWidgetObserver::Execute(vtkObject*, unsigned long, 
> void*) ()
>    from /usr/lib/libvtkWidgets.so.5.2
> #3  0x0264f922 in vtkSubjectHelper::InvokeEvent(unsigned long, void*, 
> vtkObject*) () from /usr/lib/libvtkCommon.so.5.2
> #4  0x0264f9d8 in vtkObject::InvokeEvent(unsigned long, void*) () from 
> /usr/lib/libvtkCommon.so.5.2
> #5  0x05306f80 in vtkRenderer::Render() () from 
> /usr/lib/libvtkRendering.so.5.2
> #6  0x053032bb in vtkRendererCollection::Render() () from 
> /usr/lib/libvtkRendering.so.5.2
> #7  0x0531352f in vtkRenderWindow::DoStereoRender() () from 
> /usr/lib/libvtkRendering.so.5.2
> #8  0x05313910 in vtkRenderWindow::DoFDRender() () from 
> /usr/lib/libvtkRendering.so.5.2
> #9  0x05314d1c in vtkRenderWindow::DoAARender() () from 
> /usr/lib/libvtkRendering.so.5.2
> #10 0x05313a55 in vtkRenderWindow::Render() () from 
> /usr/lib/libvtkRendering.so.5.2
> #11 0x053b64b4 in vtkXOpenGLRenderWindow::Render() () from 
> /usr/lib/libvtkRendering.so.5.2
> #12 0x050a2635 in ?? () from /usr/lib/libvtkRenderingPythonD.so.5.2
> #13 0x080e0a21 in PyEval_EvalFrameEx ()
> #14 0x080e1bb0 in PyEval_EvalFrameEx ()
> #15 0x080e2807 in PyEval_EvalCodeEx ()
> #16 0x0816b2ac in ?? ()
> #17 0x0806245a in PyObject_Call ()
> #18 0x0806a45c in ?? ()
> #19 0x0806245a in PyObject_Call ()
> #20 0x080db892 in PyEval_CallObjectWithKeywords ()
> ---Type <return> to continue, or q <return> to quit---
> #21 0x004a2c1e in wxPyCallback::EventThunker(wxEvent&) () from 
> /usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so
> #22 0x00d0ca9f in wxAppConsole::HandleEvent(wxEvtHandler*, void 
> (wxEvtHandler::*)(wxEvent&), wxEvent&) const ()
>    from /usr/lib/libwx_baseu-2.8.so.0
> #23 0x00dab209 in 
> wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, 
> wxEvtHandler*, wxEvent&) ()
>    from /usr/lib/libwx_baseu-2.8.so.0
> #24 0x00dab398 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () 
> from /usr/lib/libwx_baseu-2.8.so.0
> #25 0x00dac3a5 in wxEvtHandler::ProcessEvent(wxEvent&) () from 
> /usr/lib/libwx_baseu-2.8.so.0
> #26 0x07ea42a2 in wxGLCanvas::OnInternalIdle() () from 
> /usr/lib/libwx_gtk2u_gl-2.8.so.0
> #27 0x00afa415 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) 
> () from /usr/lib/libwx_gtk2u_core-2.8.so.0
> #28 0x00afa449 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) 
> () from /usr/lib/libwx_gtk2u_core-2.8.so.0
> #29 0x00afa449 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) 
> () from /usr/lib/libwx_gtk2u_core-2.8.so.0
> #30 0x00afa449 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) 
> () from /usr/lib/libwx_gtk2u_core-2.8.so.0
> #31 0x00afa449 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) 
> () from /usr/lib/libwx_gtk2u_core-2.8.so.0
> #32 0x00afa449 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) 
> () from /usr/lib/libwx_gtk2u_core-2.8.so.0
> #33 0x00afa449 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) 
> () from /usr/lib/libwx_gtk2u_core-2.8.so.0
> #34 0x00afa6c1 in wxAppBase::ProcessIdle() () from 
> /usr/lib/libwx_gtk2u_core-2.8.so.0
> #35 0x00a4e2c3 in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
> #36 0x01604661 in ?? () from /lib/libglib-2.0.so.0
> #37 0x016065e5 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
> #38 0x0160a2d8 in ?? () from /lib/libglib-2.0.so.0
> #39 0x0160a817 in g_main_loop_run () from /lib/libglib-2.0.so.0
> #40 0x010603c9 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
> #41 0x00a67708 in wxEventLoop::Run() () from 
> /usr/lib/libwx_gtk2u_core-2.8.so.0
> ---Type <return> to continue, or q <return> to quit---
> #42 0x00afa4de in wxAppBase::MainLoop() () from 
> /usr/lib/libwx_gtk2u_core-2.8.so.0
> #43 0x004a0b92 in wxPyApp::MainLoop() () from 
> /usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so
> #44 0x005139da in ?? () from 
> /usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core_.so
> #45 0x080e0f4d in PyEval_EvalFrameEx ()
> #46 0x080e2807 in PyEval_EvalCodeEx ()
> #47 0x0816b2ac in ?? ()
> #48 0x0806245a in PyObject_Call ()
> #49 0x0806a45c in ?? ()
> #50 0x0806245a in PyObject_Call ()
> #51 0x080e0471 in PyEval_EvalFrameEx ()
> #52 0x080e1bb0 in PyEval_EvalFrameEx ()
> #53 0x080e1bb0 in PyEval_EvalFrameEx ()
> #54 0x080e2807 in PyEval_EvalCodeEx ()
> #55 0x080e2907 in PyEval_EvalCode ()
> #56 0x081005ad in PyRun_FileExFlags ()
> #57 0x08100812 in PyRun_SimpleFileExFlags ()
> #58 0x0805de5c in Py_Main ()
> #59 0x0805d03b in main ()
>
> --------
>
>
>     On Thu, Sep 9, 2010 at 7:56 AM, Rodrigo Valiña Gutiérrez
>     <rodrigo.valina at usc.es <mailto:rodrigo.valina at usc.es>> wrote:
>     > On Thu, Sep 9, 2010 at 11:45 AM, David Doria
>     <daviddoria+vtk at gmail.com <mailto:daviddoria%2Bvtk at gmail.com>>
>     > wrote:
>     >>
>     >> On Thu, Sep 9, 2010 at 4:44 AM, Rodrigo Valiña Gutiérrez
>     >> <rodrigo.valina at usc.es <mailto:rodrigo.valina at usc.es>> wrote:
>     >> > Hi,
>     >> >
>     >> > I want an actor or a way to draw an object composed of 3
>     arrows for X Y
>     >> > and
>     >> > Z axes, in the lower left corner of the window, and orients
>     itself
>     >> > acording
>     >> > to the rotation of the camera. I do not want it to zoom or
>     displace. It
>     >> > should be like the one ParaView has in the lower left corner.
>     >> >
>     >> > Is there any simple way to do it?
>     >> >
>     >> > --
>     >> > Rodrigo
>     >>
>     >> This should do the trick;
>     >>
>     >> http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Axes
>     >>
>     >> David
>     >
>     > It does not work for me.
>     > The code in the link places the object in world coordinates, and
>     the object
>     > moves and zooms with the rest of the scene.
>     > I wanted an object that was fixed-size and fixed-position (lower
>     left corner
>     > of the visualization), and only oriented itself like the other
>     objects in
>     > the scene.
>     >
>     > --
>     > Rodrigo
>     >
>     > _______________________________________________
>     > Powered by www.kitware.com <http://www.kitware.com>
>     >
>     > Visit other Kitware open-source projects at
>     > http://www.kitware.com/opensource/opensource.html
>     >
>     > Please keep messages on-topic and check the VTK FAQ at:
>     > http://www.vtk.org/Wiki/VTK_FAQ
>     >
>     > Follow this link to subscribe/unsubscribe:
>     > http://www.vtk.org/mailman/listinfo/vtkusers
>     >
>     >
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   




More information about the vtkusers mailing list