2 Commity b438911568 ... 66d920b8de

Autor SHA1 Wiadomość Data
  Jason K. MacDuffie 66d920b8de implement circle 6 miesięcy temu
  Jason K. MacDuffie 40db935231 fix bug in face! 6 miesięcy temu
2 zmienionych plików z 9 dodań i 4 usunięć
  1. 8 3
      simple.sld
  2. 1 1
      turtle3.body.scm

+ 8 - 3
simple.sld

@@ -3,6 +3,7 @@
   (import (turtle turtle3)
   (import (turtle turtle3)
           (turtle vector)
           (turtle vector)
           (scheme case-lambda)
           (scheme case-lambda)
+          (only (scheme inexact) acos)
           (scheme base))
           (scheme base))
   (export forward back right left up down
   (export forward back right left up down
           fd bk rt lt pu pd
           fd bk rt lt pu pd
@@ -11,7 +12,7 @@
           show hide draw-line home reset-tilt
           show hide draw-line home reset-tilt
           repeat xcor ycor setx sety
           repeat xcor ycor setx sety
           clear-screen max-recur face
           clear-screen max-recur face
-          distance angle)
+          distance angle circle)
   (begin
   (begin
     (define current-tilt 0)
     (define current-tilt 0)
     (define (tilt)
     (define (tilt)
@@ -85,5 +86,9 @@
     (define (angle A B C)
     (define (angle A B C)
       (radians->degrees
       (radians->degrees
        (vector-angle (vector-difference B A)
        (vector-angle (vector-difference B A)
-                     (vector-difference B C))))))
-    
+                     (vector-difference B C))))
+    (define (circle r)
+      (define pi (* 2 (acos 0)))
+      (repeat (40)
+        (fd (* 2 pi r 1/40))
+        (rt 9)))))

+ 1 - 1
turtle3.body.scm

@@ -219,7 +219,7 @@
   (define U (list-ref old-orient 2))
   (define U (list-ref old-orient 2))
   (define new-L (vector-cross-product U new-H))
   (define new-L (vector-cross-product U new-H))
 
 
-  (define new-orient (list new-H U new-L))
+  (define new-orient (list new-H new-L U))
 
 
   (apply set-orient! t new-orient))
   (apply set-orient! t new-orient))