From a0dc340fdea79bf41b3ee1ecb110f1a7d43507ee Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Mon, 15 Apr 2019 17:10:24 +0200 Subject: [PATCH] Calculate points --- src/plugins/default/main.scm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/default/main.scm b/src/plugins/default/main.scm index b668684..7a64459 100644 --- a/src/plugins/default/main.scm +++ b/src/plugins/default/main.scm @@ -13,14 +13,21 @@ (build-patches patches)) (define (build-patches patches) - (define* (get-points n #:optional (l '())) + (define* (get-points n seed #:optional (l '())) (cond ((> n 0) - (get-points (- n 1) (cons n l))) + (let* ((a (+ seed (* (sqrt n) 5))) + (r (if (= n 0) + 0 + (+ 10 (* n (+ 2 (random:exp)))))) + (point (list + (* (cos a) r) + (* (sin a) r)))) + (get-points (- n 1) seed (cons point l)))) (else l))) - (let ((sa (* (random:exp) 2 pi)) - (points (get-points (* 8 patches)))) + (let* ((sa (* (random:exp) 2 pi)) + (points (get-points (* 8 patches) sa))) (display points) (newline))) -- 2.39.5