2024-06-11 21:37:04 +00:00
|
|
|
& koch curve
|
|
|
|
|
|
|
|
let length = 10
|
2024-06-11 21:55:57 +00:00
|
|
|
let angle = 0.25
|
2024-06-11 21:37:04 +00:00
|
|
|
|
|
|
|
fn koch! {
|
|
|
|
(0) -> fd! (length)
|
|
|
|
(n) -> {
|
|
|
|
koch! (dec (n))
|
2024-06-11 21:55:57 +00:00
|
|
|
lt! (angle)
|
2024-06-11 21:37:04 +00:00
|
|
|
koch! (dec (n))
|
2024-06-11 21:55:57 +00:00
|
|
|
rt! (angle)
|
2024-06-11 21:37:04 +00:00
|
|
|
koch! (dec (n))
|
2024-06-11 21:55:57 +00:00
|
|
|
rt! (angle)
|
2024-06-11 21:37:04 +00:00
|
|
|
koch! (dec (n))
|
2024-06-11 21:55:57 +00:00
|
|
|
lt! (angle)
|
2024-06-11 21:37:04 +00:00
|
|
|
koch! (dec (n))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
& koch! (3)
|