# How to use vtkMRMLCameraNode RotateAround and RotateTo?

**URL:** <https://discourse.slicer.org/t/how-to-use-vtkmrmlcameranode-rotatearound-and-rotateto/9711>\
**Category:** Support\
**Created:** [January 5, 2020, 3:34pm UTC](https://discourse.slicer.org/t/how-to-use-vtkmrmlcameranode-rotatearound-and-rotateto/9711 "2020-01-05T15:34:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![apparrilla](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/apparrilla/32/9230_2.png) [@apparrilla](https://discourse.slicer.org/u/apparrilla)\
**Post date:** [January 5, 2020, 3:34pm UTC](https://discourse.slicer.org/t/how-to-use-vtkmrmlcameranode-rotatearound-and-rotateto/9711/1 "2020-01-05T15:34:16Z")

</div>

I´ve been trying to manage camera rotation around a focal point but I can´t find the right parameter to send.

RotateAround needs RASAxis and bool or angle. I have test without succes

> camera = slicer.mrmlScene.GetNodeByID(‘vtkMRMLCameraNode1’)  
> camera.RotateAround(‘R’,20)

and

> camera = slicer.mrmlScene.GetNodeByID(‘vtkMRMLCameraNode1’)  
> camera.RotateAround(0,20)

> TypeError: ambiguous call, multiple overloaded methods match the arguments

Same problem as with “RotateTo”

I´ve found enums for parameters but I don´t know how to use them:

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/6/f6d06e52f86de236c91fa196432b7a17f8616a1a.png)

Thanks on advance!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 5, 2020, 6:59pm UTC](https://discourse.slicer.org/t/how-to-use-vtkmrmlcameranode-rotatearound-and-rotateto/9711/2 "2020-01-05T18:59:51Z")

</div>

Camera always rotates around the camera’s focal point. If you want to rotate around a different point then probably the easiest is to compute the new camera position, focal point, and ViewUp vector and set them in the camera.

---

<div class="post-metadata">

**Author:** ![apparrilla](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/apparrilla/32/9230_2.png) [@apparrilla](https://discourse.slicer.org/u/apparrilla)\
**Post date:** [January 5, 2020, 7:24pm UTC](https://discourse.slicer.org/t/how-to-use-vtkmrmlcameranode-rotatearound-and-rotateto/9711/3 "2020-01-05T19:24:04Z")

</div>

I’m looking for exactly this camera behavior by I can’t make it work from those methods. I’m sure I’m doing something wrong with syntaxis…

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 5, 2020, 8:22pm UTC](https://discourse.slicer.org/t/how-to-use-vtkmrmlcameranode-rotatearound-and-rotateto/9711/4 "2020-01-05T20:22:26Z")

</div>

Which behavior you are referring to? What would you like to achieve?

VTK’s built-in camera rotation methods can only rotate around the focal point, which is the position the camera looks at (in the center of the field of view).

---

<div class="post-metadata">

**Author:** ![apparrilla](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/apparrilla/32/9230_2.png) [@apparrilla](https://discourse.slicer.org/u/apparrilla)\
**Post date:** [January 5, 2020, 8:45pm UTC](https://discourse.slicer.org/t/how-to-use-vtkmrmlcameranode-rotatearound-and-rotateto/9711/5 "2020-01-05T20:45:17Z")

</div>

I want to look at something (fiducial point for example) from any position and rotate camera 180º in all axes to see it from de opposite side.

Something like:

> def LookAtFiducial(self, currentFid):  
> position = [0,0,0]  
> self.fiducial = self.fiducialNode()  
> self.fiducial.GetNthFiducialPosition(currentFid,position)  
> camera = slicer.mrmlScene.GetNodeByID(‘vtkMRMLCameraNode1’)  
> camera.SetFocalPoint(\*position)  
> camera.SetPosition(position[0]+100,position[1]-200,position[2]+50)

> def RotateOpposite(self)  
> camera = slicer.mrmlScene.GetNodeByID(‘vtkMRMLCameraNode1’)  
> camera.RotateAround(‘R’,180) / camera.RotateTo(position[0]-100,position[1]+200,position[2]-50)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 5, 2020, 10:01pm UTC](https://discourse.slicer.org/t/how-to-use-vtkmrmlcameranode-rotatearound-and-rotateto/9711/6 "2020-01-05T22:01:53Z")

</div>

To look at a point from the other side, mirror the camera position on the focal point position (cp\_new = cp\_old + 2 \* (fp-cp\_old)).
