Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (23 sloc) 548 Bytes
#lang racket
Draw a fractal tree
- Make the branches join up!
(require 2htdp/image)
(define BRANCH-COLOUR "white")
(define MIN-SIZE 5)
(define DS 0.7)
(define DA 30)
(define (tree size angle)
(if (> size MIN-SIZE)
(let* ([a (degrees->radians angle)]
[x (* (cos a) size)]
[y (* (sin a) size)])
(tree (* size DS) (- angle DA))
(tree (* size DS) (+ angle DA)))
(line x y BRANCH-COLOUR)))
(empty-scene 0 0 "black")))
;; (tree 50 90)
You can’t perform that action at this time.