This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Opening angle of the camera lense

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Value Summary

MandatoryMuPAD® expression

Graphics Primitives

ObjectsViewingAngle Default Values


ViewingAngle defines the viewing angle of a camera. It is also known as the “opening angle” of the camera's lense and is determined by its focal length.

Small viewing angles correspond to a tele lense, large opening angles to a wide angle lense. Angles close to π correspond to an (extreme) fish eye lense.

The values for ViewingAngle have to be given in radians. The angles should be larger than and smaller than π. Other values are replaced by some small positive angle or by an angle slightly less than π, respectively.

Note that when using a wide angle lense, the scene may fill only a part of the drawing area. With a tele lense, only parts of the scene may be visible.

When using a camera object with a given Position, you have to find out experimentally what viewing angle is suitable to make the scene fill a reasonable portion of the drawing area.

ViewingAngle does not have any effect when the attribute OrthogonalProjection = TRUE is set for the camera.


In fact, when a parallel projection without perspective distortion is desired, one should not position the camera far away from the scene and use an extreme tele lense (i.e, very small ViewingAngle values). This may lead to problems with the hidden line algorithm of the 3D renderer. Use OrthogonalProjection = TRUE instead.

ViewingAngle can be animated. Increasing or decreasing values of ViewingAngle correspond to “zooming out” or “zooming in”, respectively.


Example 1

When creating a camera object, the third argument is the ViewingAngle:

camera:= plot::Camera([5, 5, 5], [0, 0, 0], PI/4):

We animate ViewingAngle. With the initial value of the scene is fully visible (but rather small). Zooming in by decreasing the viewing angle, only parts of the scene are visible:

f  := plot::Function3d(sin(x^3 - y^2), x = -2..2, y = -2..2,
                       Submesh = [2, 2]):
camera:= plot::Camera([5, 5, 5], [0, 0, 0], 
                      (1 - a)*PI/3 + a*PI/10,
                      a = 0..1, Frames = 200):
plot(f, camera)

delete f, camera:
Was this topic helpful?