# To render the real size of actor without zooming

**URL:** https://discourse.vtk.org/t/to-render-the-real-size-of-actor-without-zooming/5385
**Category:** Support
**Created:** [March 15, 2021, 8:59am UTC](https://discourse.vtk.org/t/to-render-the-real-size-of-actor-without-zooming/5385 "2021-03-15T08:59:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [March 15, 2021, 8:59am UTC](https://discourse.vtk.org/t/to-render-the-real-size-of-actor-without-zooming/5385/1 "2021-03-15T08:59:28Z")

</div>

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?

Thanks

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [March 16, 2021, 2:55pm UTC](https://discourse.vtk.org/t/to-render-the-real-size-of-actor-without-zooming/5385/2 "2021-03-16T14:55:50Z")

</div>

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:

```cpp
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,
                                     newScale / m_ParentView3DWidget->getVerticalExaggeration() );

        this->GetDefaultRenderer()->Render();
    }
}

```

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](https://github.com/PauloCarvalhoRJ/gammaray/blob/master/viewer3d/v3dmouseinteractor.h) / [gammaray/v3dmouseinteractor.cpp at master · PauloCarvalhoRJ/gammaray · GitHub](https://github.com/PauloCarvalhoRJ/gammaray/blob/master/viewer3d/v3dmouseinteractor.cpp).

I hope this helps,

Paulo

---

<div class="post-metadata">

### Author: ![zandarina](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/z/4af34b/32.png) [@zandarina](https://discourse.vtk.org/u/zandarina)
#### Post date: [May 4, 2021, 8:47am UTC](https://discourse.vtk.org/t/to-render-the-real-size-of-actor-without-zooming/5385/3 "2021-05-04T08:47:17Z")

</div>

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 !!

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [May 4, 2021, 1:39pm UTC](https://discourse.vtk.org/t/to-render-the-real-size-of-actor-without-zooming/5385/4 "2021-05-04T13:39:57Z")

</div>

Hi,

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

Thanks for your idea too.

cheers,

Paulo
