recursive-geometry icon indicating copy to clipboard operation
recursive-geometry copied to clipboard

A program that generates geometry and recursively subdivides it into triangles, written in Rust

Recursive Geometry

This program generates geometry and recursively subdivides it into triangles. It doesn't really do anything useful, it just looks pretty. Run it on a big screen, use it as screen saver, do whatever you want.

It's written in Rust and uses the glium library for drawing to the screen.

Right now the subdivision process is a little slow, I tried parallelizing it to no avail. See this function, let me know if you have ideas on how to speed it up.

Demonstration

Here's what it looks like starting with a triangle and a hexagon:

Here's a video of it in action.

Controls

Key Action
Esc Quit
Space Generate new geometry based on the current one
1 Generate a single triangle
2 Generate a square consisting of two triangles
3-9 Generate a regular polygon with the given amount of edges, in the form of a triangle fan

Running

Download it here. Windows & Linux only for now, but you can build it yourself to run it on macOS, see below.

It requires a modern GPU supporting at least OpenGL 3.1.

Compilation

To build it yourself, install rustup, then clone the repository and run cargo run --release in the recursive-geometry folder.