Irgo is a fun and visually captivating Go program that generates beautiful visualizations of irrational numbers using angles and line drawings. It uses Ebiten, a powerful game library in Go, to render animated and interactive line plots.
Given a file containing a long string of digits (typically from an irrational number like π or φ), Irgo:
- Reads the digits in chunks of three (e.g., "123", "456", "789", ...).
- Draws a line with an angle corresponding to the current 3-digit number.
- Adds the previous angle to the current one to keep turning the drawing.
- Repeats this process until it runs out of digits.
- Renders the result as a continuously turning polyline that shows the “shape” of the number.
The result is a mesmerizing, abstract pattern unique to each number.
Here are a few visualizations generated using the digits of the golden ratio:
- Go 1.18 or later
- A file with a long string of digits in the range
[0-9]
(included innums/
)
If you're new to Ebiten, install it via:
go get github.com/hajimehoshi/ebiten/v2
Ebiten may require more steps to work. Visit their official installation guide for help.
go run cmd/irgo/main.go <path-to-digit-file>
Example:
go run cmd/irgo/main.go nums/phi-100k.txt
This will open an interactive window where the visualization is drawn in real time.
- Zoom In:
+
key - Zoom Out:
-
key - Pan: Click and drag with the mouse
irgo/
├── cmd/irgo/ # Main entrypoint
├── pkg/ # Core logic and rendering
├── nums/ # Sample digit files (e.g. pi, phi)
├── showcase/ # Example output images
├── go.mod / go.sum # Module definitions
Irrational numbers like π, φ, and √2, by definition, never end and never repeat. This makes them perfect for generating infinite, non-repeating visual patterns.
MIT License. See the LICENSE file for more details.