robbielyman / seamstress

seamstress is an art engine
GNU General Public License v3.0
123 stars 12 forks source link

WIP `screen.curve` #60

Closed p3r7 closed 1 year ago

p3r7 commented 1 year ago

i'm new to zig! i'm sure this is full of beginner mistakes!

this implem works but is unoptimized.

it is based on https://www.geeksforgeeks.org/cubic-bezier-curve-implementation-in-c/.

the most "naive" part is that it systematically registers 1000 points to draw the curve. i've heard of formulas to pre-compute the number of points to draw the curve so that only that many points are used.

robbielyman commented 1 year ago

I don't mind 1000, to be honest. I took the liberty of changing from ArrayList to just a regular slice, since we're working with just 1000 points, no need to dynamically allocate.

aaaaaaand I totally screwed up git history smh. thanks very much for this!!