(*This Mathematica code was written by John Zweck (zweck@utdallas.edu) and generates a mathematical curve/surface that can be printed using a 3D printer. This model can (probably) be printed by Shapeways.*)

(*If you evaluate this Mathematica notebook,the curve/surface will be rendered using computer graphics.*)

(*If you uncomment the export line at the end of the code and set the directory path appropriately for your system you will obtain an STL file that can be sent to a 3D printer.*)

(*The STL file can also be viewed using the open source software Meshlab.*)

(*You may modify this code in any way you like.*)

(*This project was supported by the National Science Foundation through a Supplement to the UTeach Dallas Robert Noyce Scholarship Program (DUE 1544159).*)

f[u_,v_]:={u,v,u^2-v^2};
(*scale = 20;*) (* 8 x 8 x16 cm^3  10cm^3 material volume *)
scale = 15; (* 6 x 6 x12 cm^3 *)
radius = 3;
numPoints=200;
gridsteps=4;
umin=-2;
umax=2;
vmin=-2;
vmax=2;
curvesU=Table[scale*f[u,i],{i,vmin,vmax,(vmax-vmin)/gridsteps}];
curvesV=Table[scale*f[j,v],{j,umin,umax,(umax-umin)/gridsteps}];
tubesU=ParametricPlot3D[curvesU,{u,umin,umax},PlotStyle->Tube[radius],PlotPoints->numPoints,PlotRange->All];
tubesV=ParametricPlot3D[curvesV,{v,vmin,vmax},PlotStyle->Tube[radius],PlotPoints->numPoints,PlotRange->All];
corners=Graphics3D[Table[Sphere[scale *f[i,j],radius],{i,umin,umax,(umax-umin)/gridsteps},{j,vmin,vmax,(vmax-vmin)/gridsteps}]];
output=Show[tubesU,tubesV,corners]

(*Export["SaddleSurfaceRectangularGridCurvesSparser.stl",output];*)