Thank you, I just implemented a UCBLogo compatible `arc`:
(define (arc angle radius)
  (let* ([alpha (* 2 (asin (/ 1 (* 2 radius))))]
         [rangle (* pi (/ angle 180))]
         [n (abs (/ rangle alpha))]
         [astep (if (> angle 0) (- alpha) alpha)])
    (tprompt
     (move radius)
     (turn (if (> angle 0) -90 90))
     (for ([i (in-range n)])
       (draw 1)
       (turn/radians astep)))
    (turn (- angle))))



Greetings.

Killian Zhuo (KDr2, https://kdr2.com)





 
 
 On Tuesday, February 2, 2021, 11:32:59 AM GMT+8, making-a-racket 
<[email protected]> wrote: 





Turtles can only turn or move forward with or without drawing. To draw an arc, 
you'll need to combine these methods to do that.

I highly recommend the book Turtle Geometry by Abelson and diSessa. Below you 
can find an excerpt of the book that talks about drawing circles and arcs.



Here's an implementation of a circle in Racket using the turtle library you 
referenced.

#lang racket

(require graphics/turtles)

(turtles #t)

(for ([i (in-range 360)])
  (draw 1)
  (turn 1))

On Monday, February 1, 2021 at 5:54:05 PM UTC-6 [email protected] wrote:
> I am imitating the Logo API to draw some shapes with `graphics/turtles`, but 
> in it I only find functions to draw lines, is there a way to draw an arc? 
> 
> 
> 
> Greetings. 
> 
> Killian Zhuo (KDr2, https://kdr2.com) 


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/aea4ad53-162e-4924-87ed-1e7311c2aef3n%40googlegroups.com.


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/625594723.1001568.1612254850718%40mail.yahoo.com.

Reply via email to