Closed ampersanda closed 5 years ago
Thanks, that looks cool! But I'm concerned a little by performance: when I run this sketch is starts very fast but as time goes on it slows down. I suspect there is some kind of memory leak. Looking at the code you do a lot of changes to rules
atom inside draw
. Could you explain what those updates do? I feel there is an opportunity to optimize them.
Looked at the code closer. Seems like you are adding a new point to all curves on each invocation of draw
so it's keep growing indefinitely, right? You don't really need to store all the points because they start repeating after some time. Maybe you can calculate that for current [i, j] circle you "completed" the loop and no longer need to add new points?
Oh okay, I'll revised them. Thank you for the suggestion 🙃.
I think I should just subvec
the first point which I added to the atom before redraw it after the angle is more than TWO-PI
Thanks for the quick fix! The updated version feels much faster.
One last thing. The sketch will be shown in size 200x200 so only 2 circles will be displayed and the first 2 circles (2x2) are the most basic. What if instead of using the first 2 circles we randomly selected angle speeds for them? That way each time you refresh small 200x200 sketch you'll get different patterns. Though I'm not sure how to nicely handle bigger case like 500x500 where you current implementation looks neat. Maybe something like number of rows/cols less than certain N (e.g. 4) then angle speed is selected randomly.
What do you think?
That's okay, this is the version of 200x200. http://quil.info/sketches/show/85bf2fd0b0984862a185f097f7598143e213353a557dfb8d3079c309dafd5109, I randomize the speed every run.
500x500 http://quil.info/sketches/show/112bd73f0204acbe7be2c6437a2dfb8e27fe17fe0ed86b248afd376864dc9c2e
Thanks Mochamad! Added the example: http://quil.info/?example=lissajous%20table. I made some changes to the sketch: removed fun-mode as seems like you are updating most of state through atoms anyway and angle can be calculated based on frame-count. Updated function that generates speed to produce unique speeds and be compatible with 500x500. Also added a few comments.
Thank you for the code refactoring (I still figure out how to code better in Clojure) and comments at the sketch codes. I forgot to add explanation about what I code.
http://quil.info/sketches/local/be3b9156d926ba1b15fdc7bfd39d2fad257cf2d0f02b79c24206300662efe8d1