# VtkCamera angular ranges ranges?

**URL:** https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322
**Category:** Support
**Tags:** python
**Created:** [September 11, 2022, 4:33pm UTC](https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322 "2022-09-11T16:33:33Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![llobera](https://discourse.vtk.org/user_avatar/discourse.vtk.org/llobera/32/5540_2.png) [@llobera](https://discourse.vtk.org/u/llobera)
#### Post date: [September 11, 2022, 4:33pm UTC](https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322/1 "2022-09-11T16:33:33Z")

</div>

It appears that one can set either the vertical or horizontal visual angles of a camera. If I was to set either of these (say the horizontal visual angle range) how would I find what is the other visual range (in this case the vertical one)?

---

<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: [September 11, 2022, 10:37pm UTC](https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322/2 "2022-09-11T22:37:59Z")

</div>

Hello,

What do you mean by “angular ranges”? Do you mean camera altitude and azimuth (where it points) or the field of view angles (pan/wide/narrow view)?

regards,

Paulo

---

<div class="post-metadata">

### Author: ![llobera](https://discourse.vtk.org/user_avatar/discourse.vtk.org/llobera/32/5540_2.png) [@llobera](https://discourse.vtk.org/u/llobera)
#### Post date: [September 12, 2022, 7:33am UTC](https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322/3 "2022-09-12T07:33:42Z")

</div>

Hi Paulo,  
Here I was referring to the the field of view . So for instance, the horizontal range (115 for binocular) and 135 deg in horizontal and say 100 for the vertical range.

thanks,  
M

---

<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: [September 12, 2022, 1:40pm UTC](https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322/4 "2022-09-12T13:40:27Z")

</div>

Hello,

`vtkCamera` has the `setViewAngle(double)` method which sets the field-of-view angle (30º by default, ignored if projection is set to parallel). It is not possible to set two angles with that method. To achieve that (you’ll end up with distorted aspect ratio, I must warn you) you have to call `UseExplicitProjectionTransformMatrixOn()` and set the projection matrix manually. Please, take a look at this ([c++ - What is the difference between ProjectionTransformMatrix of VTK and GL\_PROJECTION of OpenGL? - Stack Overflow](https://stackoverflow.com/questions/26332662/what-is-the-difference-between-projectiontransformmatrix-of-vtk-and-gl-projectio)) to get started with setting projection matrices. Even though, you can’t set the vert/horiz angles directly. You have to express them as vert/horiz and horiz/vert ratios. In the figures below, you have a typical viewing frustum used in perspective projection and how the parameters relate to elements in the projection matrix further below.  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/3/38fb0e9994c27eb52f9bf774a0282324c62e9b4f.png)  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/6/66daa3ff872f68f630eaf01c5cfa8024e93ef08b.png)  
figures taken from: OpenGL “Red Book”.

take care,

Paulo

---

<div class="post-metadata">

### Author: ![llobera](https://discourse.vtk.org/user_avatar/discourse.vtk.org/llobera/32/5540_2.png) [@llobera](https://discourse.vtk.org/u/llobera)
#### Post date: [September 12, 2022, 1:54pm UTC](https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322/5 "2022-09-12T13:54:27Z")

</div>

Thank you Paulo.

Just a quick follow up. So from what you say I’d gather that by knowing any of the visual angles (whether the vertical or the horizontal) and dividing by the size (in pixels) of the window, we should be able to determine what is the angle subtended by each pixel. Correct?

---

<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: [September 12, 2022, 7:03pm UTC](https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322/6 "2022-09-12T19:03:25Z")

</div>

I’d say that your rationale is accurate for the “pixels” of our retina, which is a spherical sensor. However, that is not accurately valid when we talk about planes. If you imagine the pixels farthest from the screen center, they will cover lower angles (see figure below). But your calculation is an estimate good enough provided the field of view angle is not too large. The angular size of the pixel right in front of the camera is maximum and decreases asymptotically with the distance from the center, more or less like a Gaussian curve with a large sigma.

 ![image](https://discourse.vtk.org/uploads/default/original/2X/2/2380198d8f3b0351a3dcf175371b06c9280e6353.png)

---

<div class="post-metadata">

### Author: ![llobera](https://discourse.vtk.org/user_avatar/discourse.vtk.org/llobera/32/5540_2.png) [@llobera](https://discourse.vtk.org/u/llobera)
#### Post date: [September 13, 2022, 8:07am UTC](https://discourse.vtk.org/t/vtkcamera-angular-ranges-ranges/9322/7 "2022-09-13T08:07:58Z")

</div>

Thank you Paulo! Indeed, my thinking was based on a previous model I had worked on which used a spherical projection. Thanks for the clarification!
