summaryrefslogtreecommitdiffstats
path: root/README.md
blob: d8190242a7b85ecaff5bcd63f1c6ebcc07bb2c60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
k-d forests
===========

An implementation of [k-d forests](https://tavianator.com/2020/porting_kd_forests.html).

This code generates images containing every possible color, in the style of [this Code Golf answer](http://codegolf.stackexchange.com/a/22326) by József Fejes.
Colors are placed on the image one by one, next to the closest pixel already filled in.

Images
------

The full 24-bit, 4096×4096 image is generated by default, which takes a while:

    $ cargo run --release
    Generating a 4096x4096 image (16777216 pixels)
    100.00%  |  159 kpx/s  | max frontier size: 267592

To try it out quickly, generate an image with reduced bit depth:

    $ cargo run --release -- -b19
    Generating a 1024x512 image (524288 pixels)
    100.00%  |  285 kpx/s  | max frontier size: 18719

There are many flags that control the order colors are placed, and how the location for each color is selected.
Pass `--help` to see the available options.

Video
-----

To make a video of the generation process, pass the `-a`/`--animate` flag, and pipe the output into `ffmpeg`.
For example:

    $ cargo run --release -- -b23 -w3840 -h2160 -a | ffmpeg -f image2pipe -r 60 -i - -c:v libx265 -x265-params lossless=1 kd-forest.mkv