
(/VERSIONCHECK 2) 

(DEFUN |PLOT3D;point| (|xx| |yy| |zz| |col| $)
  (PROG (|l|)
    (RETURN
     (SPADCALL (LETT |l| (LIST |xx| |yy| |zz| |col|) |PLOT3D;point|)
               (QREFELT $ 18))))) 

(DEFUN |PLOT3D;fourth| (|list| $) (|SPADfirst| (CDR (CDR (CDR |list|))))) 

(DEFUN |PLOT3D;checkRange| (|r| $)
  (COND
   ((< (SPADCALL |r| (QREFELT $ 20)) (SPADCALL |r| (QREFELT $ 21)))
    (|error| "ranges cannot be negative"))
   ('T |r|))) 

(DEFUN |PLOT3D;intersect| (|s| |t| $)
  (|PLOT3D;checkRange|
   (SPADCALL (MAX (SPADCALL |s| (QREFELT $ 21)) (SPADCALL |t| (QREFELT $ 21)))
             (MIN (SPADCALL |s| (QREFELT $ 20)) (SPADCALL |t| (QREFELT $ 20)))
             (QREFELT $ 22))
   $)) 

(DEFUN |PLOT3D;union| (|s| |t| $)
  (SPADCALL (MIN (SPADCALL |s| (QREFELT $ 21)) (SPADCALL |t| (QREFELT $ 21)))
            (MAX (SPADCALL |s| (QREFELT $ 20)) (SPADCALL |t| (QREFELT $ 20)))
            (QREFELT $ 22))) 

(DEFUN |PLOT3D;join| (|l| |i| $)
  (PROG (|u| #1=#:G1833 |r| |rr|)
    (RETURN
     (SEQ (LETT |rr| (|SPADfirst| |l|) . #2=(|PLOT3D;join|))
          (LETT |u|
                (COND ((EQL |i| 0) (|SPADfirst| (QVELT |rr| 1)))
                      ((EQL |i| 1) (SPADCALL (QVELT |rr| 1) (QREFELT $ 24)))
                      ((EQL |i| 2) (SPADCALL (QVELT |rr| 1) (QREFELT $ 25)))
                      ('T (|PLOT3D;fourth| (QVELT |rr| 1) $)))
                . #2#)
          (SEQ (LETT |r| NIL . #2#) (LETT #1# (CDR |l|) . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |r| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ
                (EXIT
                 (COND
                  ((EQL |i| 0)
                   (LETT |u| (|PLOT3D;union| |u| (|SPADfirst| (QVELT |r| 1)) $)
                         . #2#))
                  ((EQL |i| 1)
                   (LETT |u|
                         (|PLOT3D;union| |u|
                          (SPADCALL (QVELT |r| 1) (QREFELT $ 24)) $)
                         . #2#))
                  ((EQL |i| 2)
                   (LETT |u|
                         (|PLOT3D;union| |u|
                          (SPADCALL (QVELT |r| 1) (QREFELT $ 25)) $)
                         . #2#))
                  ('T
                   (LETT |u|
                         (|PLOT3D;union| |u| (|PLOT3D;fourth| (QVELT |r| 1) $)
                          $)
                         . #2#)))))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT |u|))))) 

(DEFUN |PLOT3D;parametricRange| (|r| $) (|SPADfirst| (QVELT |r| 1))) 

(DEFUN |PLOT3D;minPoints3D;I;8| ($) (QREFELT $ 8)) 

(DEFUN |PLOT3D;setMinPoints3D;2I;9| (|n| $)
  (SEQ (COND ((< |n| 3) (|error| "three points minimum required")))
       (COND ((< (QREFELT $ 9) |n|) (SETELT $ 9 |n|))) (EXIT (SETELT $ 8 |n|)))) 

(DEFUN |PLOT3D;maxPoints3D;I;10| ($) (QREFELT $ 9)) 

(DEFUN |PLOT3D;setMaxPoints3D;2I;11| (|n| $)
  (SEQ (COND ((< |n| 3) (|error| "three points minimum required")))
       (COND ((< |n| (QREFELT $ 8)) (SETELT $ 8 |n|))) (EXIT (SETELT $ 9 |n|)))) 

(DEFUN |PLOT3D;screenResolution3D;I;12| ($) (QREFELT $ 11)) 

(DEFUN |PLOT3D;setScreenResolution3D;2I;13| (|n| $)
  (SEQ (COND ((< |n| 2) (|error| "buy a new terminal")))
       (EXIT (SETELT $ 11 |n|)))) 

(DEFUN |PLOT3D;adaptive3D?;B;14| ($) (QREFELT $ 7)) 

(DEFUN |PLOT3D;setAdaptive3D;2B;15| (|b| $) (SETELT $ 7 |b|)) 

(DEFUN |PLOT3D;numFunEvals3D;I;16| ($) (QREFELT $ 10)) 

(DEFUN |PLOT3D;debug3D;2B;17| (|b| $) (SETELT $ 15 |b|)) 

(DEFUN |PLOT3D;xRange;$S;18| (|plot| $)
  (SPADCALL (QVELT |plot| 1) (QREFELT $ 24))) 

(DEFUN |PLOT3D;yRange;$S;19| (|plot| $)
  (SPADCALL (QVELT |plot| 1) (QREFELT $ 25))) 

(DEFUN |PLOT3D;zRange;$S;20| (|plot| $) (|PLOT3D;fourth| (QVELT |plot| 1) $)) 

(DEFUN |PLOT3D;tRange;$S;21| (|plot| $) (|SPADfirst| (QVELT |plot| 1))) 

(DEFUN |PLOT3D;tValues;$L;22| (|plot| $)
  (PROG (|outList| #1=#:G1856 |curve|)
    (RETURN
     (SEQ (LETT |outList| NIL . #2=(|PLOT3D;tValues;$L;22|))
          (SEQ (LETT |curve| NIL . #2#) (LETT #1# (QVELT |plot| 4) . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |curve| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ
                (EXIT
                 (LETT |outList| (CONS (QVELT |curve| 2) |outList|) . #2#)))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT |outList|))))) 

(DEFUN |PLOT3D;select| (|l| |f| |g| $)
  (PROG (|m| |fp| #1=#:G1861 |p|)
    (RETURN
     (SEQ (LETT |m| (SPADCALL (|SPADfirst| |l|) |f|) . #2=(|PLOT3D;select|))
          (SEQ (LETT |p| NIL . #2#) (LETT #1# (CDR |l|) . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |p| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ (LETT |fp| (SPADCALL |p| |f|) . #2#)
                    (EXIT (LETT |m| (SPADCALL |m| |fp| |g|) . #2#)))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT |m|))))) 

(DEFUN |PLOT3D;rangeRefine| (|curve| |nRange| $)
  (PROG (|zRange| |yRange| |xRange| |p| |t| |t1| |i| |d| |n| |q| |c| |s|
         #1=#:G1880 |f| |h| |l|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ (|PLOT3D;checkRange| |nRange| $)
            (LETT |l| (SPADCALL |nRange| (QREFELT $ 21))
                  . #2=(|PLOT3D;rangeRefine|))
            (LETT |h| (SPADCALL |nRange| (QREFELT $ 20)) . #2#)
            (LETT |t| (QVELT |curve| 2) . #2#)
            (LETT |p| (QVELT |curve| 3) . #2#)
            (LETT |f| (QVELT |curve| 0) . #2#)
            (SEQ G190
                 (COND
                  ((NULL
                    (COND ((NULL |t|) 'NIL) ('T (< (|SPADfirst| |t|) |l|))))
                   #3=(GO G191)))
                 (SEQ (LETT |t| (CDR |t|) . #2#)
                      (EXIT (LETT |p| (CDR |p|) . #2#)))
                 NIL #4=(GO G190) G191 (EXIT NIL))
            (LETT |c| NIL . #2#) (LETT |q| NIL . #2#)
            (SEQ G190
                 (COND
                  ((NULL
                    (COND ((OR (NULL |t|) (< |h| (|SPADfirst| |t|))) 'NIL)
                          ('T 'T)))
                   #3#))
                 (SEQ (LETT |c| (CONS (|SPADfirst| |t|) |c|) . #2#)
                      (LETT |q| (CONS (|SPADfirst| |p|) |q|) . #2#)
                      (LETT |t| (CDR |t|) . #2#)
                      (EXIT (LETT |p| (CDR |p|) . #2#)))
                 NIL #4# G191 (EXIT NIL))
            (COND
             ((NULL |c|)
              (PROGN
               (LETT #1# (|PLOT3D;basicPlot| |f| |nRange| $) . #2#)
               (GO #1#))))
            (COND
             ((< (|SPADfirst| |c|) |h|)
              (SEQ (LETT |c| (CONS |h| |c|) . #2#)
                   (LETT |q| (CONS (SPADCALL |h| |f|) |q|) . #2#)
                   (EXIT (SETELT $ 10 (+ (QREFELT $ 10) 1))))))
            (LETT |t| (LETT |c| (NREVERSE |c|) . #2#) . #2#)
            (LETT |p| (LETT |q| (NREVERSE |q|) . #2#) . #2#)
            (LETT |s|
                  (/ (- |h| |l|)
                     (- (FLOAT (QREFELT $ 8) MOST-POSITIVE-DOUBLE-FLOAT) 1.0))
                  . #2#)
            (COND
             ((NULL (= (|SPADfirst| |t|) |l|))
              (SEQ (LETT |t| (LETT |c| (CONS |l| |c|) . #2#) . #2#)
                   (LETT |p| (LETT |q| (CONS (SPADCALL |l| |f|) |p|) . #2#)
                         . #2#)
                   (EXIT (SETELT $ 10 (+ (QREFELT $ 10) 1))))))
            (SEQ G190
                 (COND ((NULL (COND ((NULL (CDR |t|)) 'NIL) ('T 'T))) #3#))
                 (SEQ
                  (LETT |n|
                        (TRUNCATE
                         (/ (- (SPADCALL |t| (QREFELT $ 44)) (|SPADfirst| |t|))
                            |s|))
                        . #2#)
                  (LETT |d|
                        (/ (- (SPADCALL |t| (QREFELT $ 44)) (|SPADfirst| |t|))
                           (FLOAT (+ |n| 1) MOST-POSITIVE-DOUBLE-FLOAT))
                        . #2#)
                  (SEQ (LETT |i| 1 . #2#) G190
                       (COND ((QSGREATERP |i| |n|) #3#))
                       (SEQ
                        (SPADCALL |t| '|rest|
                                  (CONS (+ (|SPADfirst| |t|) |d|) (CDR |t|))
                                  (QREFELT $ 46))
                        (LETT |t1| (SPADCALL |t| (QREFELT $ 44)) . #2#)
                        (SPADCALL |p| '|rest|
                                  (CONS (SPADCALL |t1| |f|) (CDR |p|))
                                  (QREFELT $ 48))
                        (SETELT $ 10 (+ (QREFELT $ 10) 1))
                        (LETT |t| (CDR |t|) . #2#)
                        (EXIT (LETT |p| (CDR |p|) . #2#)))
                       (LETT |i| (QSADD1 |i|) . #2#) #4# G191 (EXIT NIL))
                  (LETT |t| (CDR |t|) . #2#) (EXIT (LETT |p| (CDR |p|) . #2#)))
                 NIL #4# G191 (EXIT NIL))
            (LETT |xRange|
                  (SPADCALL (|PLOT3D;select| |q| (ELT $ 50) (ELT $ 51) $)
                            (|PLOT3D;select| |q| (ELT $ 50) (ELT $ 52) $)
                            (QREFELT $ 22))
                  . #2#)
            (LETT |yRange|
                  (SPADCALL (|PLOT3D;select| |q| (ELT $ 53) (ELT $ 51) $)
                            (|PLOT3D;select| |q| (ELT $ 53) (ELT $ 52) $)
                            (QREFELT $ 22))
                  . #2#)
            (LETT |zRange|
                  (SPADCALL (|PLOT3D;select| |q| (ELT $ 54) (ELT $ 51) $)
                            (|PLOT3D;select| |q| (ELT $ 54) (ELT $ 52) $)
                            (QREFELT $ 22))
                  . #2#)
            (EXIT
             (VECTOR |f| (LIST |nRange| |xRange| |yRange| |zRange|) |c| |q|))))
      #1# (EXIT #1#))))) 

(DEFUN |PLOT3D;adaptivePlot|
       (|curve| |tRg| |xRg| |yRg| |zRg| |pixelfraction| |resolution| $)
  (PROG (|p| |t| |todo2| |todo1| |tj| |tm| |st| |n| #1=#:G1918 |dp| |s2| |s1|
         |c2| |b2| |a2| |c1| |b1| |a1| |z2| |y2| |x2| |z1| |y1| |x1| |z0| |y0|
         |x0| |sp| |t2| |t1| |t0| |todop| |todot| |headerp| |headert| |tLimit|
         |maxLength| |minLength| |f| |tDiff| |h| |l| |zDiff| |yDiff| |xDiff|)
    (RETURN
     (SEQ
      (LETT |xDiff|
            (- (SPADCALL |xRg| (QREFELT $ 20)) (SPADCALL |xRg| (QREFELT $ 21)))
            . #2=(|PLOT3D;adaptivePlot|))
      (LETT |yDiff|
            (- (SPADCALL |yRg| (QREFELT $ 20)) (SPADCALL |yRg| (QREFELT $ 21)))
            . #2#)
      (LETT |zDiff|
            (- (SPADCALL |zRg| (QREFELT $ 20)) (SPADCALL |zRg| (QREFELT $ 21)))
            . #2#)
      (COND ((= |xDiff| 0.0) (LETT |xDiff| 1.0 . #2#)))
      (COND ((= |yDiff| 0.0) (LETT |yDiff| 1.0 . #2#)))
      (COND ((= |zDiff| 0.0) (LETT |zDiff| 1.0 . #2#)))
      (LETT |l| (SPADCALL |tRg| (QREFELT $ 21)) . #2#)
      (LETT |h| (SPADCALL |tRg| (QREFELT $ 20)) . #2#)
      (LETT |tDiff| (- |h| |l|) . #2#)
      (EXIT
       (COND ((= |tDiff| 0.0) |curve|)
             (#3='T
              (SEQ (LETT |t| (QVELT |curve| 2) . #2#)
                   (EXIT
                    (COND ((< (LENGTH |t|) 3) |curve|)
                          (#3#
                           (SEQ (LETT |p| (QVELT |curve| 3) . #2#)
                                (LETT |f| (QVELT |curve| 0) . #2#)
                                (LETT |minLength|
                                      (/ (FLOAT 4 MOST-POSITIVE-DOUBLE-FLOAT)
                                         (FLOAT |resolution|
                                                MOST-POSITIVE-DOUBLE-FLOAT))
                                      . #2#)
                                (LETT |maxLength|
                                      (/ 1.0
                                         (FLOAT 4 MOST-POSITIVE-DOUBLE-FLOAT))
                                      . #2#)
                                (LETT |tLimit|
                                      (/ |tDiff|
                                         (FLOAT
                                          (* |pixelfraction| |resolution|)
                                          MOST-POSITIVE-DOUBLE-FLOAT))
                                      . #2#)
                                (SEQ G190
                                     (COND
                                      ((NULL
                                        (COND ((NULL |t|) 'NIL)
                                              ('T (< (|SPADfirst| |t|) |l|))))
                                       #4=(GO G191)))
                                     (SEQ (LETT |t| (CDR |t|) . #2#)
                                          (EXIT (LETT |p| (CDR |p|) . #2#)))
                                     NIL #5=(GO G190) G191 (EXIT NIL))
                                (EXIT
                                 (COND ((< (LENGTH |t|) 3) |curve|)
                                       (#3#
                                        (SEQ (LETT |headert| |t| . #2#)
                                             (LETT |headerp| |p| . #2#)
                                             (LETT |st| |t| . #2#)
                                             (LETT |sp| |p| . #2#)
                                             (LETT |todot| NIL . #2#)
                                             (LETT |todop| NIL . #2#)
                                             (SEQ G190
                                                  (COND
                                                   ((NULL
                                                     (COND
                                                      ((NULL (CDR (CDR |st|)))
                                                       'NIL)
                                                      ('T 'T)))
                                                    #4#))
                                                  (SEQ
                                                   (LETT |todot|
                                                         (SPADCALL |todot| |st|
                                                                   (QREFELT $
                                                                            55))
                                                         . #2#)
                                                   (LETT |todop|
                                                         (SPADCALL |todop| |sp|
                                                                   (QREFELT $
                                                                            57))
                                                         . #2#)
                                                   (LETT |st| (CDR |st|) . #2#)
                                                   (EXIT
                                                    (LETT |sp| (CDR |sp|)
                                                          . #2#)))
                                                  NIL #5# G191 (EXIT NIL))
                                             (LETT |st| |headert| . #2#)
                                             (LETT |sp| |headerp| . #2#)
                                             (LETT |todo1| |todot| . #2#)
                                             (LETT |todo2| |todop| . #2#)
                                             (LETT |n| 0 . #2#)
                                             (SEQ
                                              (EXIT
                                               (SEQ G190
                                                    (COND
                                                     ((NULL
                                                       (COND
                                                        ((NULL |todo1|) 'NIL)
                                                        ('T 'T)))
                                                      #4#))
                                                    (SEQ
                                                     (LETT |st|
                                                           (|SPADfirst|
                                                            |todo1|)
                                                           . #2#)
                                                     (LETT |t0|
                                                           (|SPADfirst| |st|)
                                                           . #2#)
                                                     (LETT |t1|
                                                           (SPADCALL |st|
                                                                     (QREFELT $
                                                                              44))
                                                           . #2#)
                                                     (LETT |t2|
                                                           (SPADCALL |st|
                                                                     (QREFELT $
                                                                              58))
                                                           . #2#)
                                                     (COND
                                                      ((< |h| |t2|)
                                                       (PROGN
                                                        (LETT #1# |$NoValue|
                                                              . #2#)
                                                        (GO #1#))))
                                                     (EXIT
                                                      (COND
                                                       ((< (- |t2| |t0|)
                                                           |tLimit|)
                                                        (SEQ
                                                         (LETT |todo1|
                                                               (CDR |todo1|)
                                                               . #2#)
                                                         (LETT |todo2|
                                                               (CDR |todo2|)
                                                               . #2#)
                                                         (EXIT
                                                          (COND
                                                           ((NULL
                                                             (NULL |todo1|))
                                                            (SEQ
                                                             (LETT |t|
                                                                   (|SPADfirst|
                                                                    |todo1|)
                                                                   . #2#)
                                                             (EXIT
                                                              (LETT |p|
                                                                    (|SPADfirst|
                                                                     |todo2|)
                                                                    . #2#))))))))
                                                       ('T
                                                        (SEQ
                                                         (LETT |sp|
                                                               (|SPADfirst|
                                                                |todo2|)
                                                               . #2#)
                                                         (LETT |x0|
                                                               (SPADCALL
                                                                (|SPADfirst|
                                                                 |sp|)
                                                                (QREFELT $ 50))
                                                               . #2#)
                                                         (LETT |y0|
                                                               (SPADCALL
                                                                (|SPADfirst|
                                                                 |sp|)
                                                                (QREFELT $ 53))
                                                               . #2#)
                                                         (LETT |z0|
                                                               (SPADCALL
                                                                (|SPADfirst|
                                                                 |sp|)
                                                                (QREFELT $ 54))
                                                               . #2#)
                                                         (LETT |x1|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           59))
                                                                (QREFELT $ 50))
                                                               . #2#)
                                                         (LETT |y1|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           59))
                                                                (QREFELT $ 53))
                                                               . #2#)
                                                         (LETT |z1|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           59))
                                                                (QREFELT $ 54))
                                                               . #2#)
                                                         (LETT |x2|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           60))
                                                                (QREFELT $ 50))
                                                               . #2#)
                                                         (LETT |y2|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           60))
                                                                (QREFELT $ 53))
                                                               . #2#)
                                                         (LETT |z2|
                                                               (SPADCALL
                                                                (SPADCALL |sp|
                                                                          (QREFELT
                                                                           $
                                                                           60))
                                                                (QREFELT $ 54))
                                                               . #2#)
                                                         (LETT |a1|
                                                               (/ (- |x1| |x0|)
                                                                  |xDiff|)
                                                               . #2#)
                                                         (LETT |b1|
                                                               (/ (- |y1| |y0|)
                                                                  |yDiff|)
                                                               . #2#)
                                                         (LETT |c1|
                                                               (/ (- |z1| |z0|)
                                                                  |zDiff|)
                                                               . #2#)
                                                         (LETT |a2|
                                                               (/ (- |x2| |x1|)
                                                                  |xDiff|)
                                                               . #2#)
                                                         (LETT |b2|
                                                               (/ (- |y2| |y1|)
                                                                  |yDiff|)
                                                               . #2#)
                                                         (LETT |c2|
                                                               (/ (- |z2| |z1|)
                                                                  |zDiff|)
                                                               . #2#)
                                                         (LETT |s1|
                                                               (SPADCALL
                                                                (+
                                                                 (+
                                                                  (SPADCALL
                                                                   |a1| 2
                                                                   (QREFELT $
                                                                            62))
                                                                  (SPADCALL
                                                                   |b1| 2
                                                                   (QREFELT $
                                                                            62)))
                                                                 (SPADCALL |c1|
                                                                           2
                                                                           (QREFELT
                                                                            $
                                                                            62)))
                                                                (QREFELT $ 63))
                                                               . #2#)
                                                         (LETT |s2|
                                                               (SPADCALL
                                                                (+
                                                                 (+
                                                                  (SPADCALL
                                                                   |a2| 2
                                                                   (QREFELT $
                                                                            62))
                                                                  (SPADCALL
                                                                   |b2| 2
                                                                   (QREFELT $
                                                                            62)))
                                                                 (SPADCALL |c2|
                                                                           2
                                                                           (QREFELT
                                                                            $
                                                                            62)))
                                                                (QREFELT $ 63))
                                                               . #2#)
                                                         (LETT |dp|
                                                               (+
                                                                (+
                                                                 (* |a1| |a2|)
                                                                 (* |b1| |b2|))
                                                                (* |c1| |c2|))
                                                               . #2#)
                                                         (COND
                                                          ((< |s1| |maxLength|)
                                                           (COND
                                                            ((< |s2|
                                                                |maxLength|)
                                                             (COND
                                                              ((OR (= |s1| 0.0)
                                                                   (= |s2|
                                                                      0.0))
                                                               (EXIT
                                                                (SEQ
                                                                 (LETT |todo1|
                                                                       (CDR
                                                                        |todo1|)
                                                                       . #2#)
                                                                 (LETT |todo2|
                                                                       (CDR
                                                                        |todo2|)
                                                                       . #2#)
                                                                 (EXIT
                                                                  (COND
                                                                   ((NULL
                                                                     (NULL
                                                                      |todo1|))
                                                                    (SEQ
                                                                     (LETT |t|
                                                                           (|SPADfirst|
                                                                            |todo1|)
                                                                           . #2#)
                                                                     (EXIT
                                                                      (LETT |p|
                                                                            (|SPADfirst|
                                                                             |todo2|)
                                                                            . #2#)))))))))
                                                              ((< |s1|
                                                                  |minLength|)
                                                               (COND
                                                                ((OR
                                                                  (< |s2|
                                                                     |minLength|)
                                                                  (<
                                                                   (QREFELT $
                                                                            14)
                                                                   (/
                                                                    (/ |dp|
                                                                       |s1|)
                                                                    |s2|)))
                                                                 (EXIT
                                                                  (SEQ
                                                                   (LETT
                                                                    |todo1|
                                                                    (CDR
                                                                     |todo1|)
                                                                    . #2#)
                                                                   (LETT
                                                                    |todo2|
                                                                    (CDR
                                                                     |todo2|)
                                                                    . #2#)
                                                                   (EXIT
                                                                    (COND
                                                                     ((NULL
                                                                       (NULL
                                                                        |todo1|))
                                                                      (SEQ
                                                                       (LETT
                                                                        |t|
                                                                        (|SPADfirst|
                                                                         |todo1|)
                                                                        . #2#)
                                                                       (EXIT
                                                                        (LETT
                                                                         |p|
                                                                         (|SPADfirst|
                                                                          |todo2|)
                                                                         . #2#)))))))))))
                                                              ('T
                                                               (COND
                                                                ((<
                                                                  (QREFELT $
                                                                           14)
                                                                  (/
                                                                   (/ |dp|
                                                                      |s1|)
                                                                   |s2|))
                                                                 (EXIT
                                                                  (SEQ
                                                                   (LETT
                                                                    |todo1|
                                                                    (CDR
                                                                     |todo1|)
                                                                    . #2#)
                                                                   (LETT
                                                                    |todo2|
                                                                    (CDR
                                                                     |todo2|)
                                                                    . #2#)
                                                                   (EXIT
                                                                    (COND
                                                                     ((NULL
                                                                       (NULL
                                                                        |todo1|))
                                                                      (SEQ
                                                                       (LETT
                                                                        |t|
                                                                        (|SPADfirst|
                                                                         |todo1|)
                                                                        . #2#)
                                                                       (EXIT
                                                                        (LETT
                                                                         |p|
                                                                         (|SPADfirst|
                                                                          |todo2|)
                                                                         . #2#))))))))))))))))
                                                         (COND
                                                          ((EQL |n|
                                                                (QREFELT $ 9))
                                                           (PROGN
                                                            (LETT #1#
                                                                  |$NoValue|
                                                                  . #2#)
                                                            (GO #1#)))
                                                          ('T
                                                           (LETT |n| (+ |n| 1)
                                                                 . #2#)))
                                                         (LETT |st| (CDR |t|)
                                                               . #2#)
                                                         (EXIT
                                                          (COND
                                                           ((NULL
                                                             (CDR (CDR |st|)))
                                                            (SEQ
                                                             (LETT |tm|
                                                                   (/
                                                                    (+ |t0|
                                                                       |t1|)
                                                                    (FLOAT 2
                                                                           MOST-POSITIVE-DOUBLE-FLOAT))
                                                                   . #2#)
                                                             (LETT |tj| |tm|
                                                                   . #2#)
                                                             (SPADCALL |t|
                                                                       '|rest|
                                                                       (CONS
                                                                        |tj|
                                                                        (CDR
                                                                         |t|))
                                                                       (QREFELT
                                                                        $ 46))
                                                             (SPADCALL |p|
                                                                       '|rest|
                                                                       (CONS
                                                                        (SPADCALL
                                                                         |tj|
                                                                         |f|)
                                                                        (CDR
                                                                         |p|))
                                                                       (QREFELT
                                                                        $ 48))
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             55))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             55))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |tm|
                                                                   (/
                                                                    (+ |t1|
                                                                       |t2|)
                                                                    (FLOAT 2
                                                                           MOST-POSITIVE-DOUBLE-FLOAT))
                                                                   . #2#)
                                                             (LETT |tj| |tm|
                                                                   . #2#)
                                                             (SPADCALL |t|
                                                                       '|rest|
                                                                       (CONS
                                                                        |tj|
                                                                        (CDR
                                                                         |t|))
                                                                       (QREFELT
                                                                        $ 46))
                                                             (SPADCALL |p|
                                                                       '|rest|
                                                                       (CONS
                                                                        (SPADCALL
                                                                         |tj|
                                                                         |f|)
                                                                        (CDR
                                                                         |p|))
                                                                       (QREFELT
                                                                        $ 48))
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             55))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (CDR
                                                                    |todo1|)
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (CDR
                                                                    |todo2|)
                                                                   . #2#)
                                                             (EXIT
                                                              (COND
                                                               ((NULL
                                                                 (NULL
                                                                  |todo1|))
                                                                (SEQ
                                                                 (LETT |t|
                                                                       (|SPADfirst|
                                                                        |todo1|)
                                                                       . #2#)
                                                                 (EXIT
                                                                  (LETT |p|
                                                                        (|SPADfirst|
                                                                         |todo2|)
                                                                        . #2#))))))))
                                                           ('T
                                                            (SEQ
                                                             (LETT |tm|
                                                                   (/
                                                                    (+ |t0|
                                                                       |t1|)
                                                                    (FLOAT 2
                                                                           MOST-POSITIVE-DOUBLE-FLOAT))
                                                                   . #2#)
                                                             (LETT |tj| |tm|
                                                                   . #2#)
                                                             (SPADCALL |t|
                                                                       '|rest|
                                                                       (CONS
                                                                        |tj|
                                                                        (CDR
                                                                         |t|))
                                                                       (QREFELT
                                                                        $ 46))
                                                             (SPADCALL |p|
                                                                       '|rest|
                                                                       (CONS
                                                                        (SPADCALL
                                                                         |tj|
                                                                         |f|)
                                                                        (CDR
                                                                         |p|))
                                                                       (QREFELT
                                                                        $ 48))
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             55))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             55))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (CDR
                                                                    |todo1|)
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (CDR
                                                                    |todo2|)
                                                                   . #2#)
                                                             (LETT |tm|
                                                                   (/
                                                                    (+ |t1|
                                                                       |t2|)
                                                                    (FLOAT 2
                                                                           MOST-POSITIVE-DOUBLE-FLOAT))
                                                                   . #2#)
                                                             (LETT |tj| |tm|
                                                                   . #2#)
                                                             (SPADCALL |t|
                                                                       '|rest|
                                                                       (CONS
                                                                        |tj|
                                                                        (CDR
                                                                         |t|))
                                                                       (QREFELT
                                                                        $ 46))
                                                             (SPADCALL |p|
                                                                       '|rest|
                                                                       (CONS
                                                                        (SPADCALL
                                                                         |tj|
                                                                         |f|)
                                                                        (CDR
                                                                         |p|))
                                                                       (QREFELT
                                                                        $ 48))
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             55))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |t|
                                                                   (CDR |t|)
                                                                   . #2#)
                                                             (LETT |p|
                                                                   (CDR |p|)
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (SPADCALL
                                                                    |todo1| |t|
                                                                    (QREFELT $
                                                                             55))
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (SPADCALL
                                                                    |todo2| |p|
                                                                    (QREFELT $
                                                                             57))
                                                                   . #2#)
                                                             (LETT |todo1|
                                                                   (CDR
                                                                    |todo1|)
                                                                   . #2#)
                                                             (LETT |todo2|
                                                                   (CDR
                                                                    |todo2|)
                                                                   . #2#)
                                                             (EXIT
                                                              (COND
                                                               ((NULL
                                                                 (NULL
                                                                  |todo1|))
                                                                (SEQ
                                                                 (LETT |t|
                                                                       (|SPADfirst|
                                                                        |todo1|)
                                                                       . #2#)
                                                                 (EXIT
                                                                  (LETT |p|
                                                                        (|SPADfirst|
                                                                         |todo2|)
                                                                        . #2#)))))))))))))))
                                                    NIL #5# G191 (EXIT NIL)))
                                              #1# (EXIT #1#))
                                             (EXIT
                                              (COND
                                               ((< 0 |n|)
                                                (SEQ
                                                 (SETELT $ 10
                                                         (+ (QREFELT $ 10)
                                                            |n|))
                                                 (LETT |t| (QVELT |curve| 2)
                                                       . #2#)
                                                 (LETT |p| (QVELT |curve| 3)
                                                       . #2#)
                                                 (LETT |xRg|
                                                       (SPADCALL
                                                        (|PLOT3D;select| |p|
                                                         (ELT $ 50) (ELT $ 51)
                                                         $)
                                                        (|PLOT3D;select| |p|
                                                         (ELT $ 50) (ELT $ 52)
                                                         $)
                                                        (QREFELT $ 22))
                                                       . #2#)
                                                 (LETT |yRg|
                                                       (SPADCALL
                                                        (|PLOT3D;select| |p|
                                                         (ELT $ 53) (ELT $ 51)
                                                         $)
                                                        (|PLOT3D;select| |p|
                                                         (ELT $ 53) (ELT $ 52)
                                                         $)
                                                        (QREFELT $ 22))
                                                       . #2#)
                                                 (LETT |zRg|
                                                       (SPADCALL
                                                        (|PLOT3D;select| |p|
                                                         (ELT $ 54) (ELT $ 51)
                                                         $)
                                                        (|PLOT3D;select| |p|
                                                         (ELT $ 54) (ELT $ 52)
                                                         $)
                                                        (QREFELT $ 22))
                                                       . #2#)
                                                 (EXIT
                                                  (VECTOR (QVELT |curve| 0)
                                                          (LIST |tRg| |xRg|
                                                                |yRg| |zRg|)
                                                          |t| |p|))))
                                               (#3# |curve|))))))))))))))))))) 

(DEFUN |PLOT3D;basicPlot| (|f| |tRange| $)
  (PROG (|zRange| |yRange| |xRange| |p| |t| |l| #1=#:G1930 |i| |s| |h|)
    (RETURN
     (SEQ (|PLOT3D;checkRange| |tRange| $)
          (LETT |l| (SPADCALL |tRange| (QREFELT $ 21))
                . #2=(|PLOT3D;basicPlot|))
          (LETT |h| (SPADCALL |tRange| (QREFELT $ 20)) . #2#)
          (LETT |t| (SPADCALL |l| (QREFELT $ 66)) . #2#)
          (LETT |p| (SPADCALL (SPADCALL |l| |f|) (QREFELT $ 67)) . #2#)
          (LETT |s|
                (/ (- |h| |l|)
                   (FLOAT (- (QREFELT $ 8) 1) MOST-POSITIVE-DOUBLE-FLOAT))
                . #2#)
          (SEQ (LETT |i| 2 . #2#) (LETT #1# (- (QREFELT $ 8) 1) . #2#) G190
               (COND ((QSGREATERP |i| #1#) (GO G191)))
               (SEQ (LETT |l| (+ |l| |s|) . #2#)
                    (LETT |t| (CONS |l| |t|) . #2#)
                    (EXIT (LETT |p| (CONS (SPADCALL |l| |f|) |p|) . #2#)))
               (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
          (LETT |t| (NREVERSE (CONS |h| |t|)) . #2#)
          (LETT |p| (NREVERSE (CONS (SPADCALL |h| |f|) |p|)) . #2#)
          (LETT |xRange|
                (SPADCALL (|PLOT3D;select| |p| (ELT $ 50) (ELT $ 51) $)
                          (|PLOT3D;select| |p| (ELT $ 50) (ELT $ 52) $)
                          (QREFELT $ 22))
                . #2#)
          (LETT |yRange|
                (SPADCALL (|PLOT3D;select| |p| (ELT $ 53) (ELT $ 51) $)
                          (|PLOT3D;select| |p| (ELT $ 53) (ELT $ 52) $)
                          (QREFELT $ 22))
                . #2#)
          (LETT |zRange|
                (SPADCALL (|PLOT3D;select| |p| (ELT $ 54) (ELT $ 51) $)
                          (|PLOT3D;select| |p| (ELT $ 54) (ELT $ 52) $)
                          (QREFELT $ 22))
                . #2#)
          (EXIT
           (VECTOR |f| (LIST |tRange| |xRange| |yRange| |zRange|) |t| |p|)))))) 

(DEFUN |PLOT3D;zoom;$3S$;27| (|p| |xRange| |yRange| |zRange| $)
  (VECTOR (LIST |xRange| |yRange| |zRange|) (QVELT |p| 1) (QVELT |p| 2)
          (QVELT |p| 3) (QVELT |p| 4))) 

(DEFUN |PLOT3D;basicRefine| (|curve| |nRange| $)
  (PROG (|zRange| |yRange| |xRange| |p| |t| |pm| |tm| |f| |h| |l| |tRange|)
    (RETURN
     (SEQ
      (LETT |tRange| (|SPADfirst| (QVELT |curve| 1))
            . #1=(|PLOT3D;basicRefine|))
      (LETT |curve|
            (VECTOR (QVELT |curve| 0) (QVELT |curve| 1) (QVELT |curve| 2)
                    (QVELT |curve| 3))
            . #1#)
      (LETT |t|
            (QSETVELT |curve| 2 (SPADCALL (QVELT |curve| 2) (QREFELT $ 69)))
            . #1#)
      (LETT |p|
            (QSETVELT |curve| 3 (SPADCALL (QVELT |curve| 3) (QREFELT $ 70)))
            . #1#)
      (LETT |l| (SPADCALL |nRange| (QREFELT $ 21)) . #1#)
      (LETT |h| (SPADCALL |nRange| (QREFELT $ 20)) . #1#)
      (LETT |f| (QVELT |curve| 0) . #1#)
      (SEQ G190
           (COND
            ((NULL
              (COND ((NULL (CDR |t|)) 'NIL) ('T (< (|SPADfirst| |t|) |h|))))
             (GO G191)))
           (SEQ
            (EXIT
             (COND
              ((< (SPADCALL |t| (QREFELT $ 44)) |l|)
               (SEQ (LETT |t| (CDR |t|) . #1#)
                    (EXIT (LETT |p| (CDR |p|) . #1#))))
              ('T
               (SEQ
                (LETT |tm|
                      (/ (+ (|SPADfirst| |t|) (SPADCALL |t| (QREFELT $ 44)))
                         (FLOAT 2 MOST-POSITIVE-DOUBLE-FLOAT))
                      . #1#)
                (LETT |pm| (SPADCALL |tm| |f|) . #1#)
                (SETELT $ 10 (+ (QREFELT $ 10) 1))
                (SPADCALL |t| '|rest| (CONS |tm| (CDR |t|)) (QREFELT $ 46))
                (LETT |t| (CDR (CDR |t|)) . #1#)
                (SPADCALL |p| '|rest| (CONS |pm| (CDR |p|)) (QREFELT $ 48))
                (EXIT (LETT |p| (CDR (CDR |p|)) . #1#)))))))
           NIL (GO G190) G191 (EXIT NIL))
      (LETT |t| (QVELT |curve| 2) . #1#) (LETT |p| (QVELT |curve| 3) . #1#)
      (LETT |xRange|
            (SPADCALL (|PLOT3D;select| |p| (ELT $ 50) (ELT $ 51) $)
                      (|PLOT3D;select| |p| (ELT $ 50) (ELT $ 52) $)
                      (QREFELT $ 22))
            . #1#)
      (LETT |yRange|
            (SPADCALL (|PLOT3D;select| |p| (ELT $ 53) (ELT $ 51) $)
                      (|PLOT3D;select| |p| (ELT $ 53) (ELT $ 52) $)
                      (QREFELT $ 22))
            . #1#)
      (LETT |zRange|
            (SPADCALL (|PLOT3D;select| |p| (ELT $ 54) (ELT $ 51) $)
                      (|PLOT3D;select| |p| (ELT $ 54) (ELT $ 52) $)
                      (QREFELT $ 22))
            . #1#)
      (EXIT
       (VECTOR (QVELT |curve| 0) (LIST |tRange| |xRange| |yRange| |zRange|) |t|
               |p|)))))) 

(DEFUN |PLOT3D;refine;2$;29| (|p| $)
  (SPADCALL |p| (|PLOT3D;parametricRange| |p| $) (QREFELT $ 71))) 

(DEFUN |PLOT3D;refine;$S$;30| (|p| |nRange| $)
  (PROG (|zRange| |yRange| |xRange| |curves| |scrres| #1=#:G1951 |c| #2=#:G1950
         |tlimit| #3=#:G1949 #4=#:G1948 |tRange|)
    (RETURN
     (SEQ (SETELT $ 10 0)
          (LETT |tRange| (|PLOT3D;parametricRange| |p| $)
                . #5=(|PLOT3D;refine;$S$;30|))
          (LETT |nRange| (|PLOT3D;intersect| |tRange| |nRange| $) . #5#)
          (LETT |curves|
                (PROGN
                 (LETT #4# NIL . #5#)
                 (SEQ (LETT |c| NIL . #5#) (LETT #3# (QVELT |p| 4) . #5#) G190
                      (COND
                       ((OR (ATOM #3#) (PROGN (LETT |c| (CAR #3#) . #5#) NIL))
                        #6=(GO G191)))
                      (SEQ
                       (EXIT
                        (LETT #4#
                              (CONS (|PLOT3D;basicRefine| |c| |nRange| $) #4#)
                              . #5#)))
                      (LETT #3# (CDR #3#) . #5#) #7=(GO G190) G191
                      (EXIT (NREVERSE0 #4#))))
                . #5#)
          (LETT |xRange| (|PLOT3D;join| |curves| 1 $) . #5#)
          (LETT |yRange| (|PLOT3D;join| |curves| 2 $) . #5#)
          (LETT |zRange| (|PLOT3D;join| |curves| 3 $) . #5#)
          (LETT |scrres| (QVELT |p| 2) . #5#)
          (COND
           ((SPADCALL (QREFELT $ 34))
            (SEQ (LETT |tlimit| 8 . #5#)
                 (LETT |curves|
                       (PROGN
                        (LETT #2# NIL . #5#)
                        (SEQ (LETT |c| NIL . #5#) (LETT #1# |curves| . #5#)
                             G190
                             (COND
                              ((OR (ATOM #1#)
                                   (PROGN (LETT |c| (CAR #1#) . #5#) NIL))
                               #6#))
                             (SEQ
                              (EXIT
                               (LETT #2#
                                     (CONS
                                      (|PLOT3D;adaptivePlot| |c| |nRange|
                                       |xRange| |yRange| |zRange| |tlimit|
                                       (LETT |scrres|
                                             (SPADCALL 2 |scrres|
                                                       (QREFELT $ 73))
                                             . #5#)
                                       $)
                                      #2#)
                                     . #5#)))
                             (LETT #1# (CDR #1#) . #5#) #7# G191
                             (EXIT (NREVERSE0 #2#))))
                       . #5#)
                 (LETT |xRange| (|PLOT3D;join| |curves| 1 $) . #5#)
                 (LETT |yRange| (|PLOT3D;join| |curves| 2 $) . #5#)
                 (EXIT (LETT |zRange| (|PLOT3D;join| |curves| 3 $) . #5#)))))
          (EXIT
           (VECTOR (QVELT |p| 0) (LIST |tRange| |xRange| |yRange| |zRange|)
                   |scrres| (QVELT |p| 3) |curves|)))))) 

(DEFUN |PLOT3D;plot;$S$;31| (|p| |tRange| $)
  (PROG (|zRange| |yRange| |xRange| |curves| #1=#:G1961 |c| #2=#:G1960 |tlimit|
         #3=#:G1959 #4=#:G1958)
    (RETURN
     (SEQ (SETELT $ 10 0)
          (LETT |curves|
                (PROGN
                 (LETT #4# NIL . #5=(|PLOT3D;plot;$S$;31|))
                 (SEQ (LETT |c| NIL . #5#) (LETT #3# (QVELT |p| 4) . #5#) G190
                      (COND
                       ((OR (ATOM #3#) (PROGN (LETT |c| (CAR #3#) . #5#) NIL))
                        #6=(GO G191)))
                      (SEQ
                       (EXIT
                        (LETT #4#
                              (CONS (|PLOT3D;rangeRefine| |c| |tRange| $) #4#)
                              . #5#)))
                      (LETT #3# (CDR #3#) . #5#) #7=(GO G190) G191
                      (EXIT (NREVERSE0 #4#))))
                . #5#)
          (LETT |xRange| (|PLOT3D;join| |curves| 1 $) . #5#)
          (LETT |yRange| (|PLOT3D;join| |curves| 2 $) . #5#)
          (LETT |zRange| (|PLOT3D;join| |curves| 3 $) . #5#)
          (COND
           ((SPADCALL (QREFELT $ 34))
            (SEQ (LETT |tlimit| 8 . #5#)
                 (LETT |curves|
                       (PROGN
                        (LETT #2# NIL . #5#)
                        (SEQ (LETT |c| NIL . #5#) (LETT #1# |curves| . #5#)
                             G190
                             (COND
                              ((OR (ATOM #1#)
                                   (PROGN (LETT |c| (CAR #1#) . #5#) NIL))
                               #6#))
                             (SEQ
                              (EXIT
                               (LETT #2#
                                     (CONS
                                      (|PLOT3D;adaptivePlot| |c| |tRange|
                                       |xRange| |yRange| |zRange| |tlimit|
                                       (QVELT |p| 2) $)
                                      #2#)
                                     . #5#)))
                             (LETT #1# (CDR #1#) . #5#) #7# G191
                             (EXIT (NREVERSE0 #2#))))
                       . #5#)
                 (LETT |xRange| (|PLOT3D;join| |curves| 1 $) . #5#)
                 (LETT |yRange| (|PLOT3D;join| |curves| 2 $) . #5#)
                 (EXIT (LETT |zRange| (|PLOT3D;join| |curves| 3 $) . #5#)))))
          (EXIT
           (VECTOR (LIST |xRange| |yRange| |zRange|)
                   (LIST |tRange| |xRange| |yRange| |zRange|) (QVELT |p| 2)
                   (QVELT |p| 3) |curves|)))))) 

(DEFUN |PLOT3D;pointPlot;MS$;32| (|f| |tRange| $)
  (PROG (|p| |r|)
    (RETURN
     (SEQ
      (LETT |p| (|PLOT3D;basicPlot| |f| |tRange| $)
            . #1=(|PLOT3D;pointPlot;MS$;32|))
      (LETT |r| (QVELT |p| 1) . #1#) (SETELT $ 10 (QREFELT $ 8))
      (COND
       ((SPADCALL (QREFELT $ 34))
        (LETT |p|
              (|PLOT3D;adaptivePlot| |p| (|SPADfirst| |r|)
               (SPADCALL |r| (QREFELT $ 24)) (SPADCALL |r| (QREFELT $ 25))
               (|PLOT3D;fourth| |r| $) 8 (QREFELT $ 11) $)
              . #1#)))
      (EXIT (VECTOR (CDR |r|) |r| (QREFELT $ 11) NIL (LIST |p|))))))) 

(DEFUN |PLOT3D;pointPlot;M4S$;33| (|f| |tRange| |xRange| |yRange| |zRange| $)
  (PROG (|p|)
    (RETURN
     (SEQ
      (LETT |p| (SPADCALL |f| |tRange| (QREFELT $ 76))
            |PLOT3D;pointPlot;M4S$;33|)
      (QSETVELT |p| 0
                (LIST (|PLOT3D;checkRange| |xRange| $)
                      (|PLOT3D;checkRange| |yRange| $)
                      (|PLOT3D;checkRange| |zRange| $)))
      (EXIT |p|))))) 

(DEFUN |PLOT3D;myTrap| (|ff| |f| $)
  (PROG (|r| |s|)
    (RETURN
     (SEQ
      (LETT |s| (|trapNumericErrors| (SPADCALL |f| |ff|))
            . #1=(|PLOT3D;myTrap|))
      (COND ((QEQCAR |s| 1) (LETT |r| 0.0 . #1#))
            ('T (LETT |r| (QCDR |s|) . #1#)))
      (EXIT |r|))))) 

(DEFUN |PLOT3D;plot;4MS$;35| (|f1| |f2| |f3| |col| |tRange| $)
  (PROG (|p| |r|)
    (RETURN
     (SEQ
      (LETT |p|
            (|PLOT3D;basicPlot|
             (CONS #'|PLOT3D;plot;4MS$;35!0| (VECTOR |col| |f3| |f2| $ |f1|))
             |tRange| $)
            . #1=(|PLOT3D;plot;4MS$;35|))
      (LETT |r| (QVELT |p| 1) . #1#) (SETELT $ 10 (QREFELT $ 8))
      (COND
       ((SPADCALL (QREFELT $ 34))
        (LETT |p|
              (|PLOT3D;adaptivePlot| |p| (|SPADfirst| |r|)
               (SPADCALL |r| (QREFELT $ 24)) (SPADCALL |r| (QREFELT $ 25))
               (|PLOT3D;fourth| |r| $) 8 (QREFELT $ 11) $)
              . #1#)))
      (EXIT (VECTOR (CDR |r|) |r| (QREFELT $ 11) NIL (LIST |p|))))))) 

(DEFUN |PLOT3D;plot;4MS$;35!0| (|z1| $$)
  (PROG (|f1| $ |f2| |f3| |col|)
    (LETT |f1| (QREFELT $$ 4) . #1=(|PLOT3D;plot;4MS$;35|))
    (LETT $ (QREFELT $$ 3) . #1#)
    (LETT |f2| (QREFELT $$ 2) . #1#)
    (LETT |f3| (QREFELT $$ 1) . #1#)
    (LETT |col| (QREFELT $$ 0) . #1#)
    (RETURN
     (PROGN
      (|PLOT3D;point| (|PLOT3D;myTrap| |f1| |z1| $)
       (|PLOT3D;myTrap| |f2| |z1| $) (|PLOT3D;myTrap| |f3| |z1| $)
       (SPADCALL |z1| |col|) $))))) 

(DEFUN |PLOT3D;plot;4M4S$;36|
       (|f1| |f2| |f3| |col| |tRange| |xRange| |yRange| |zRange| $)
  (PROG (|p|)
    (RETURN
     (SEQ
      (LETT |p| (SPADCALL |f1| |f2| |f3| |col| |tRange| (QREFELT $ 79))
            |PLOT3D;plot;4M4S$;36|)
      (QSETVELT |p| 0
                (LIST (|PLOT3D;checkRange| |xRange| $)
                      (|PLOT3D;checkRange| |yRange| $)
                      (|PLOT3D;checkRange| |zRange| $)))
      (EXIT |p|))))) 

(DEFUN |PLOT3D;coerce;$Of;37| (|r| $)
  (PROG (|f| |l| #1=#:G1988 |p| #2=#:G1987 |h| |zRange| |yRange| |xRange|
         #3=#:G1986 |curve| |tRange| |tSymbol| |zSymbol| |ySymbol| |xSymbol|
         |spaces|)
    (RETURN
     (SEQ (LETT |spaces| "   " . #4=(|PLOT3D;coerce;$Of;37|))
          (LETT |xSymbol| "x = " . #4#) (LETT |ySymbol| "y = " . #4#)
          (LETT |zSymbol| "z = " . #4#) (LETT |tSymbol| "t = " . #4#)
          (LETT |tRange|
                (SPADCALL (|PLOT3D;parametricRange| |r| $) (QREFELT $ 82))
                . #4#)
          (LETT |f| NIL . #4#)
          (SEQ (LETT |curve| NIL . #4#) (LETT #3# (QVELT |r| 4) . #4#) G190
               (COND
                ((OR (ATOM #3#) (PROGN (LETT |curve| (CAR #3#) . #4#) NIL))
                 #5=(GO G191)))
               (SEQ
                (LETT |xRange|
                      (SPADCALL (SPADCALL (QVELT |curve| 1) 1 (QREFELT $ 83))
                                (QREFELT $ 82))
                      . #4#)
                (LETT |yRange|
                      (SPADCALL (SPADCALL (QVELT |curve| 1) 2 (QREFELT $ 83))
                                (QREFELT $ 82))
                      . #4#)
                (LETT |zRange|
                      (SPADCALL (SPADCALL (QVELT |curve| 1) 3 (QREFELT $ 83))
                                (QREFELT $ 82))
                      . #4#)
                (LETT |l|
                      (LIST |xSymbol| |xRange| |spaces| |ySymbol| |yRange|
                            |spaces| |zSymbol| |zRange|)
                      . #4#)
                (LETT |l|
                      (SPADCALL (LIST |tSymbol| |tRange| |spaces|) |l|
                                (QREFELT $ 85))
                      . #4#)
                (LETT |h| (SPADCALL |l| (QREFELT $ 87)) . #4#)
                (LETT |l|
                      (PROGN
                       (LETT #2# NIL . #4#)
                       (SEQ (LETT |p| NIL . #4#)
                            (LETT #1# (QVELT |curve| 3) . #4#) G190
                            (COND
                             ((OR (ATOM #1#)
                                  (PROGN (LETT |p| (CAR #1#) . #4#) NIL))
                              #5#))
                            (SEQ
                             (EXIT
                              (LETT #2#
                                    (CONS (SPADCALL |p| (QREFELT $ 88)) #2#)
                                    . #4#)))
                            (LETT #1# (CDR #1#) . #4#) #6=(GO G190) G191
                            (EXIT (NREVERSE0 #2#))))
                      . #4#)
                (EXIT
                 (LETT |f| (CONS (SPADCALL (CONS |h| |l|) (QREFELT $ 89)) |f|)
                       . #4#)))
               (LETT #3# (CDR #3#) . #4#) #6# G191 (EXIT NIL))
          (EXIT (SPADCALL "PLOT" (NREVERSE |f|) (QREFELT $ 90))))))) 

(DEFUN |PLOT3D;listBranches;$L;38| (|plot| $)
  (PROG (|outList| #1=#:G1993 |curve|)
    (RETURN
     (SEQ (LETT |outList| NIL . #2=(|PLOT3D;listBranches;$L;38|))
          (SEQ (LETT |curve| NIL . #2#) (LETT #1# (QVELT |plot| 4) . #2#) G190
               (COND
                ((OR (ATOM #1#) (PROGN (LETT |curve| (CAR #1#) . #2#) NIL))
                 (GO G191)))
               (SEQ
                (EXIT
                 (LETT |outList| (CONS (QVELT |curve| 3) |outList|) . #2#)))
               (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT |outList|))))) 

(DEFUN |Plot3D| #1=()
  (PROG #1#
    (RETURN
     (PROG (#2=#:G1995)
       (RETURN
        (COND
         ((LETT #2# (HGET |$ConstructorCache| '|Plot3D|) . #3=(|Plot3D|))
          (|CDRwithIncrement| (CDAR #2#)))
         ('T
          (UNWIND-PROTECT
              (PROG1
                  (CDDAR
                   (HPUT |$ConstructorCache| '|Plot3D|
                         (LIST (CONS NIL (CONS 1 (|Plot3D;|))))))
                (LETT #2# T . #3#))
            (COND ((NOT #2#) (HREM |$ConstructorCache| '|Plot3D|))))))))))) 

(DEFUN |Plot3D;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
     (PROGN
      (LETT |dv$| '(|Plot3D|) . #1=(|Plot3D|))
      (LETT $ (GETREFV 93) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|Plot3D| NIL (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6
                (|Record| (|:| |display| (|List| (|Segment| (|DoubleFloat|))))
                          (|:| |bounds| (|List| (|Segment| (|DoubleFloat|))))
                          (|:| |screenres| (|Integer|))
                          (|:| |axisLabels| (|List| (|String|)))
                          (|:| |functions|
                               (|List|
                                (|Record|
                                 (|:| |source|
                                      (|Mapping| (|Point| (|DoubleFloat|))
                                                 (|DoubleFloat|)))
                                 (|:| |ranges|
                                      (|List| (|Segment| (|DoubleFloat|))))
                                 (|:| |knots| (|List| (|DoubleFloat|)))
                                 (|:| |points|
                                      (|List| (|Point| (|DoubleFloat|)))))))))
      (QSETREFV $ 7 'T)
      (QSETREFV $ 8 49)
      (QSETREFV $ 9 1000)
      (QSETREFV $ 10 0)
      (QSETREFV $ 11 500)
      (QSETREFV $ 14
                (COS
                 (SPADCALL (FLOAT 4 MOST-POSITIVE-DOUBLE-FLOAT)
                           (QREFELT $ 13))))
      (QSETREFV $ 15 'NIL)
      $)))) 

(MAKEPROP '|Plot3D| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL '|Rep| 'ADAPTIVE 'MINPOINTS 'MAXPOINTS
              'NUMFUNEVALS 'SCREENRES (|DoubleFloat|) (0 . |inv|) 'ANGLEBOUND
              'DEBUG (|List| 12) (|Point| 12) (5 . |point|) (|Segment| 12)
              (10 . |hi|) (15 . |lo|) (20 . SEGMENT) (|List| 19)
              (26 . |second|) (31 . |third|) (|Integer|)
              |PLOT3D;minPoints3D;I;8| |PLOT3D;setMinPoints3D;2I;9|
              |PLOT3D;maxPoints3D;I;10| |PLOT3D;setMaxPoints3D;2I;11|
              |PLOT3D;screenResolution3D;I;12|
              |PLOT3D;setScreenResolution3D;2I;13| (|Boolean|)
              |PLOT3D;adaptive3D?;B;14| |PLOT3D;setAdaptive3D;2B;15|
              |PLOT3D;numFunEvals3D;I;16| |PLOT3D;debug3D;2B;17|
              |PLOT3D;xRange;$S;18| |PLOT3D;yRange;$S;19| |PLOT3D;zRange;$S;20|
              |PLOT3D;tRange;$S;21| (|List| 16) |PLOT3D;tValues;$L;22|
              (36 . |second|) '"rest" (41 . |setelt|) (|List| 17)
              (48 . |setelt|) (|PointPackage| 12) (55 . |xCoord|) (60 . |min|)
              (66 . |max|) (72 . |yCoord|) (77 . |zCoord|) (82 . |concat!|)
              (|List| 47) (88 . |concat!|) (94 . |third|) (99 . |second|)
              (104 . |third|) (|PositiveInteger|) (109 . ^) (115 . |sqrt|)
              (|Fraction| 26) (120 . |Zero|) (124 . |list|) (129 . |list|)
              |PLOT3D;zoom;$3S$;27| (134 . |copy|) (139 . |copy|)
              |PLOT3D;refine;$S$;30| |PLOT3D;refine;2$;29| (144 . *)
              |PLOT3D;plot;$S$;31| (|Mapping| 17 12) |PLOT3D;pointPlot;MS$;32|
              |PLOT3D;pointPlot;M4S$;33| (|Mapping| 12 12)
              |PLOT3D;plot;4MS$;35| |PLOT3D;plot;4M4S$;36| (|OutputForm|)
              (150 . |coerce|) (155 . |elt|) (|List| 81) (161 . |concat!|)
              (|List| $) (167 . |hconcat|) (172 . |coerce|) (177 . |vconcat|)
              (182 . |prefix|) |PLOT3D;coerce;$Of;37|
              |PLOT3D;listBranches;$L;38|)
           '#(|zoom| 188 |zRange| 196 |yRange| 201 |xRange| 206 |tValues| 211
              |tRange| 216 |setScreenResolution3D| 221 |setMinPoints3D| 226
              |setMaxPoints3D| 231 |setAdaptive3D| 236 |screenResolution3D| 241
              |refine| 245 |pointPlot| 256 |plot| 271 |numFunEvals3D| 298
              |minPoints3D| 302 |maxPoints3D| 306 |listBranches| 310 |debug3D|
              315 |coerce| 320 |adaptive3D?| 325)
           'NIL
           (CONS (|makeByteWordVec2| 1 '(0 0))
                 (CONS '#(NIL NIL)
                       (CONS
                        '#((|PlottableSpaceCurveCategory|) (|CoercibleTo| 81))
                        (|makeByteWordVec2| 92
                                            '(1 12 0 0 13 1 17 0 16 18 1 19 12
                                              0 20 1 19 12 0 21 2 19 0 12 12 22
                                              1 23 19 0 24 1 23 19 0 25 1 16 12
                                              0 44 3 16 0 0 45 0 46 3 47 0 0 45
                                              0 48 1 49 12 17 50 2 12 0 0 0 51
                                              2 12 0 0 0 52 1 49 12 17 53 1 49
                                              12 17 54 2 42 0 0 16 55 2 56 0 0
                                              47 57 1 16 12 0 58 1 47 17 0 59 1
                                              47 17 0 60 2 12 0 0 61 62 1 12 0
                                              0 63 0 64 0 65 1 16 0 12 66 1 47
                                              0 17 67 1 16 0 0 69 1 47 0 0 70 2
                                              26 0 61 0 73 1 19 81 0 82 2 23 19
                                              0 26 83 2 84 0 0 0 85 1 81 0 86
                                              87 1 17 81 0 88 1 81 0 86 89 2 81
                                              0 0 86 90 4 0 0 0 19 19 19 68 1 0
                                              19 0 40 1 0 19 0 39 1 0 19 0 38 1
                                              0 42 0 43 1 0 19 0 41 1 0 26 26
                                              32 1 0 26 26 28 1 0 26 26 30 1 0
                                              33 33 35 0 0 26 31 1 0 0 0 72 2 0
                                              0 0 19 71 5 0 0 75 19 19 19 19 77
                                              2 0 0 75 19 76 2 0 0 0 19 74 5 0
                                              0 78 78 78 78 19 79 8 0 0 78 78
                                              78 78 19 19 19 19 80 0 0 26 36 0
                                              0 26 27 0 0 26 29 1 0 56 0 92 1 0
                                              33 33 37 1 0 81 0 91 0 0 33
                                              34)))))
           '|lookupComplete|)) 

(MAKEPROP '|Plot3D| 'NILADIC T) 
