plottools
rotate
rotate PLOT and PLOT3D data structures
Calling Sequence
Parameters
Description
Examples
rotate(p, ang, pt_2d)
rotate(q,alpha,beta,gamma)
rotate(q,alpha,[pt_3d_1,pt_3d_2])
p
-
PLOT data structure or a 2-D object
ang
counter-clockwise rotation angle in radians
pt_2d
(optional) list of 2 real numbers specifying the center of the rotation (for the 2-D case)
q
PLOT3D data structure or a 3-D object
alpha
rotation angle around x-axis in radians
beta
rotation angle around y-axis in radians
gamma
rotation angle around z-axis in radians
pt_3d_1, pt_3d_2
(optional) lists of 3 real numbers
The rotate command takes a plot structure or object and produces a new plot structure or object rotated by the specified angle(s).
The inputs p and q must be PLOT and PLOT3D data structures or objects. For 2-D plots and objects, ang represents the counter-clockwise rotation angle.
For 3-D plots and objects, the original rectangular coordinate system with x, y, and z-axes is brought into coincidence with a second rectangular coordinate system with the same origin and x1, y1, and z1-axes. This is done by rotating about the x-axis through an angle alpha, then about the y-axis through an angle beta, and finally about the z-axis through an angle gamma. All rotations follow the left-hand rule, that is, if you point your left thumb in the positive direction of the axis, then your fingers curl in the direction of the rotation.
If the calling sequence is of the form rotate(q, alpha, [pt_3d_1, pt_3d_2]), then pt_3d_1 and pt_3d_2 define the axis of rotation.
The result of a call to rotate is a 2-D or 3-D plot structure or object that can be displayed with the plots:-display command. You can assign the data structure to a variable, save it in a file, then read it for redisplay. For more information about plot data structures, see plot/structure.
Several commands in the plottools package can transform plots. For a list, see the plottools help page. The plots:-changecoords and plots:-display commands can also be used to transform plots.
with⁡plottools:
with⁡plots:
p≔plot⁡sin⁡x,x,x=0..2⁢π:
r≔rotate⁡p,π3:
display⁡p,r
p≔plot3d⁡1.3x⁢sin⁡y,x,y,x=−1..2⁢π,y=0..π:
r≔rotate⁡p,π,π2,π:
display⁡p,r,axes=frame,orientation=120,50,style=patchnogrid
display⁡rotate⁡hyperbola⁡0,0,0.5,0.5,−1..1,π4,color=red
r0≔sphere⁡3,0,0,1,grid=25,25:
a≔π4:c≔1:
whileevalf⁡a−2⁢π<0dorc≔rotate⁡r0,a,0,0,0,0,0,1;a≔a+π4;c≔c+1enddo:display⁡seq⁡ri,i=0..c−1,scaling=constrained,style=hidden,lightmodel=light4,orientation=10,−125,shading=zhue
See Also
convert/radians
plot
plot/structure
plot3d
plots:-changecoords
plots:-display
plottools:-hyperbola
plottools:-sphere
while
Download Help Document