Skip to content

Latest commit

 

History

History
145 lines (118 loc) · 3.85 KB

README.md

File metadata and controls

145 lines (118 loc) · 3.85 KB

Fourier Transform (Epicycles)

Transform an image or a polygon into a series of rotating circles.
This project is written from scratch and it looks like a spin off from the videos because that was the aim, not because the code was copied (trust me if I could have, it would have saved me a ton of effort).
Inspired by this video and a challenge from a friend.

Maths

See details of the maths explained in this video.

Examples

Images

Handshake

Handshake

Skyline

Skyline

Runner

Runner

Bird

Bird

SVG Files

Pi Creature

Pi Creature

GitHub Logo

GitHub Logo

Heart

Heart

Star

Pi Creature

Polygons

Traingle

Triangle

Hexagon

Hexagon

Text

Word 'Guru'

Word 'Guru'

Letter 'G'

Letter 'G'

Points

Treble Clef

Treble Clef

Installation

Requires python >= 3.10
The rendering uses Manim Community (the community version of the software in the 3Blue1Brown videos but you don't need to install $\LaTeX$.

pip install -r requirements.txt

Usage

Transform an image (.svg) or a polygon into a series of rotating circles

usage: main.py [-h] [-o OUTPUT] [-p] [-n NUMBER] [-r ROTATIONS] [-d DURATION] [-f FADE] {vector,image,polygon} ...

Transform an image or a polygon into a series of rotating circles

options:
  -h, --help            show this help message and exit

Input Options:
  Select different input formats

  {vector,image,polygon}
    vector              transform an SVG file
    image               transform an image file
    polygon             transform a polygon
    text                transform text
    array               transform a numpy array of points (1D array of complex numbers x + iy)

Output Options:
  -o OUTPUT, --output OUTPUT, --output_file OUTPUT
                        output file (default: output.mp4)
  -p, --preview         preview when complete

Animation Options:
  -n NUMBER, --number NUMBER
                        number of circles (default: 50)
  -r ROTATIONS, --rotations ROTATIONS
                        number of complete rotations (default: 3)
  -d DURATION, --duration DURATION
                        number of seconds for each rotation (default: 10)
  -f FADE, --fade FADE  rate of exponential decay of path - higher means faster decay (default: 0.005)

Images

usage: main.py image [-h] IMAGE

image

positional arguments:
  IMAGE       image file

options:
  -h, --help  show this help message and exit

Vector Graphics

usage: main.py vector [-h] VECTOR

vector

positional arguments:
  VECTOR      SVG file

options:
  -h, --help  show this help message and exit

Polygon

usage: main.py polygon [-h] SIDES

polygon

positional arguments:
  SIDES       number of sides

options:
  -h, --help  show this help message and exit

Text

usage: main.py text [-h] [--font FONT] TEXT

text

positional arguments:
  TEXT         text

options:
  -h, --help   show this help message and exit
  --font FONT  specify text font (default: examples/fonts/georgia.ttf)

Array

usage: main.py array [-h] ARRAY

array

positional arguments:
  ARRAY       NPY file

options:
  -h, --help  show this help message and exit