--
-- 3d plotter
-- by Matthew Wachowski 
--enter function here:

f(x,y) = sin(x)+cos(y)

--Enter plot info here

steps=25
angx=-30
angy=30
angz=90
xscale=1
yscale=1
zscale=2
xhi = 180
xlo = -180
yhi = 180
ylo = -180

--Enter 2d info here

Xmin=0
Xmax=s*1.5
Ymin=-s/2
Ymax=s

--General Code:

s=steps+2
xc(x)=H(x)*(xhi-xlo)/(s-1)+xlo
yc(x)=V(x)*(yhi-ylo)/(s-1)+ylo
frac(x) = x-trunc(x)
H(x) = trunc((x-1)/s) when trunc((x-1)/s)<(s-2), k
V(x) = trunc(frac((x-1)/s)*s) when trunc(frac((x-1)/s)*s)<(s-2), k
xux=cos(angx)*xscale
xuy=sin(angx)*xscale
yux=cos(angy)*yscale
yuy=sin(angy)*yscale
zux=cos(angz)*zscale
zuy=sin(angz)*zscale
A[x] = {xux*H(x)+yux*V(x)+zux*f(xc(x),yc(x)), yuy*V(x)+xuy*H(x)+zuy*f(xc(x),yc(x))} dim[s^2+s]
B[x] = {xux*V(x)+yux*H(x)+zux*f(yc(x),xc(x)), yuy*H(x)+xuy*V(x)+zuy*f(yc(x),xc(x))} dim[s^2+s]

plotline A
plotline B