Skip to content

Commit b007893

Browse files
committed
Update instructions
1 parent c80f2dd commit b007893

File tree

1 file changed

+40
-18
lines changed

1 file changed

+40
-18
lines changed

README.md

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ project, a **point quadtree** is implemented.
1111
The idea is that each node represents a rectangel in 2D space. The rectangle can
1212
store a limited number of points. If its capacity is reached, a node gets
1313
divided into 4 NW, NE, SE, SW children (leaves), where its points get
14-
re-distributed. Some nice theoretical resources are found in [1], [2].
14+
re-distributed. Some nice theoretical resources are found in [1], [2], [3].
1515

1616
To get some intuition, the schematic below shows what happens to a node of
1717
capacity of 2 when 3 points are sequentially inserted.
1818
```
19+
spatial representation:
1920
capacity=2 NW NE
2021
+--------------------+ +--------------------+ +--------------------+
2122
| | | | | | |
@@ -29,46 +30,67 @@ capacity=2 NW NE
2930
| | | | | | |
3031
+--------------------+ +--------------------+ +--------------------+
3132
SW SE
33+
tree representation:
34+
+--+ +--+ +--+
35+
|* | |**| | |
36+
+--+ +--+ +--+
37+
|
38+
|
39+
+------+---+---+------+
40+
| | | |
41+
+--+ +--+ +--+ +--+
42+
|* | | | |* | |* |
43+
NW +--+ NE+--+ SE+--+ SW+--+
3244
```
3345

3446
# 2. Usage
3547

3648
## 2.1 Project structure
3749
```
3850
.
39-
├── examples
40-
│   ── 01_particle_sim.c <- demo
51+
├── examples <- directory where demos can be added
52+
│   ── 01_particle_sim.c <- demo
4153
├── include
42-
│   ├── quad.h <- library
43-
│   └── viz.h <- GNUplot visualizer
54+
│   ├── quad.h <- library
55+
│   ├── viz_gplot.h <- gnuplot plotter
56+
│   ├── viz.h <- plotter interface
57+
│   └── viz_ppm.h <- ppm frame plotter
4458
├── src
4559
│   ├── quad.c <- library
46-
│   └── viz.c <- GNUplot visualizer
60+
│   ├── viz_gplot.c <- gnuplot plotter
61+
│   └── viz_ppm.c <- ppm frame plotter
4762
└── test
48-
├── nanotest.h <- testing framework
49-
└── test.c <- unit tests
63+
├── nanotest.h <- unit test framework
64+
└── tests.c <- unit tests
5065
```
51-
The visualizer plots the quadtree in real time via a pipe fed to GNUplot. The
52-
library is independent from the visualizer.
66+
The visualizer plots the quadtree in real time either via a pipe fed to GNUplot
67+
or directly as .ppm frames. The quadtree library is independent from the
68+
visualizer.
5369

5470
## 2.2. Dependencies and required tools
5571

5672
* `make` to compile the project.
57-
* `gnuplot` to run the particle simulation demo.
5873
* `gcc` is the default compiler, set in the Makefile.
74+
* either `gnuplot` or media player like `mpv` to run the particle simulation
75+
demo.
5976

6077
## 2.3. Compilation
6178

62-
To compile the library with any demo(s):
63-
```
64-
make
65-
```
79+
You can compile the example(s) with either GNUplot or .ppm frame emitter as the
80+
visualizer.
81+
82+
| gnuplot | ppm frames |
83+
| -------- | ---------------- |
84+
| `make` | `make -DUSE_PPM` |
85+
6686
Then all demos under `examples` will be compiled against the library. All
6787
executables will be generated in the root. A particle simulation to demonstrate
6888
how the tree works has been written. To run it:
69-
```
70-
./01_particle_sim | mpv -
71-
```
89+
90+
| gnuplot | ppm frames |
91+
| --------------------- | ----------------------------------------------------- |
92+
| `./01_particle_sim` | `./01_particle_sim | mpv --no-correct-pts --fps=30 -` |
93+
7294
To compile and run the unit tests:
7395
```
7496
make test

0 commit comments

Comments
 (0)