In this directory is the source for the public domain SURFMODL C program to do surface modeling (also known as solids modeling). This version works with PostScript and the NeWS Window System of Sun Microsystems LIST OF FILES IN THE SURFMODL DIRECTORY The following are documentation files for SURFMODL: README (Quick note on what to do, plus any last-minute updates) SURFMOD1.DOC (The main SURFMODL documentation file) The following are all the source files for SURFMODL. SURFMODL.H DRAW.H SURFMODL.C (the main program file), INREAL.C, READINI.C, WRITEINI.C, READFILE.C, VIEWCHAN.C, INITIAL.C, ARCCOS.C, PERSPECT.C, NORMALIZ.C, COLORMOD.C, DRAWPLOT.C, BORDER.C, OPENWIN.C, GETKEY.C, LITEMENU.C, PARAMENU.C, MENU.C, MENUMSG.C, SETGMODE.C, WIREFRAM.C, ONSCREEN.C, STORLINE.C, SWAPS.C, SHELLPTS.C, FILLSURF.C, MINMAX.C, SHELSURF.C, SHADING.C, HIDNLINE.C, INLIMITS.C, CHEKSURF.C, SHADOWS.C, SURFACE.C, STORSHAD.C, INTRFILL.C, GOURAUD.C, DRAWAXES.C DRAW.CPS The following are all the source files for PREPROC, the surface modeling preprocessor: PREPROC.H, PREPROC.C, EXTRUDE.C, INREAL.C, PATCH.C, PLANE.C, CINIT.C, CREAD.C, REFLECT.C, REVOLVE.C, SCSHROT.C, WRITEFIL.C The following are miscellaneous source files: MPREP.C (Source to the macro preprocessor, of no relation to PREPROC) FEM2SURF.C (Example of how to convert finite element data for SURFMODL) FUNC3D.C (Example of creating raw data for displaying a 3-D function) FUNC2SUR.C (Program to convert FUNC3D output to SURFMODL format) REFLECT.C (Program to reflect nodes about the origin) The following are all executable files: SURF (Surfmodl executable) PREPROC (Preprocessor to make input fils for surfmodl ) The following are all example data files for use with SURFMODL: CUBE (A VERY simple data file, to get you started) CUBE.INI (Initialization file for CUBE) FAN.IN (An example of a PREPROC data file) FAN (The output from PREPROC if you use FAN.IN, ready for SURFMODL) FAN.INI (Initialization file for FAN) MARYELLN (Data file for my wife's face) MARYELLN.INI (Initialization file for MARYELLN) ROBOT2 (Data file for the Puma Educational Robot) ROBOT2.INI (Initialization file for ROBOT2) TETRA (Another simple data file - a tetrahedron) TETRA.INI (Initialization file for TETRA) PARABOLA (Parabola data file, made using FUNC3D.C and FUNC2SUR.C) PARABOLA.INI (Initialization file for PARABOLA) SPACE (Space Shuttle data file) SPACE.INI (Initialization file for SPACE) GLASS (Glass data file) GLASS.INI (Initialization file for GLASS) X29 (X29 airplane data file) X29.INI (Initialization file for X29) VW (Volkswagen data file) MUSHROOM (Mushroom data file) MUSHROOM.INI (Initialization file for MUSHROOM) EPCOT3 (Epcot dome data file) EPCOT3.INI (Initialization file for EPCOT FRACTAL1 (A fractal data file) FRACTAL1.INI (Initialilzation file for FRACTAL1) FRACTAL2 (A fractal data file) FRACTAL2.INI (Initialilzation file for FRACTAL2) SPHERE3 (Sphere data file) SPRING (Spring data file) SPRING.INI (Initialization file for SPRING) Makefile (Make commands to build surf and preproc) This C version has some modifications from the original Turbo-Pascal version: - Almost all arrays are dynamically managed; there is no limit to dimensions, except memory - Menus are handled in the NeWS server instead of from the terminal including buttons and sliders - The rescale parameter XYmax is calculated only once for an object so that rotation is more natural. - The definition of Color has been changed to a floating point number between 0 and 1 corresponding to the hue. If a Color greater than 1 is read in it is divided by 32 before storing. - An internal variable, Saturation, has been added for Color saturation - normalize has been changed to give equal size images - A cutplane has been added to allow viewing inside of objects in a crude way. Doesn't cut smoothly. - fillsurf has been simplified to use the PostScript primitive fill. - High quality PostScript hardcopy is available through the NeWS server. - Gouraud shading now works pretty fast, but can't be printed yet - Drawaxes has been modified to use a default axislength scaled to XYmax. - mprep.c and reflect.c have been converted to C but are untested To run this with essentially no changes, you must have purchased and installed the NeWS binary distribution from SUN Microsystems (~$100). The draw.cps file is the PostScript code which is sent to the NeWS server. It handles all the mouse interactions and menus, e.g. You need the NeWS CPS utility to convert the draw.cps file into the draw.h file for inclusion in a few of the C files. Be sure to include the liteitem.ps in your user.ps file when starting up the news_server, otherwise the item stuff in draw.cps won't be available and the code will crash. To convert between proper gray images and color, simply reverse the order of gsetgray and gcolor wherever there occur together in the source code. 1/12/88 It now has been modified to run under NeWS1.0 and NeWS1.1. It now correctly terminates when the window or icon is zapped. The bug which crept in preventing the reading in of new images has also been fixed. David Forslund (dwf@lanl.arpa)