plot3d/viewpoint
create an animation by varying the viewpoint through a 3-D plot
Calling Sequence
Parameters
The viewpoint Option
The Named Form
The Location Form
The Path Form
Suboptions
Notes
plot3d(..., viewpoint=vpname);
plot3d(..., viewpoint=[vpname, subopts1]);
plot3d(..., viewpoint=[location=locpts, subopts2]);
plot3d(..., viewpoint=[path=pathpts, subopts2]);
vpname
-
name or string describing a standard viewpoint path
locpts
Matrix or list of location points
pathpts
Matrix or list specifying a camera path
subopts1
(optional) the frames option
subopts2
(optional) one or more of the look, upvector, frames or fieldofview options
The viewpoint option allows you to create an animation by varying the viewpoint through a 3-D plot, as if a camera were flying through the plot. The position, direction, and orientation of the camera can all be varied, along with the field of view.
There are three ways in which the viewpoint can be specified. With the named form, one of several standard paths can be chosen. The location form requires a camera location for each frame of the resulting animation. The path form uses either a parametrically defined path or a spline computed from a given set of points.
Although the calling sequences above show the plot3d command as an example, the viewpoint option is available with most 3-D plotting commands in Maple.
Note: To play an animation in this help page, right-click (Control-click, on Macintosh) the plot to display the context menu. Select Animation > Play.
The first two calling sequences allow you to request one of four standard viewpoint paths. Allowable names are circleleft, circleright, halfcircleleft and halfcircleright, and the names may also be provided as strings. These paths move the camera in a circle or half-circle around the plot, while looking at the center of the plot.
plot3d(sin(x+y), x=-5..5, y=-5..5, viewpoint="circleleft");
Use the first calling sequence if you do not wish to add suboptions. Use the second calling sequence if you wish to use the frames option to specify the number of frames in the animation. The frames option is the only suboption allowed with the named viewpoint form. If it is not given, a default number is used.
plot3d(sin(x+y), x=-5..5, y=-5..5, viewpoint=["circleleft", frames=20]);
With the named form, the projection and orientation options are respected, and both may be modified interactively. The default orientation for these animations is the same as the default orientation for the initial 3-D plot from which the animation is generated. The distance of the camera from the plot is specified by the projection option.
plot3d(sin(x+y), x=-5..5, y=-5..5, orientation=[0,90], projection=0.7, axes=boxed, viewpoint="circleright");
The third calling sequence requires the use of the location option as described in the Suboptions section below. Points specifying the location of the camera for each frame are given as a Matrix or a list.
Additionally, the look option may be used to control the center of the viewport, and the upvector option may be used to control the vertical direction of the camera.
Any of location, look, or upvector may be given as a single point or vector, in which case that position or vector applies to all frames. Additionally, the look option accepts the value forward, which means that the camera is looking at the next point on the path.
If no look value is specified then the camera looks at a point in the center of the plot. If no upvector is specified then the camera upvector is set to [0,1,0]. If the vector joining the camera's position to its look point is parallel to the upvector in any frame then nothing will be drawn in that frame.
The number of points given by the location option value determines the number of frames, with one exception. If the location option consists of a single point, it is expected that the look or upvector option will contain multiple points in order to create an animation. If that is the case, the number of points in those other options will determine the number of frames. If the frames option is provided, the value must match the number of frames implied by the number of points.
The fieldofview option may also be used with the location form.
plot3d(sin(x+y), x=-10..10, y=-10..10, axes=boxed, projection=.7, viewpoint=[location=[[0, 0, 500],[4750*sin((1/10)*Pi),0,475*cos((1/10)*Pi)], [4500*sin((2/10)*Pi),0,450*cos((2/10)*Pi)],[4250*sin((3/10)*Pi),0, 425*cos((3/10)*Pi)],[4000*sin((4/10)*Pi),0,400*cos((4/10)*Pi)], [3750*sin((5/10)*Pi),0,375*cos((5/10)*Pi)],[3500*sin((6/10)*Pi),0, 350*cos((6/10)*Pi)],[3250*sin((7/10)*Pi),0,325*cos((7/10)*Pi)], [3000*sin((8/10)*Pi),0,300*cos((8/10)*Pi)],[2750*sin((9/10)*Pi),0, 275*cos((10/10)*Pi)],[2500*sin((10/10)*Pi),0,250*cos((10/10)*Pi)]], look = [0,0,0], upvector = [0,1,0], fieldofview = 2]);
The fourth calling sequence requires the use of the path option as described in the Suboptions section below. The path may be specified in one of two ways: as a list of expressions in a single parameter, or as a set of points through which a spline curve is fitted.
In the first form, the path is given as a list [[x(t), y(t), z(t)], t=a..b], where x(t), y(t) and z(t) are expressions in the name t. The expressions are evaluated at equally spaced values of the parameter t from a to b, and each evaluated point corresponds to the camera location for a frame.
plot3d(1, x=0..2*Pi, y=0..Pi, coords=spherical, viewpoint=[path=[[50*t, 80*cos(t), 100*sin(t)], t=-3*Pi..Pi]]);
In the second form, an m-by-3 Matrix or a list of m 3-element lists representing m points is provided. A spline curve is then fit through the given points to generate the camera locations.
As with the location form for specifying the viewpoint, the look or upvector option may be given for controlling the center of the viewport and the vertical direction of the camera, respectively. Either of these may also be given as a single point or vector, in which case the value applies to all frames. Also, the look option may take the value forward.
The number of frames used in computing the camera locations is provided through the frames option. If this option is not given, then the number of frames is deduced from values of the look or upvector option if provided, or set to a default otherwise.
The fieldofview option may also be provided with the path form.
M := Matrix([[600,600,600], [400,400,200], [100,100,-400], [1,1,1]], datatype=float[8]):
plot3d(1, x=0..2*Pi, y=0..Pi, coords=spherical, viewpoint=[path=M]);
frames
A positive integer specifying the number of frames in the animation. The default value is 50.
location
Points specifying the location of the camera for each frame. The n points may be given as an n-by-3 Matrix or as a list of n 3-element sublists. The x, y, and z components of point i are in row i of the Matrix or in the ith sublist. A single point can also be provided, either as a 3-element Vector or list. If a single point is provided for the location, then that point is used for all frames of the animation.
path
A list of expressions or points specifying the path of the camera. The path can have a parametric form [x(t),y(t),z(t), t=a..b], where x(t), y(t), and z(t) are expressions in the name t, and a and b are numeric values. In this case, a number of points is computed, with the parameter t varying from a to b. If the path is, instead, an m-by-3 Matrix or a list of m 3-element sublists, with m > 1, then points along a spline interpolant going through the given m points are computed. In both cases, the number of computed points is equal to the number of frames in the animation.
look
Points specifying the center of the viewport (at which the camera is looking) for each frame. The look values take the same form as the location values. If a single point is provided, it is used for all the frames. The look option may have the additional value forward, which means that the camera is looking at the next point on the path. The default viewport center is a point in the middle of the plot.
upvector
Vectors specifying the vertical direction of the camera for each frame. The upvector values take the same form as the location values, except that each row of the Matrix or each sublist provides the vector rather than point components. If a single vector is provided, it is used for all the frames. The default vector is [0,1,0], corresponding to the positive y-axis.
fieldofview
A positive numeric value specifying the field of view of the camera, measured in degrees. A plot whose maximum dimension is y with a camera positioned a distance z away will approximately fill the viewport if the fieldofview option is set to atan(y/z), provided unit lengths of all three axes has been made to occupy the same length in the plot, for example by specifying scaling=constrained. A large value makes the plot appear small and also makes perspective effects more apparent. To reduce perspective effects this value should be reduced, combined with moving the camera further from the plot. The fieldofview option cannot be used with named viewpoints.
The viewpoint option overrides the orientation and projection options, unless the named form is used. These two options will be ignored if any form of the viewpoint option other than the named form is used and will not be modifiable interactively.
The viewpoint option can only be used with a static plot and not with an animation created through the plots[display] or plots[animate] command.
If the frames option is provided, it must match the number of points given in the location, upvector, or look option values. If there is ambiguity in the number of frames specified, an error is issued.
All coordinates specified are in the plot’s coordinate system. This can introduce incongruities if the plot's scaling is not uniform, that is, if the scaling=constrained option is not specified. For example, a camera positioned at [500,500,0] is looking at the plot from a 45 degree angle if scaling is constrained, but from some other angle if the x and y scaling are different. The viewpoint option always works in Cartesian coordinates, even if the plot is specified in another coordinate system.
See Also
plot3d
plots[animate]
plots[display]
Download Help Document