thobbs / genartlib

Utilities for creating generative artwork with Clojure
MIT License
217 stars 20 forks source link

Interpolate exp tanh #11

Closed verberktstan closed 5 months ago

verberktstan commented 1 year ago

Ok so i'm just making cool stuff for my own art projects. And I'd like to share this with you!

I've extended algebra/interpolate to accept some curve coefficients as optional arg. Besides linear interpolation, there's also exponential, tanh and s-curve interpolation.

You can supply a curve to your interpolation like this:

(algebra/interpolate {:exponent 2} 0 1 0.5) ~= 0.4667
(algebra/interpolate {:tanh-factor -0.5} 0 1 0.5) ~= 0.755

I've added tests for clarity...

verberktstan commented 1 year ago

@thobbs I hope you have time to review this. I'd say this is a nice addition to your great lib!

verberktstan commented 11 months ago

@thobbs if you don't fancy me opening PR's, please let me know. That's ok. Greetings from The Netherlands. Keep up the great work!