Re: [Chicken-users] How to use bezier function in 2d-primitives?
On Oct 25, 2017 4:32 PM, "Kooda"wrote: On Tue, 24 Oct 2017 22:15:47 -0700 Matt Welland 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))) Thanks Kooda! With your fix I was able to draw the beginnings of a primitive boat hull using my little experimental app "a3d". For anyone into 3D printers, Openscad and POVRay, etc. you might find a3d of interest. It attempts to provide a limited way to write your scene or design in scheme and then visualize in POVRay or Openscad and target 3D printers. You can see more a http://www.kiatoa.com/fossils/opensrc/wiki?name=a3d ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] How to use bezier function in 2d-primitives?
On Tue, 24 Oct 2017 22:15:47 -0700 Matt Wellandwrote: > 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
[Chicken-users] How to use bezier function in 2d-primitives?
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 -=- ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users