[vtkusers] Fwd: vtkInteractorStyleTerrain not compatible with vtkAxesActor/vtkOrientationMarkerWidget ?

Pof jd379252 at gmail.com
Tue May 3 04:31:55 EDT 2011


Strange that nobody else has this problem...
Did anybody from the vtk team checked the small example program given in the
com dated 03/04/2011?
Thanks for any reply

---------- Forwarded message ----------
From: pof <jd379252 at gmail.com>
Date: 2011/4/15
Subject: Re: vtkInteractorStyleTerrain not compatible with
vtkAxesActor/vtkOrientationMarkerWidget ?
To: vtkusers at vtk.org


Well,

it looks like the described bug vtkInteractorStyleTerrain did not attract
any developer.
I might give up using the vtkInteractorStyleTerrain and replace it with
vtkInteractorStyleTrackball as this problem does not occur in this one,
though the behaviour of vtkInteractorStyleTerrain much better fits my needs.

Any idea, maybe from the vtk team ?
JD

Le 03/04/2011 11:01, pof a écrit :

Dear vtker's,
No answer yet, so does it means that I'm now the only one having this
problem ?
Herebelow is a small example program that illustrate this incompatibility
between vtkInteractorStyleTerrain and
vtkAxesActor/vtkOrientationMarkerWidget.
Any idea/comment ?

////////////////
#include "vtkCylinderSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkProperty.h"
#include "vtkCamera.h"
#include "vtkAxesActor.h"
#include "vtkOrientationMarkerWidget.h"
#include "vtkInteractorStyleTerrain.h"

int main()
{
    // Creates a polygonal cylinder model with eight circumferential facets.
    vtkCylinderSource *cylinder = vtkCylinderSource::New();
    cylinder->SetResolution(20);
    cylinder->SetCenter(0,0,0.);
    cylinder->SetRadius(10.);
    cylinder->SetHeight(20.);
    vtkPolyDataMapper *cylinderMapper = vtkPolyDataMapper::New();
    cylinderMapper->SetInputConnection(cylinder->GetOutputPort());
    vtkActor *cylinderActor = vtkActor::New();
    cylinderActor->SetMapper(cylinderMapper);
    cylinderActor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784);

    vtkPolyDataMapper *MeshMapper = vtkPolyDataMapper::New();
    vtkActor *MeshActor = vtkActor::New();
    MeshMapper->SetInputConnection(cylinder->GetOutputPort());
    MeshActor->SetMapper(MeshMapper);
    (MeshActor->GetProperty())->SetInterpolationToFlat();
    (MeshActor->GetProperty())->BackfaceCullingOff();
    (MeshActor->GetProperty())->EdgeVisibilityOn();
    (MeshActor->GetProperty())->SetLineWidth(2);
    (MeshActor->GetProperty())->SetColor(0.,0.6,0.8);
    (MeshActor->GetProperty())->SetRepresentationToWireframe();

    // Create the graphics structure.
    vtkRenderer *ren = vtkRenderer::New();
    vtkRenderWindow *renWin = vtkRenderWindow::New();

    renWin->AddRenderer(ren);
    renWin->SetSize(600, 600);

    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);

    // Add the actors to the renderer, set the background and size
    ren->AddActor(cylinderActor);
    ren->AddActor(MeshActor);
    ren->SetBackground(0.1, 0.2, 0.4);

    // We'll zoom in a little by accessing the camera and invoking a "Zoom"
    // method on it.
    ren->ResetCamera();
    ren->GetActiveCamera()->Zoom(1.0);
    renWin->Render();

    vtkInteractorStyleTerrain *styleTerrain =
vtkInteractorStyleTerrain::New();
    iren->SetInteractorStyle(styleTerrain);

    vtkAxesActor *Axes = vtkAxesActor::New();
    Axes->SetShaftTypeToCylinder();
    Axes->SetXAxisLabelText( "X" );
    Axes->SetYAxisLabelText( "Y" );
    Axes->SetZAxisLabelText( "Z" );

    vtkOrientationMarkerWidget *AxesWidget =
vtkOrientationMarkerWidget::New();
    AxesWidget->SetOutlineColor(0,0,0);
    AxesWidget->SetOrientationMarker(Axes);
    AxesWidget->SetInteractor(iren);
    AxesWidget->SetViewport( 0.0, 0.0, 0.2, 0.2 );
    AxesWidget->SetEnabled(1);
    AxesWidget->InteractiveOn();

    // This starts the event loop and as a side effect causes an initial
render.
    iren->Start();

    // Exiting from here, we have to delete all the instances that
    // have been created.
    cylinder->Delete();
    cylinderMapper->Delete();
    cylinderActor->Delete();
    MeshMapper->Delete();
    MeshActor->Delete();
    ren->Delete();
    renWin->Delete();
    iren->Delete();

    return 0;
}



Le 24/03/2011 11:26, Pof a écrit :

Answering to myself, just to mention that similar problem has already been
reported in the mailing list, but I could not find any answer.

So does this means the only solution is not to use vtkInteractorStyleTerrain
with vtkOrientationMarkerWidget??

Thanks for any tip/advice
JD

2011/3/22 Pof <jd379252 at gmail.com>

> Hi all,
>
> when the vtkInteractorStyleTerrain is used with
> vtkAxesActor/vtkOrientationMarkerWidget:
> - the following error message is obtained "Resetting view-up since view
> plane normal is parallel"
> - the orientation of the vtkAxesActor gets wrong when viewing along the
> z-axis.
>
> Is there any way to correct this behaviour (apart from not displaying the
> warning message)?
>
> Thanks
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110503/7b333d19/attachment.htm>


More information about the vtkusers mailing list