netatmo-algo/README.md

58 lines
1.8 KiB
Markdown
Raw Normal View History

2022-02-11 19:03:22 +01:00
# Netatmo technical test
The subject is available here: [Test Algo](./test_algo.pdf)
2022-02-15 13:17:14 +01:00
## TODO
- [ ] document
2022-02-15 21:18:50 +01:00
- [X] dumb packing
- [ ] skyline
2022-02-15 13:17:14 +01:00
- [X] add raygui
- [ ] add box in gui by pressing down
- [ ] delete box in gui by clicking
- [ ] wrap stb_rect_pack?
2022-02-15 21:18:50 +01:00
- [X] change bbox api to origin + size
2022-02-15 13:17:14 +01:00
2022-02-11 19:03:22 +01:00
## Installation
## Notes
### Question 1
2022-02-12 00:28:54 +01:00
This is a packing problem, as described on [Wikipedia][1].
Since this is NP-hard, we know the "exact" solution might be unreachable but we
could find a solution that is good enough for our needs.
2022-02-11 19:03:22 +01:00
### Question 2
### Question 3
2022-02-11 20:06:26 +01:00
## PNG support
I chose to support PNG files through the stb files:
[github.com/nothings/stb](https://github.com/nothings/stb).
I could have implemented basic image support with the PNM format but I think it
is nicer to support common image formats with a simple library.
stb also implements a 2D rectangle packer:
[stb_rect_pack.h](https://github.com/nothings/stb/blob/master/stb_rect_pack.h)
I added this file in the project in order to compare my implementation to
another one.
## 3rd party libraries
I use 2 external libraries for better visualization:
- stb files (for PNG)
- raylib (for GUI)
I don't rely on them for the algorithm implementation and the core of the
exercise doesn't rely on external libraries.
2022-02-12 00:28:54 +01:00
2022-02-15 13:17:14 +01:00
To avoid name collision, I created my own namespace `freling`.
2022-02-12 00:28:54 +01:00
## References
2022-02-15 13:17:14 +01:00
- [Exploring rectangle packing algorithms](https://www.david-colson.com/2020/03/10/exploring-rect-packing.html)
- [A Skyline-Based Heuristic for the 2D Rectangular Strip Packing Problem](https://www.researchgate.net/publication/221049934_A_Skyline-Based_Heuristic_for_the_2D_Rectangular_Strip_Packing_Problem)
- [New Improvements in Optimal Rectangle Packing](https://www.ijcai.org/Proceedings/09/Papers/092.pdf)
2022-02-12 00:28:54 +01:00
[1]: https://en.wikipedia.org/wiki/Packing_problems#Packing_of_rectangles