This functionality does not run in MATLAB.
plot::Camera([px, py, pz], [fx, fy, fz], angle, <a = amin .. amax>, options)
plot::Camera([px, py, pz], [fx, fy, fz], angle) creates a camera at the position [px, py, pz] pointing towards the focal point [fx, fy, fz]. The opening angle of its lense is given by angle.
When creating a 3D scene, an "automatic camera" is used. Its location can be controlled by the attribute CameraDirection, but there are now further means of manipulating its parameters.
If the automatic camera does not suffice for your purposes, you may define your own camera by plot::Camera. Inserting such a camera object in your scene (for example, just by passing the camera as an argument to the plot command), the automatic camera is switched off and the new camera determines the view.
A camera of type plot::Camera allows to set all parameters determining the view and its perspective. Further, all parameters can be animated such that an animated "flight" through a 3D scene can be realized.
The optical axis is given by the vector FocalPoint - Position.
Together with the opening angle of the zoom lense (ViewingAngle), these parameters determine the view of the scene.
The FocalPoint vector can be replaced by any other point on the optical axes without changing the view. (FocalPoint and Position should not coincide, though.)
By default, the z-direction in 3-space corresponds to the vertical direction of the final picture. If this is not desired, the camera can be rotated around its optical axes using the attribute UpVector.
Depending on the distance of the camera to the graphical scene and the opening angle of the lense, the scene may fill only a small portion of the viewing area if the camera is too far away. If the camera is too close, only some parts of the scene may be visible
Just as for a real camera, you will have to move closer to or farther away from the scene to make it fill the drawing area as desired. Alternatively, you may keep the camera position fixed and use the zoom lense by choosing an appropriate ViewingAngle.
As in real life, you have to find appropriate parameters experimentally by looking at the picture and changing the parameters interactively.
Alternatively, you may define the camera with the attribute OrthogonalProjection = TRUE. This has the same effect as positioning the camera at a large distance from the scene using a powerful tele lense.
In this case, the camera ignores the ViewingAngle and the Position in 3-space. It is moved along the optical axis FocalPoint - Position to infinity and chooses an infinitesimal small viewing angle such that the scene fills the drawing area optimally.
Several cameras can be present simultaneously in a graphical scene. The first camera specified in the plot command determines the views.
One may switch between the cameras by clicking on the corresponding camera in the interactive "object browser" of the MuPAD® graphics tool (see section Viewer, Browser, and Inspector: Interactive Manipulation of this document).
You may place your own light sources in the scene. When specifying the attribute CameraCoordinates = TRUE in the definition of the lights, they are attached to the camera and move automatically, when the camera is moved.
|FocalPoint||the focal point of a camera|
|FocalPointX||the focal point of a camera, x-coordinate|
|FocalPointY||the focal point of a camera, y-coordinate|
|FocalPointZ||the focal point of a camera, z-coordinate|
|Frames||the number of frames in an animation||50|
|KeepUpVector||keep the UpVector constant when moving the camera?||TRUE|
|Name||the name of a plot object (for browser and legend)|
|OrthogonalProjection||parallel projection without perspective distortion||FALSE|
|ParameterEnd||end value of the animation parameter|
|ParameterName||name of the animation parameter|
|ParameterBegin||initial value of the animation parameter|
|ParameterRange||range of the animation parameter|
|Position||positions of cameras, lights, and text objects|
|PositionX||x-positions of cameras, lights, and text objects|
|PositionY||y-positions of cameras, lights, and text objects|
|PositionZ||z-positions of cameras, lights, and text objects|
|TimeEnd||end time of the animation||10.0|
|TimeBegin||start time of the animation||0.0|
|TimeRange||the real time span of an animation||0.0 .. 10.0|
|UpVector||"up direction" of a camera||[0.0, 0.0, 1.0]|
|UpVectorX||x-component of the "up vector" of the camera||0.0|
|UpVectorY||y-component of the "up vector" of the camera||0.0|
|UpVectorZ||z-component of the "up vector" of the camera||1.0|
|ViewingAngle||opening angle of the camera lense|
We use our own camera to view the 3D graph of a function:
f := plot::Function3d(sin(x) + y^3 + 2*exp(-3*x^2 - 20*y^2), x = -PI..PI, y = -1 .. 1, Submesh = [2, 2]): camera := plot::Camera([-12, -4, 14], [0, 0, 0], PI/7): plot(f, camera):
We move the camera to another position:
camera::Position := [7, -5, 6]: plot(f, camera):
We turn the camera towards the central peak and zoom in by decreasing the openening angle of the zoom lense:
camera::FocalPoint := [0, 0, 1]: camera::ViewingAngle := PI/20: plot(f, camera):
We create an animated camera and fly through the scene:
camera := plot::Camera([-15 + 3*a, 4 - a, 3 + (a - 4)^2], [0, 0, 1.5], PI/6, a = 0..8, Frames = 100, TimeRange = 0..20): plot(f, camera):
delete f, camera:
px, py, pz
Coordinates of the camera position: numerical real values or arithmetical expressions of the animation parameter a.
fx, fy, fz
Coordinates of the the focal point: numerical real values or arithmetical expressions of the animation parameter a.
The opening angle of the lense in radians: a numerical real value or an arithmetical expression of the animation parameter a representing a value between 0 and π.
angle is equivalent to the attribute ViewingAngle.
Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.