3-D Plotting Package This supplimental set of subroutines, was written to use the ZETA supplied plotting routines to generate 3-D plots. Based on the CACM (Collected algorithms of the ACM) algorithm number 483 "Masked Three Dimensional Plot Program With Rotations [J4]". A 3-D plotting session is broken up into 3 parts for each 3-D plot that is generated. Part 1 is the initalization step which sets up the parameters for the 3-D plot. Part 2 is the set of calls to produce the plot. Part 3 terminates the current 3-D plot. Once a plot has been started, no ZETA routines should be called (except NEWPEN as needed) untill part 3 has been completed. PART 1 Initialization of a 3-D Plot The initialization of a 3-D plot requires that the following assumptions to be fulfilled: 1)The Zeta plotting routines have been initialized 2)The origin is set to location X=0., Y=0. (default on initalization of the ZETA plotter routines) 3)Any calls to OFFSET have ben reset to default 4)The same for FACTOR,ASPECT,ITALIC When the initalization phase is complete, any user defined dashed lines used in CALL PLOT have been reset to the default values and will remain so after the current 3-D plot is completed. The origin is redefined to the lower left hand corner of the defined box untill the plot is completed. The following routines-called in the order shown- comprise the initialization part of the 3-D plot. CALL BOX3D(VD,VA,WL,HL) The 3-D plot is limited to a box defined on the ZETA plotter page. The origin of the 3-D axis lie on the surface of page within the box. As the first call, BOX3D defines the location and size of the 3-D plot area. ZETA PLOTTER PAGE LONG SIDE (ZETA Y AXIS) 11 INCHES --------------------------------------------------------- => ZETA PLOTTER ! ^ ! + Y AXIS ! | ! ! V ! ! D ! ! | ^ UN ROTATED 3-D Y AXIS ! ! V | PARALLEL TO THIS LINE ! !<=VA=>----------------- ! ! ! ^ ! ! ! !<===WL=|======>!3-D PLOT AREA !ZETA PLOTTER PAGE ! ! H ! !SHORT SIDE (X-AXIS) ! ! L ! !8.5 INCHES ! ! | ! ! ! ! V ! ! ! -----------------=>UNROTATED 3-D X-AXIS ! ! PARALLEL TO THIS LINE ! ! UNROTATED 3-D Z AXIS UP OUT OF PAGE ! ! ! --------------------------------------------------------- | V ZETA PLOTTER +X AXIS VD OFFSET IN INCHES OF UPPER LEFT HAND CORNER OF PLOT AREA ALONG THE ZETA + X AXIS VA OFFSET IN INCHES OF UPPER LEFT HAND CORNER OF PLOT AREA ALONG THE ZETA + Y AXIS WL LENGTH IN INCHES OF THE BOX CONTAINING THE 3-D PLOT HL HEIGHT IN INCHES OF THE BOX CONTAINING THE 3-D PLOT CALL SCL3D(XL,YL,ZL,XMAX,YMAX,ZMAX,XMIN,YMIN,ZMIN) Sets up the axis and scaleing information for the 3-D plot. It defines the length -in the 3-D system before projection on to the 2-D surface- of the 3-D axis and the max value along that axis. Note that no scaleing is done. It is assumed that the origin is (0.,0.,0.) and is always in the box so the bias is always zero. Also the scale factor ([X,Y,Z]SCALE=[X,Y,Z]L/([X,Y,Z]MAX-[X,Y,Z]MIN) is not adjusted by a call to SCALE or RSCALE to make nice looking numbers on the axis. XL LENGTH OF THE UNPROJECTED X AXIS IN INCHES YL LENGTH OF THE UNPROJECTED Y AXIS IN INCHES ZL LENGTH OF THE UNPROJECTED Z AXIS IN INCHES XMAX MAX VALUE IN PLOTTING UNITS OF THE X COORDINATE OF POINTS TO BE PLOTTED YMAX MAX VALUE IN PLOTTING UNITS OF THE Y COORDINATE OF POINTS TO BE PLOTTED ZMAX MAX VALUE IN PLOTTING UNITS OF THE Z COORDINATE OF POINTS TO BE PLOTTED XMIN MIN VALUE IN PLOTTING UNITS OF THE X COORDINATE OF POINTS TO BE PLOTTED YMIN MIN VALUE IN PLOTTING UNITS OF THE Y COORDINATE OF POINTS TO BE PLOTTED ZMIN MIN VALUE IN PLOTTING UNITS OF THE Z COORDINATE OF POINTS TO BE PLOTTED CALL ROT3D(PHI,THETA) Defines the rotation of the 3-D axis system to get the view wanted. Two sucessive rotations are done,the first is about the 3-D X axis by THETA degrees, and then the second about the rotated 3-D Y axis by PHI degrees. PHI ANGLE, IN DEGREES, OF ROTATION ABOUT 3-D Y AXIS THETA ANGLE, IN DEGREES, OF ROTATION ABOUT 3-D X AXIS CALL MASK3D(I) Sets the masking characteristics to be used in the 3-D plot. I =-1 NO HIDDEN LINES I = 0 DOES FULL HIDDEN LINE-SHOWING TOP AND BOTTOM I =+1 PLOTS ONLY THE TOP OF THE SURFACE This call completes the initialization phase of the current 3-D plot. PART 2 Generateing the 3-D Plot Now that the current 3-D plot is initialized, the user has available 4 routines to work with in any order and combination. NOTE-- do not use any of the ZETA plotting routines at this time except NEWPEN. CALL LINE3D(XDATA,YDATA,ZDATA,NPTS) This is the basic line drawing routine of the 3-D plot package. It takes the data, projects the line on to the 2-D surface and plots it. NOTE -- if useing the hidden line feature, each line plotted must be further in the background than its predisesors. For this reason care must be taken in selecting the rotation angles used so as to not change this order. XDATA,YDATA,ZDATA ARRAYS CONTAINING THE X,Y,Z COORDINATES OF THE POINTS MAKEING UP THE LINE TO BE PLOTTED. NPTS NUMBER OF POINTS TO PLOT. CALL AXIS3D(X0,Y0,Z0,IAXIS,IPLANE,MESS,NCHAR,SIZE) Used to draw the projection of one of the 3-D axis on the 2-D surface. NOTE -- if the hidden line feature is selected, the axis is drawn implimenting this feature but the axis label and tic value numbers are not. X0,Y0,Z0 LOCATION, IN PLOTTING UNITS, OF THE STARTING POINT OF THE AXIS TO BE DRAWN. ASSUMED TO BE A LOCATION WHERE THAT AXIS IS ZERO. IAXIS BYTE CHARACTER DEFINEING WHICH AXIS IS BEING PLOTTED. MUST BE EITHER 'X','Y' OR 'Z'. IPLANE 2 BYTE CHARACER DEFINEING THE PLANE IN WHICH THE TIC MARKS,AXIS LABEL AND TIC VALUES ARE WRITTEN. MUST BE ONE OF THE FOLLOWING COMBINATIONS: 'XY','YX','XZ','ZX','YZ','ZY'. WITH THE FURTHER RESTRICTION THAT ONE OF THE TWO CHARACTERS MUST MATCH THE CHARACTER IN THE ARGUMENT 'IPLANE'. IF THE MATCHING CHARACTER IS THE FIRST ONE, THEN THE LABELS AND TICS ARE IN THE POSITIVE DIRECTION ALONG THE THE AXIS DEFINED BY THE SECOND CHARACTER. OTHERWISE THEY ARE OUTPUT IN THE NEGATIVE DIRECTION ALONG THE AXIS DEFINED BY THE FIRST CHARACTER. MESS TITLE OF THE AXISLABEL TO BE PRINTED OUT. NCHAR NUMBER OF CHARACTERS IN MESS SIZE SIZE OF NUMBERS AND LETTERS USED TO LABEL AXIS. CALL MARK(X,Y,Z,PLANE) At the location specified, generates a marker (boxed X) on the 3-D plot in the specified plane. If you are useing the hidden line feature, do not use this subroutine as it does not impliment that capability (it uses ZETA calls directly rather than going through LINE3D). X,Y,Z LOCATION OF CENTER OF MARK IN PLOTTING UNITS PLANE 2 BYTE CHARACTER DEFINEING THE PLANE TO DRAW THE MARKER =' ' DRAW MARKER FLAT ON THE PLOTTING SURFACE ='XY','YX' DRAW MARKER PROJECTED ONTO THE 2-D SURFACE AS IF IT WERE DRAWN PARRALLEL TO THE XY PLANE (Z=CONST) ='XZ','ZX' DRAW MARKER PROJECTED ONTO THE 2-D SURFACE AS IF IT WERE DRAWN PARRELLEL TO THE XZ PLANE (Y=CONST) ='YZ','ZY' DRAW MARKER PROJECTED ONTO THE 2-D SURFACE AS IF IT WERE DRAWN PARALLEL TO THE YZ PLANE (X=CONST) CALL DASH3D(X0,Y0,Z0,X1,Y1,Z1,LTYPE) Used to draw the 2-D projection of a 3-D line running between two points. The line being either solid or dashed, depending on the value of LTYPE. This variable has the same meaning as the ZETA routine PLOT argument IC. NOTE -- if the hidden line feature is implimented, do not ue this routine as the lines are not drawn via the LINE3D routine but by direct calls to the ZETA plotting routines. X0,Y0,Z0 COORDINATE OF STARTING POINT OF LINE TO BE DRAWN IN PLOTTING UNITS X1,Y1,Z1 END POINT OF LINE TO BE DRAWN IN PLOTTING UNITS LTYPE TYPE OF LINE TO BE DRAWN. ACCEPTABLE VALUES ARE 2,4 THRU 9. HAS SAME MEANING AS THE ARGUMENT IC TO SUBROUTINE PLOT SECTION 2-9 (PAGE 2-2) OF THE ZETA REFERENCE MANUAL PART 3 Termination of the current 3-D plot When the current plot is completed, the 3-D routines need to have their internal flags reset and the origin reset to allow the user to do other plotting. This is done by just one call with no arguments: CALL FIN3D This completes the current 3-D plot. The origin is set back to the upper left hand corner (0.,0.) of the plot page. The default dashed lines are selected (over rideing any user defined dashed lines in effect before the 3-D plot was started. ITALIC slant angle is set to 0. degrees (default) and ASPECT ratio is set to 1. (also default). The user can now do regular 2-D plots on the same page, do another 3-D plot or advance to the next page.