Direction of the automatic camera
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.
CameraDirection controls the direction where
the automatically set camera is positioned.
CameraDirectionX etc. refer to the single
coordinates of this direction.
When creating a 3D scene, an “automatic camera”
is used. It is placed somewhere along the ray starting at the center
of the scene (or the center of an explicitly requested
respectively) with the direction given by
The distance to the scene is chosen automatically such that
the graphical scene or
ViewingBox fills the drawing area optimally.
CameraDirection value is a list or vector
This vector represents a direction, where the camera is found when starting at the center of the scene or viewing box. It is not the position of the camera!
The length of the
CameraDirection does not
matter, only its direction. The length should not be zero, though.
[0, 0, 1] (looking
straight down onto the x-y plane
along the z-axis)
does not yield a well defined camera view. This direction is automatically
replaced by a direction that is close to, but not exactly equal to
the z direction
and orients the scene similiar to a 2D plot.
CameraDirection attributes cannot be
The automatic camera is designed to produce a picture of the
entire scene or viewing box, filling the drawing area optimally.
the only means to control it.
If only parts of a scene shall be visible, or if the camera
is not to aim at the center of the scene, or if large perspective
distortions are desired, or if the camera position is to be animated,
one has to define one's own camera of type
plot::Camera. It can be placed at an
FocalPoint and can have an arbitrary
Further, it can be animated (allowing to realize a flight through
a 3D scene).
When such a camera object is inserted in a graphical scene,
the automatic camera is switched off and the user defined camera takes
over, automatically. It uses its own perspective parameters and ignores
We look at a function with the default direction of the automatic camera:
f := plot::Function3d(x^2 + y^3, x = 0..1, y = -1 ..1): plot(f):
We look from different directions:
S1 := plot::Scene3d(f, CameraDirection = [-3,-4, 5]): S2 := plot::Scene3d(f, CameraDirection = [ 3,-4, 5]): S3 := plot::Scene3d(f, CameraDirection = [ 3, 4, 5]): S4 := plot::Scene3d(f, CameraDirection = [-3, 4, 5]): plot(S1, S2, S3, S4)
We look straight down onto the x-y plane along the z-axis:
plot(f, CameraDirection = [0, 0, 1])
delete f, S1, S2, S3: