(use srfi-4 parametric-curve) (define my-c (linear-curve 3 '((0 3) (0 4) (1 0)) 0 20)) (define my-scaled-c (scale-curve '(1. 1. 5.) my-c)) (printf "my-c (5) = ~A~%" ((sample-curve my-c) 5)) (printf "my-c (0,5,10,15,20) = ~A~%" ((sample-curve* my-c) (list 0 5 10 15 20))) (printf "my-c bbox = ~A~%" (bbox-curve my-c)) (printf "my-scaled-c (5) = ~A~%" ((sample-curve my-scaled-c) 5)) (printf "my-scaled-c (0,5,10,15,20) = ~A~%" ((sample-curve* my-scaled-c) (list 0 5 10 15 20))) (printf "my-scaled-c bbox = ~A~%" (bbox-curve my-scaled-c)) (assert (every (lambda (x y) (< (abs (- x y)) 1e-15)) ((sample-curve my-c) 5) (list 3. 4. 5.))) (assert (every (lambda (xv yv) (map (lambda (x y) (< (abs (- x y)) 1e-15)) (f64vector->list xv) (f64vector->list yv))) ((sample-curve* my-c) (list 0 5 10 15 20)) (list (f64vector 3.0 3.0 3.0 3.0 3.0) (f64vector 4.0 4.0 4.0 4.0 4.0) (f64vector 0.0 5.0 10.0 15.0 20.0) ))) (assert (every (lambda (x y) (< (abs (- x y)) 1e-15)) ((sample-curve my-scaled-c) 5) (list 3. 4. 25.))) (assert (every (lambda (xv yv) (map (lambda (x y) (< (abs (- x y)) 1e-15)) (f64vector->list xv) (f64vector->list yv))) ((sample-curve* my-scaled-c) (list 0 5 10 15 20)) (list (f64vector 3.0 3.0 3.0 3.0 3.0) (f64vector 4.0 4.0 4.0 4.0 4.0) (f64vector 0.0 25.0 50.0 75.0 100.0) ))) (printf "my-scaled-c = ~A~%" my-scaled-c) (printf "iterate my-scaled-c = ~A~%" (iterate-curve my-scaled-c 5)) (define s (line-segment 3 (list 1 2 3))) (printf "line segment = ~A~%" s) (define ts (translate-curve (list 4 5 6) s)) (printf "translated line segment = ~A~%" ts) (printf "iterate translated line segment = ~A~%" (iterate-curve ts 5))