
(/VERSIONCHECK 2) 

(DEFUN |DRAWCURV;drawToScaleRanges| (|xVals| |yVals| $)
  (PROG (|pad| |yDiff| |xDiff| |yLo| |yHi| |xLo| |xHi|)
    (RETURN
     (SEQ
      (LETT |xHi| (SPADCALL |xVals| (QREFELT $ 10))
            . #1=(|DRAWCURV;drawToScaleRanges|))
      (LETT |xLo| (SPADCALL |xVals| (QREFELT $ 11)) . #1#)
      (LETT |yHi| (SPADCALL |yVals| (QREFELT $ 10)) . #1#)
      (LETT |yLo| (SPADCALL |yVals| (QREFELT $ 11)) . #1#)
      (LETT |xDiff| (SPADCALL |xHi| |xLo| (QREFELT $ 12)) . #1#)
      (LETT |yDiff| (SPADCALL |yHi| |yLo| (QREFELT $ 12)) . #1#)
      (LETT |pad|
            (SPADCALL
             (SPADCALL (SPADCALL |yDiff| |xDiff| (QREFELT $ 12))
                       (QREFELT $ 13))
             2 (QREFELT $ 15))
            . #1#)
      (EXIT
       (COND
        ((SPADCALL |xDiff| |yDiff| (QREFELT $ 17))
         (LIST
          (SPADCALL (SPADCALL |xLo| |pad| (QREFELT $ 12))
                    (SPADCALL |xHi| |pad| (QREFELT $ 18)) (QREFELT $ 19))
          |yVals|))
        ('T
         (LIST |xVals|
               (SPADCALL (SPADCALL |yLo| |pad| (QREFELT $ 12))
                         (SPADCALL |yHi| |pad| (QREFELT $ 18))
                         (QREFELT $ 19)))))))))) 

(DEFUN |DRAWCURV;intConvert| (|r| $)
  (PROG (|nn|)
    (RETURN
     (SEQ (LETT |nn| (SPADCALL |r| (QREFELT $ 21)) |DRAWCURV;intConvert|)
          (EXIT
           (COND
            ((QEQCAR |nn| 1)
             (|error| "draw: polynomial must have rational coefficients"))
            ('T (QCDR |nn|)))))))) 

(DEFUN |DRAWCURV;polyEquation| (|eq| $)
  (PROG (|rat| |r| |ff|)
    (RETURN
     (SEQ
      (LETT |ff|
            (SPADCALL (SPADCALL |eq| (QREFELT $ 23))
                      (SPADCALL |eq| (QREFELT $ 24)) (QREFELT $ 25))
            . #1=(|DRAWCURV;polyEquation|))
      (LETT |r| (SPADCALL |ff| (QREFELT $ 27)) . #1#)
      (EXIT
       (COND ((QEQCAR |r| 1) (|error| "draw: not a polynomial equation"))
             (#2='T
              (SEQ (LETT |rat| (QCDR |r|) . #1#)
                   (EXIT
                    (COND
                     ((QEQCAR
                       (SPADCALL (SPADCALL |rat| (QREFELT $ 30))
                                 (QREFELT $ 32))
                       1)
                      (|error| "draw: non-constant denominator"))
                     (#2#
                      (SPADCALL (CONS (|function| |DRAWCURV;intConvert|) $)
                                (SPADCALL |rat| (QREFELT $ 33))
                                (QREFELT $ 37))))))))))))) 

(DEFUN |DRAWCURV;draw;E2SLTdv;4| (|eq| |x| |y| |l| $)
  (PROG (|crCol| |ptCol| |scaledRanges| |acplot| |floatRanges| |yRangeFloat|
         |xRangeFloat| |yRange| |xRange| |ranges| #1=#:G696 |ratRange|
         |floatRange| |p|)
    (RETURN
     (SEQ
      (LETT |p| (|DRAWCURV;polyEquation| |eq| $)
            . #2=(|DRAWCURV;draw;E2SLTdv;4|))
      (LETT |floatRange|
            (SPADCALL |l| (SPADCALL "rangeFloat" (QREFELT $ 40))
                      (QREFELT $ 44))
            . #2#)
      (LETT |ratRange|
            (SPADCALL |l| (SPADCALL "rangeRat" (QREFELT $ 40)) (QREFELT $ 44))
            . #2#)
      (COND
       ((QEQCAR |floatRange| 1)
        (COND
         ((QEQCAR |ratRange| 1)
          (EXIT
           (|error| "draw: you must specify ranges for an implicit plot"))))))
      (LETT |ranges| NIL . #2#) (LETT |floatRanges| NIL . #2#)
      (LETT |xRange|
            (SPADCALL (|spadConstant| $ 48) (|spadConstant| $ 48)
                      (QREFELT $ 50))
            . #2#)
      (LETT |yRange|
            (SPADCALL (|spadConstant| $ 48) (|spadConstant| $ 48)
                      (QREFELT $ 50))
            . #2#)
      (LETT |xRangeFloat|
            (SPADCALL (|spadConstant| $ 51) (|spadConstant| $ 51)
                      (QREFELT $ 19))
            . #2#)
      (LETT |yRangeFloat|
            (SPADCALL (|spadConstant| $ 51) (|spadConstant| $ 51)
                      (QREFELT $ 19))
            . #2#)
      (COND
       ((QEQCAR |ratRange| 1)
        (SEQ
         (LETT |floatRanges|
               (SPADCALL
                (PROG2
                    (LETT #1# |floatRange| . #2#)
                    (QCDR #1#)
                  (|check-union| (QEQCAR #1# 0) (|Any|) #1#))
                (QREFELT $ 55))
               . #2#)
         (COND
          ((NULL (SPADCALL |floatRanges| 2 (QREFELT $ 57)))
           (EXIT (|error| "draw: you must specify two ranges"))))
         (LETT |xRangeFloat| (|SPADfirst| |floatRanges|) . #2#)
         (LETT |yRangeFloat| (SPADCALL |floatRanges| (QREFELT $ 58)) . #2#)
         (LETT |xRange| (SPADCALL (ELT $ 59) |xRangeFloat| (QREFELT $ 62))
               . #2#)
         (LETT |yRange| (SPADCALL (ELT $ 59) |yRangeFloat| (QREFELT $ 62))
               . #2#)
         (EXIT (LETT |ranges| (LIST |xRange| |yRange|) . #2#))))
       (#3='T
        (SEQ (LETT |ranges| (SPADCALL (QCDR |ratRange|) (QREFELT $ 65)) . #2#)
             (COND
              ((NULL (SPADCALL |ranges| 2 (QREFELT $ 66)))
               (EXIT (|error| "draw: you must specify two ranges"))))
             (LETT |xRange| (|SPADfirst| |ranges|) . #2#)
             (LETT |yRange| (SPADCALL |ranges| (QREFELT $ 67)) . #2#)
             (LETT |xRangeFloat| (SPADCALL (ELT $ 68) |xRange| (QREFELT $ 71))
                   . #2#)
             (LETT |yRangeFloat| (SPADCALL (ELT $ 68) |yRange| (QREFELT $ 71))
                   . #2#)
             (EXIT
              (LETT |floatRanges| (LIST |xRangeFloat| |yRangeFloat|) . #2#)))))
      (LETT |acplot| (SPADCALL |p| |x| |y| |xRange| |yRange| (QREFELT $ 73))
            . #2#)
      (COND
       ((SPADCALL |l| (SPADCALL (QREFELT $ 75)) (QREFELT $ 78))
        (SEQ
         (LETT |scaledRanges|
               (|DRAWCURV;drawToScaleRanges| |xRangeFloat| |yRangeFloat| $)
               . #2#)
         (EXIT
          (LETT |l| (CONS (SPADCALL |scaledRanges| (QREFELT $ 79)) |l|)
                . #2#))))
       (#3#
        (LETT |l| (CONS (SPADCALL |floatRanges| (QREFELT $ 79)) |l|) . #2#)))
      (LETT |ptCol| (SPADCALL |l| (SPADCALL (QREFELT $ 82)) (QREFELT $ 83))
            . #2#)
      (LETT |crCol| (SPADCALL |l| (SPADCALL (QREFELT $ 84)) (QREFELT $ 85))
            . #2#)
      (EXIT
       (SPADCALL (SPADCALL |acplot| (QREFELT $ 87)) |ptCol| |crCol|
                 (SPADCALL (QREFELT $ 89)) |l| (QREFELT $ 92))))))) 

(DEFUN |TopLevelDrawFunctionsForAlgebraicCurves| (&REST #1=#:G708)
  (PROG ()
    (RETURN
     (PROG (#2=#:G709)
       (RETURN
        (COND
         ((LETT #2#
                (|lassocShiftWithFunction| (|devaluateList| #1#)
                                           (HGET |$ConstructorCache|
                                                 '|TopLevelDrawFunctionsForAlgebraicCurves|)
                                           '|domainEqualList|)
                . #3=(|TopLevelDrawFunctionsForAlgebraicCurves|))
          (|CDRwithIncrement| #2#))
         ('T
          (UNWIND-PROTECT
              (PROG1
                  (APPLY
                   (|function| |TopLevelDrawFunctionsForAlgebraicCurves;|) #1#)
                (LETT #2# T . #3#))
            (COND
             ((NOT #2#)
              (HREM |$ConstructorCache|
                    '|TopLevelDrawFunctionsForAlgebraicCurves|))))))))))) 

(DEFUN |TopLevelDrawFunctionsForAlgebraicCurves;| (|#1| |#2|)
  (PROG (|pv$| $ |dv$| DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|)
            . #1=(|TopLevelDrawFunctionsForAlgebraicCurves|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT |dv$| (LIST '|TopLevelDrawFunctionsForAlgebraicCurves| DV$1 DV$2)
            . #1#)
      (LETT $ (GETREFV 94) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache|
                  '|TopLevelDrawFunctionsForAlgebraicCurves| (LIST DV$1 DV$2)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      $)))) 

(MAKEPROP '|TopLevelDrawFunctionsForAlgebraicCurves| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|) (|Float|)
              (|Segment| 8) (0 . |hi|) (5 . |lo|) (10 . -) (16 . |abs|)
              (|Integer|) (21 . /) (|Boolean|) (27 . <) (33 . +)
              (39 . |segment|) (|Union| 14 '#1="failed") (45 . |retractIfCan|)
              (|Equation| 7) (50 . |lhs|) (55 . |rhs|) (60 . -)
              (|Union| 29 '#1#) (66 . |retractIfCan|) (|Polynomial| 6)
              (|Fraction| 28) (71 . |denom|) (|Union| 6 '#1#)
              (76 . |retractIfCan|) (81 . |numer|) (|Polynomial| 14)
              (|Mapping| 14 6) (|PolynomialFunctions2| 6 14) (86 . |map|)
              (|String|) (|Symbol|) (92 . |coerce|) (|Union| 53 '"failed")
              (|List| $) (|DrawOption|) (97 . |option|) (103 . |Zero|)
              (107 . |Zero|) (|Fraction| 14) (111 . |Zero|) (|Segment| 47)
              (115 . |segment|) (121 . |Zero|) (|List| 9) (|Any|)
              (|AnyFunctions1| 52) (125 . |retract|) (|NonNegativeInteger|)
              (130 . |size?|) (136 . |second|) (141 . |retract|)
              (|Mapping| 47 8) (|SegmentFunctions2| 8 47) (146 . |map|)
              (|List| 49) (|AnyFunctions1| 63) (152 . |retract|)
              (157 . |size?|) (163 . |second|) (168 . |convert|)
              (|Mapping| 8 47) (|SegmentFunctions2| 47 8) (173 . |map|)
              (|PlaneAlgebraicCurvePlot|) (179 . |makeSketch|)
              (|GraphicsDefaults|) (188 . |drawToScale|) (|List| 43)
              (|DrawOptionFunctions0|) (192 . |toScale|) (198 . |ranges|)
              (|Palette|) (|ViewDefaultsPackage|) (203 . |pointColorDefault|)
              (207 . |pointColorPalette|) (213 . |lineColorDefault|)
              (217 . |curveColorPalette|)
              (|List| (|List| (|Point| (|DoubleFloat|))))
              (223 . |listBranches|) (|PositiveInteger|)
              (228 . |pointSizeDefault|) (|TwoDimensionalViewport|)
              (|ViewportPackage|) (232 . |drawCurves|)
              |DRAWCURV;draw;E2SLTdv;4|)
           '#(|draw| 241) 'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 93
                                                 '(1 9 8 0 10 1 9 8 0 11 2 8 0
                                                   0 0 12 1 8 0 0 13 2 8 0 0 14
                                                   15 2 8 16 0 0 17 2 8 0 0 0
                                                   18 2 9 0 8 8 19 1 6 20 0 21
                                                   1 22 7 0 23 1 22 7 0 24 2 7
                                                   0 0 0 25 1 7 26 0 27 1 29 28
                                                   0 30 1 28 31 0 32 1 29 28 0
                                                   33 2 36 34 35 28 37 1 39 0
                                                   38 40 2 43 41 42 39 44 0 6 0
                                                   45 0 7 0 46 0 47 0 48 2 49 0
                                                   47 47 50 0 8 0 51 1 54 52 53
                                                   55 2 52 16 0 56 57 1 52 9 0
                                                   58 1 8 47 0 59 2 61 49 60 9
                                                   62 1 64 63 53 65 2 63 16 0
                                                   56 66 1 63 49 0 67 1 47 8 0
                                                   68 2 70 9 69 49 71 5 72 0 34
                                                   39 39 49 49 73 0 74 16 75 2
                                                   77 16 76 16 78 1 43 0 52 79
                                                   0 81 80 82 2 77 80 76 80 83
                                                   0 81 80 84 2 77 80 76 80 85
                                                   1 72 86 0 87 0 81 88 89 5 91
                                                   90 86 80 80 88 76 92 4 0 90
                                                   22 39 39 76 93)))))
           '|lookupComplete|)) 
