2 Commits b438911568 ... 66d920b8de

Author SHA1 Message Date
  Jason K. MacDuffie 66d920b8de implement circle 6 months ago
  Jason K. MacDuffie 40db935231 fix bug in face! 6 months ago
2 changed files with 9 additions and 4 deletions
  1. 8 3
      simple.sld
  2. 1 1
      turtle3.body.scm

+ 8 - 3
simple.sld

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