To render the real size of actor without zooming

I am rendering circles in the position of the mouse. My surprise is if I zoom in the scene and I add a circle they become larger than the original one. If it has a radius of three I would like to see the circle of radius 3. Someone knows how to keep the original size of the circle?


Hello, Ester,

I need to do a similar rescaling to the vtkActor of the pick marker (a small red sphere) of my scene. The effect is that the pick marker keeps with the same screen size independently of zoom applied. This may help you out:

void myInteractorStyleTrackballCamera::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() );


The method above must be called when a zoom is triggered, for example, in the OnMouseWheelForward() and OnMouseWheelBackward() of your vtkInteractorStyleTrackballCamera implementation. Where exactly depends on how interactivity is handled in your code.

The complete implementation is here: gammaray/v3dmouseinteractor.h at master · PauloCarvalhoRJ/gammaray · GitHub / gammaray/v3dmouseinteractor.cpp at master · PauloCarvalhoRJ/gammaray · GitHub.

I hope this helps,


Thank you very much !! I will try it.By now I had solved it by using a vtkActor2D because it was not required to be 3d and I changed the actor from sphere to circle. But I will try it using your idea with an sphere. Thanks !!

1 Like


Hmmm… it seems that vtkActor2D maybe more elegant if you don’t actually need a 3D shape.

Thanks for your idea too.