Ich habe vor kurzem Mittelpunkt Kreis Algorithmus im Schema verwendet, um einen Kreis zu zeichnen, aber es kann nur einen kleinen Kreis mit einem Radius nicht größer als 10 zeichnen, wenn der Radius zunimmt, wird es ein Achteck. Kann mir jemand sagen, wie ich meinen Code korrigieren kann?Zeichnen Kreis in Schema Sprache
(define (Circle x0 y0 r)
(let ((x 0) (y r) (dp (- 1 r)))
(CircleGo dp x0 x y0 y)))
(define (CircleGo dp x0 x y0 y)
(let ((x1 (+ x 1))(y1 (- y 1)))
(let ((dp1 (+ (* 2 x1) 3)) (dp2 (+ (- (* 2 x1) (* 2 y1)) 5)))
(if (<= x y)
(if (< dp 0)
(append (list (+ x0 x)(+ y0 y)
(- x0 x) (+ y0 y)
(+ x0 x) (- y0 y)
(- x0 x) (- y0 y)
(+ x0 y) (+ y0 x)
(- x0 y) (+ y0 x)
(+ x0 y) (- y0 x)
(- x0 y) (- y0 x))
(CircleGo dp1 x0 x1 y0 y))
(append (list (+ x0 x) (+ y0 y)
(- x0 x) (+ y0 y)
(+ x0 x) (- y0 y)
(- x0 x) (- y0 y)
(+ x0 y) (+ y0 x)
(- x0 y) (+ y0 x)
(+ x0 y) (- y0 x)
(- x0 y) (- y0 x))
(CircleGo dp2 x0 x1 y0 y1)))
(list)))))