How to listen zoom event to to keep a fixed ratio of axises_length/window_width?

I have put an vtkAxesActor in the centor of window,if putting a big object or zoom out too much,this actor will become tiny.Any way to keep a fixed ratio of axis_length/window_width?I want to listen to zoom event,but can’t find out how to

Hi, Alex,

I also had a problem similar to yours. In my case, I have a small sphere that serves as a pick marker that must appear with the same size with respect to the screen regardless of zoom or vertical exaggeration applied by the user. I had to subclass vtkInteractorStyleTrackballCamera which interprets the user’s gestures (including those to perform zoom): gammaray/v3dmouseinteractor.h at master · PauloCarvalhoRJ/gammaray · GitHub . Then I had to add a call to:

void v3dMouseInteractor::rescalePickMarkerActor()
    double cameraFocalPoint[3], cameraPosition[3];
    double objectPosition[3];
    double newScale = 0;
    double totalSquared = 0;

    if( ! m_vtkMathObj )
        m_vtkMathObj = vtkSmartPointer<vtkMath>::New();

    // Keeping the pick marker actor
    // the same size relative to the viewport. This is done by
    // changing the scale of the object to be proportional to
    // the distance between the current camera and the object.
    if( m_pickMarkerActor ){
        // Get a pointer to the current camera according to the main renderer.
        vtkCamera *currentCamera = static_cast<vtkCamera *>( this->GetDefaultRenderer()->GetActiveCamera() );
        currentCamera->GetPosition( cameraPosition );
        currentCamera->GetFocalPoint( cameraFocalPoint );
        m_pickMarkerActor->GetPosition( objectPosition );

        totalSquared = std::sqrt(m_vtkMathObj->Distance2BetweenPoints( objectPosition, cameraPosition ));
        newScale = totalSquared / 20000;    // The denominator value is an abitary number that gives the desired size of the objects on screen.
        Application::instance()->logInfo( "Distance to picked location: " + QString::number(totalSquared) );
        m_pickMarkerActor->SetScale( newScale,
                                     newScale / m_ParentView3DWidget->getVerticalExaggeration() );


in all events associated with zooming to rescale the pick marker actor accordingly.

I hope this helps,