farbfetzen / epicycles Goto Github PK
View Code? Open in Web Editor NEWLike a spirograph but more awesome
License: MIT License
Like a spirograph but more awesome
License: MIT License
At the moment it is only possible to input a file containing the path. But it should also be possible to input a file containing the harmonics.
Modify the command line arguments to also accept this. Maybe define a flag that controls wether the file contains a path or a list of harmonics. Obviously skip the transformation in this case. Remove the example harmonics from the script and store them in a file.
That shouldn't happen if I use the results from a fft. If this is a problem then just don't bother resetting t because it won't grow that big anyway.
Oh and name t something else, maybe "angle" or "phi".
pygame.draw.aaline()
doesn't seem to work well with colored lines. The blending makes them dark. But maybe with black it's ok? Also anti alias the circle line and the circles themselves if possible. Try pygame.gfxdraw
. See which is faster and use the fastest version for lines and circles smaller than a threshold.
I have two lists for the points. Can i simplify that into one list?
If the distance between the last point and the new point is greater than some limit (maybe 3 pixels?) then interpolate the timestep. Maybe cut the last dt in half to get a point in between. If that is too far away from the first point then repeat until the distances between all points are small enough.
This way where would be no need to manipulate the framerate for different kinds of shapes.
At the moment the fading only works with a white background. Make it work regardless of the color. I should learn more about the pygame blit flags.
Change License to MIT and remove the GPL header from all files.
numpy.fft.fft()
to calculate the discrete fourier transform, like I do in the p5.js-sketch. That would be simpler and better than using numpy.fft.ifft()
because I get the radii and phases directly.Epicycles.get_point_at_angle()
. Maybe extract radius, phase and frequency once and then work only with that. Look at how I did the function in the p5.js-sketch to avoid creating possibly hundreds of unnecessary vectors.proper structure
functions
lots of comments explaining the math
etc.
Don't save the images to file while the circles are running! Save them into a list and create the files afterwards. Use a gif framerate that is separate from the pygame animation so only the necessary frames get saved. Maybe default to 20 fps since it's a nice fraction of 60? And Don't count frames, use dt instead.
Reset circles to initial position.
Remove what's not necessary anymore. Keep the paths and/or remake them to scale.
Either take the points in the order they are provided or try to optimize the path on the press of a button.
Optimization includes finding the shortest route and/or filling in gaps between adjacent points.
Looks like the bug with aalines are now fixed in Pygame. Try to use those so it is no longer necessary to use a scaled surface.
Randomly generated pictures:
make it so the user can enter the filename of a ruleset and watch the program draw it
Circles should draw the shape at the original position.
Probably caused by centering the points. Try to keep the offset.
Formula for hearts found in this video: https://www.youtube.com/watch?v=oUBAi9xQ2X4
x = 16 sin(t)^3
y = 13 cos(t) - 5 cos(2 t) - 2 cos(3t) - cos(4 t)
Make the epicycles class separate from the main loop and setup stuff.
Continuation but slightly different issue from #12.
Idea: blit a semitransparent layer over line_surface before drawing the next line segment. The transparency should be so that after an angle of 2 pi the first line segment has become invisible.
Make this effect optional via command line argument.
Important: The transparency must change if the angular speed changes because then there will be a different number of frames per cycle.
Siehe das Beispiel im privaten Repo.
This might be inefficient but can work. See for example this post on reddit: https://www.reddit.com/r/Python/comments/gvnyx5/finished_a_program_that_draws_images_with/fspwvno
Also these:
Make a gui using pygame_gui. Keep the command line arguments.
This is quite ambituous and will be a good learning experience.
python epicycles.py paths/heart.txt -s 1
Notice that the tip if the heart goes off screen. A scale factor of 1 should ensure that the shape fits completely inside the window.
Record the points, then fft them. See https://www.youtube.com/watch?v=n9nfTxp_APM for inspiration.
Add dark mode key and command line argument. Remember to document in readme.
Looks like pygame will get better typing support in the next version.
The program should detect the display size and scale the window accordingly.
Additionally, set the default value for scale_factor to 0.75 or something.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.