GithubHelp home page GithubHelp logo

epicycles's People

Contributors

farbfetzen avatar

Watchers

 avatar

epicycles's Issues

Improve readme

  • Better explanation with links to videos
  • New gif with heart (keep filesize minimal), use lfs
  • How to use (command line arguments and keybindings)

GUI

Make a gui using pygame_gui. Keep the command line arguments.
This is quite ambituous and will be a good learning experience.

  • Dropdown list for choosing the shape file.
  • Start/pause button.
  • Increase/decrease speed.
  • Toggle color fading.
  • Toggle circle visibility.
  • Toggle drawing mode (lets the user draw on the screen and then uses that for the transformation).
  • Change scale factor.
  • Make window resizable.
  • Change number of harmonics.
  • Flip direction.
  • Erase path
  • Save screenshot.
  • Change colors (background, path, circles)

mypy

Looks like pygame will get better typing support in the next version.

Cleanup

proper structure
functions
lots of comments explaining the math
etc.

get shape from image

  1. Load a black and white image.
  2. Generate a set of the coordinates of all pixels of a certain color.
  3. Pick a random pixel from the set as the start of the path.
  4. Generate the path by going to the next closest pixel which has not yet been visited.

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:

Find a way to make the line smoother

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.

Draw: optionally optimize path

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.

meta: refactor

  • Better file structure, put all R stuff in subfolder, create src folder, call the main file in the top directory "epicycles.py".
  • Improve readme #15
  • Change how drawing works, no more transparency, line points as a fifo queue. #21 and #18.
  • Create a state machine to make later changes easier
  • Create a debug overlay showing fps, angle in rad and degrees, angular velocity in rad/s and °/s. Remove the print output.

aalines

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.

dark mode

Add dark mode key and command line argument. Remember to document in readme.

Improve code with insights learned from the p5.js-sketch

  • I should use 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.
  • Opimize the 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.

License

Change License to MIT and remove the GPL header from all files.

refactor

Make the epicycles class separate from the main loop and setup stuff.

Fade the line over time

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.

Interpolate points/angles

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.

Clean the R stuff

Remove what's not necessary anymore. Keep the paths and/or remake them to scale.

Make it easier to use

  • ability to read in shapes, then fft them and save the fft
  • remove unecessary components from fft where the radius is 0
    - [ ] read in fft and run the circles
  • read command line arguments

Random generation

Randomly generated pictures:

  1. make some circles
  2. let them run for a while
  3. save the picture (the generated line without the circles)
  4. save the circle attributes in a text file
  5. name the picture and the text file with the same id

make it so the user can enter the filename of a ruleset and watch the program draw it

Allow input of harmonic file

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.

Better gif making

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.

Window is too big on small monitors

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.