# Macro Library plot3d

Basic 3D graph display, HTML Canvas or Flash fallback. Also includes functions to embed or link to CalcPlot3D.

- plot3d
- spacecurve
- replace3dalttext
- CalcPlot3Dembed
- CalcPlot3Dlink

### plot3d

plot3d(f(x,y),xmin,xmax,ymin,ymax,[disc,width,height,axes,alttext]) or
plot3d("[x(u,v),y(u,v),z(u,v)]",umin,umax,vmin,vmax,[disc,width,height,axes,bounds,alttext])
discritization is optional - defaults to 20
width and height default to 300
axes defaults to 1 (on), set to 0 for off
bounds: xmin,xmax,ymin,ymax,zmin,zmax
alttext: text for non-visual users. Can also be added later using replace3dalttext

### spacecurve

spacecurve("[x(t),y(t),z(t)]",tmin,tmax,[disc,width,height,axes,bounds,alttext])
discritization is optional - defaults to 50
width and height default to 300
axes defaults to 1 (on), set to 0 for off
bounds: xmin,xmax,ymin,ymax,zmin,zmax
alttext: text for non-visual users. Can also be added later using replace3dalttext

### replace3dalttext

replace3dalttext(plot, alttext)
Replaces or adds alt text to a 3D plot generated with plot3d or spacecurve

### CalcPlot3Dembed

CalcPlot3Dembed(functions, [width, height, xmin, xmax, ymin, ymax, zmin, zmax, xscale, yscale, zscale, zclipmin, zclipmax])

Embeds a dynamic figure using CalcPlot3D to draw the graph. The dynamic figure does not show the CalcPlot3D control panel, so if you want that, use the CalcPlot3Dlink function instead.

- functions: a single string or array of strings in one of these formats:
  - Standard function: `z=x^2+y^2,[xmin,xmax,ymin,ymax,gridlines]`
    xmin,xmax,ymin,ymax default to the graphing window. gridlines defaults to 30.
  - Implicit function: `x^2+y^2=z^2,[xmin,xmax,ymin,ymax,zmin,zmax,cubes]`
    xmin,xmax,ymin,ymax,zmin,zmax default to the graphing window. cubes defaults to 16.
  - Spacecurve: `curve,x(t),y(t),z(t),[tmin,tmax,tsteps]`
    Example: "curve,sin(t),cos(t),t,-2pi,2pi"
    Defaults: tmin=-10, tmax=10, tsteps=100
  - Parametric Surface: `psurf,x(u,v),y(u,v),z(u,v),[umin,umax,vmin,vmax,usteps,vsteps]`
    Example: "psurf,cos(u),sin(u),v"
    Defaults: umin=0, umax=2pi, vmin=0, vmax=pi, usteps=30, vsteps=15
  - Region 1: `region,y=f(x) bottom func,y=g(x) top func,z top function,[xmin,xmax]`
    Example: "region,y=1,y=2-x^2,z=x^2+y^2"
    Defaults: xmin=-1, xmax=1
  - Region 2: `region,x=f(y) left func,x=g(y) right func,z top function,[ymin,ymax]`
    Example: "region,x=1,x=4-y^2,z=x^2+y^2,-2,2"
    Defaults: ymin=-1, ymax=1
  - Vector Field: `vectorfield, M(x,y,z), N(x,y,z), P(x,y,z), [scale, Nx, Ny, Nz, fixedlen]`
    Example: "vectorfield,x,x-y,z,8,4,4,4,true"
    Defaults: scale defaults to dividing by 8
    Nx, Ny, Nz is number of vectors along each axis; defaults to 6
    fixedlen defaults to false (fixed length for vectors)
  - Vector: `vector, vx, vy, vz, [color, width, x0, y0, z0]`
    Example: "vector,1,3,-2,ff0000"
    Defaults: color: hex color string like "FF0000", default "000000" (black)
    width: default 2
    x0,y0,z0: base point of vector, default 0,0,0
- width, height: the size for the embed. Defaults to 500 by 500
- xmin, xmax, ymin, ymax, zmin, zmax: the graphing window. Defaults to -2 to 2 for each.
- xscale, yscale, zscale: spacing for axis labels. Defaults to 1.
- zclipmin, zclipmax: z-values to chop the graph off at. Defaults to zmin-.5(zmax-zmin) and zmax+.5(zmax-zmin)

### CalcPlot3Dlink

CalcPlot3Dlink(functions, linktext, [xmin, xmax, ymin, ymax, zmin, zmax, xscale, yscale, zscale, zclipmin, zclipmax])

Creates a custom link to CalcPlot3D to draw the graph. This view will include the CalcPlot3D control panel for exploring the graph.

- functions: a single string or array of strings for the equation to graph. See above for the formats
- linktext: the text of the link itself
- xmin, xmax, ymin, ymax, zmin, zmax: the graphing window. Defaults to -2 to 2 for each.
- xscale, yscale, zscale: spacing for axis labels. Defaults to 1.
- zclipmin, zclipmax: z-values to chop the graph off at. Defaults to zmin-.5(zmax-zmin) and zmax+.5(zmax-zmin)