On Tue, 24 Oct 2017 22:15:47 -0700 Matt Welland
<mattrwell...@gmail.com> wrote:
> I tried this:
> 
> (use 2d-primitives)
> (with-output-to-file "test.csv"
>   (lambda ()
>     (for-each
>        (lambda (v)
>           (print (f32vector-ref v 0)","(f32vector-ref v 1)))
>     (bezier->vects (bezier:create (vect:create 0 0)(vect:create 2
> 5)(vect:create 7 5)(vect:create 10 0) 10))))
> 
> Then load test.csv into gnumeric and graph it and I see two straight
> line segments. Either I'm not correctly understanding how to use
> bezier or there is a bug.
> 
> Thanks,
> 
> Matt
> -=-

Looks like the 2d-primitives egg has a bug indeed! I’ll open a ticket.

Here is a version of bezier->vects that does what you expect. I hope
this will help!

(define (bezier->vects* b n)
  (let ((increment (/ 1 n)))
    (let loop ((step 0))
      (if (>= step 1)
          (list (bezier:ref b 1))
          (cons (bezier:ref b step)
                (loop (+ step increment)))))))

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to