Skip to content

Commit

Permalink
Support arcs in (lispkit draw turtle).
Browse files Browse the repository at this point in the history
  • Loading branch information
objecthub committed Nov 26, 2023
1 parent 33c6223 commit c9d5ca8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Sources/LispKit/Resources/Libraries/lispkit/draw/turtle.sld
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@
left
right
forward
backward)
backward
arc)

(import (lispkit base)
(lispkit draw))
(rename (lispkit draw) (arc arcshape)))

(begin

Expand Down Expand Up @@ -134,6 +135,17 @@
(let-optionals args ((turtle (current-turtle)))
(forward (- len) turtle)))

(define (arc degrees radius . args)
(let-optionals args ((turtle (current-turtle)))
(if (turtle-pen-down? turtle)
(with-drawing (turtle-drawing turtle)
(draw (arcshape (point (turtle-x turtle) (turtle-y turtle))
radius
(turtle-angle turtle)
(+ (radian degrees) (turtle-angle turtle))
(> degrees 0)))))
(turn degrees turtle)))

(define (radian angle)
(inexact (/ (* angle pi) 180.0)))
)
Expand Down
2 changes: 1 addition & 1 deletion Sources/LispKitRepl/AppInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public struct AppInfo {
public static let buildDate = { () -> String in
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
return dateFormatter.string(from: Date(timeIntervalSince1970: 1700961329))
return dateFormatter.string(from: Date(timeIntervalSince1970: 1701005297))
}()
public static let buildAnnotation = " (\(AppInfo.buildDate))"
}

0 comments on commit c9d5ca8

Please sign in to comment.