-- Graphing 3-D equations onto a 2-D graph grid 18-Sept-99 -- Elliptical Paraboloid -- uses sizeaxis() Xfun ~ The 3-D equation written in terms of X=..., Y=... and Z=... then I calculate cross-section (trace) arrays of {x,y,z} points. I next convert the 3-D point arrays to corresponding 2-D point arrays and do "plotline". The result is a trace sketch of various quadric surfaces in perfect perspective according to the placement of the Z-axis at an angle of 45° between the -X axis and -Y axis. by Eric Collins ~ a=6; b=1; c=2 TOPtrace=5 GRID=20 ---- toggle for direcection orientation -- "0" = off, "1" = on pos=1 neg=0 Zax={{Xmin,Xmin}/2,{0,0},{Xmax,Xmax}/2} plotline Zax tic_adjuster=10 ---- Surface Equation fy(X,Z)=((X/a)^2+(Z/c)^2)/b fz(X,Y)=c*sqrt((Y*b)-(X/a)^2) fx(Y,Z)=a*sqrt((Y*b)-(Z/c)^2) ---- Array Variables Zint=fz(0,T) -- Z-intercept for top and bottom traces Z[z]=(z-2*Zint*5-1)*.1 dim[2*Zint*10+1] Xint=fx(T,0) -- X-intercept for top and bottom traces EX[ex]=(ex-2*Xint*5-1)*.1 dim[2*Xint*10+1] ---- Trace coordinate arrays equations YZtrace={0,o*fy(0,Z),Z} XZtrace={EX,0,fz(EX,0)} XYtrace={EX,o*fy(EX,0),0} T=TOPtrace XZtraceT={EX,o*T,fz(EX,T)} XZtraceT2={EX,o*T,-fz(EX,T)} o=pos-neg ---- Array coordinate converter: (x,y,z) to (x,y) -- 3D to 2D coordinates YZtracept={YZtrace[1]-YZtrace[3]/2,YZtrace[2]-YZtrace[3]/2} plotline YZtracept XZtracept={XZtrace[1]-XZtrace[3]/2,XZtrace[2]-XZtrace[3]/2} plotline XZtracept XZtraceptT={XZtraceT[1]-XZtraceT[3]/2,XZtraceT[2]-XZtraceT[3]/2} plotline XZtraceptT XZtraceptT2={XZtraceT2[1]-XZtraceT2[3]/2,XZtraceT2[2]-XZtraceT2[3]/2} plotline XZtraceptT2 XYtracept={XYtrace[1]-XYtrace[3]/2,XYtrace[2]-XYtrace[3]/2} plotline XYtracept ta=tic_adjuster tics[t]=(t-Xmax+ta)*.5 dim[2*trunc(Xmax)] Ztics[t]={tics[t],tics[t]} Ztics2[t]={tics[t]-1/8,tics[t]} Ztics3[t]={tics[t]-1/4,tics[t]} plotline {Ztics[1],Ztics2[1],Ztics3[1]} plotline {Ztics[2],Ztics2[2],Ztics3[2]} plotline {Ztics[3],Ztics2[3],Ztics3[3]} plotline {Ztics[4],Ztics2[4],Ztics3[4]} plotline {Ztics[5],Ztics2[5],Ztics3[5]} plotline {Ztics[6],Ztics2[6],Ztics3[6]} plotline {Ztics[7],Ztics2[7],Ztics3[7]} plotline {Ztics[8],Ztics2[8],Ztics3[8]} plotline {Ztics[9],Ztics2[9],Ztics3[9]} plotline {Ztics[10],Ztics2[10],Ztics3[10]} plotline {Ztics[11],Ztics2[11],Ztics3[11]} plotline {Ztics[12],Ztics2[12],Ztics3[12]} plotline {Ztics[13],Ztics2[13],Ztics3[13]} plotline {Ztics[14],Ztics2[14],Ztics3[14]} plotline {Ztics[15],Ztics2[15],Ztics3[15]} plotline {Ztics[16],Ztics2[16],Ztics3[16]} plotline {Ztics[17],Ztics2[17],Ztics3[17]} plotline {Ztics[18],Ztics2[18],Ztics3[18]} plotline {Ztics[19],Ztics2[19],Ztics3[19]} Xmax=GRID Xmin=-GRID Ymin=-GRID Ymax=GRID Xdiv=2 Ydiv=2 Xshowgrid=on Yshowgrid=on --Xlabel="x" --Ylabel="y" sizeaxis(1,(Ymax-Ymin)/(Xmax-Xmin)):