updated README

master
Sascha Nitsch 2022-01-19 18:46:22 +01:00
parent 613092f3ee
commit d97dbf9da7
2 changed files with 29 additions and 24 deletions

View File

@ -1,4 +1,31 @@
# Path animator
Source code for the Path animator framework on [the project page](https://contentnation.net/en/grumpydevelop/pathanimator).
Initial implementation in C++ running on Linux, testing needs to be done if it can be in-browser via Javascript to make it cross plattform client only.
The Javascript version is ready to use in all major browser.
Just load the inbrowser/webroot/inde.html and go on. Completely client side, no server nor internet needed.
## Algorithm descriptions
## Distance Path
This algorithm uses a simple distance calculation based from one or more start points.
1. Initialization
* The start points are added to the "to process" queue.
* The distance values on all pixels are set to max distance on start.
2. Main loop
* Each point in the "to process" queue is taken and it's value (distance).
* Each surrounding pixel takes the last distance (the center) and adds the distance given by the parameters m_weighBlock and m_weightPath
The input image selects the weight from the two parameters, a 0 (black) pixel takes 100% of the block value, a (255) white pixel
is 100% path weight.
* If this distance is smaller than the previous pixel that was calulated, replace it and add the pixel to the next list of pixel to be processed.
* After the iteration is done, clear the process queue and swap with the next queue and repeat until the next queue is empty or the hard limit of 10.000 iterations is met.
3. Postprocessing (C++ version)
* After the raw distances are calculated, the actual max distance is found.
* The raw map (floating ponts) is mapped down to a 16 bit image and the distance is saved in the red channel.
* the iteration where the pixel was set is in the green channel
* the blue channel is a mask if the pixel was seen as a path (65535) or as a block (0).
The threshold value sets the point where a path becomes a block.
Setting the threshold allows some cheating. You can add an path between areas with a gray value, the algorithm uses it to calculate
distance and as a path to other ares, but shows it as a block in the blue channel.
3b. Postprocessing (JavaScript version)
* Similar to the C++ version, due to lack of 16 bit image support the higher bits are mapped to the red channel, the lower bits to the green channel.
* No iterations are exported

View File

@ -1,22 +0,0 @@
# Algrithm descriptions
## Distance Path
This algorithm uses a simple distance calculation based from one or more start points.
1. Initialization
* The start points are added to the "to process" queue.
* The distance values on all pixels are set to m_maxDistance on start.
2. Main loop
* Each point in the "to process" queue is taken and it's value (distance).
* Each surrounding pixel takes the last distance (the center) and adds the distance given by the parameters m_weighBlock and m_weightPath.
The input image selects the weight from the two parameters, a 0 (black) pixel takes 100% of the block value, a (255) white pixel
is 100% path weight.
* If this distance is smaller than the previous pixel that was calulated, replace it and add the pixel to the next list of pixel to be processed.
* After the iteration is done, clear the process queue and swap with the next queue and repeat until the next queue is empty or the hard limit of 10.000 iterations is met.
3. Postprocessing
* After the raw distances are calculated, the actual max distance is found.
* The raw map (floating ponts) is mapped down to a 16 bit image and the distance is saved in the red channel,
* the iteration where the pixel was set is in the green channel
* the blue channel is a mask if the pixel was seen as a path (65535) or as a block (0).
The m_threshhold value sets the point where a path becomes a block.
Setting the threshhold allows some cheating. You can add an path between areas with a gray value, the algorithm uses it to calculate
distance and as a path to other ares, but shows it as a block in the blue channel.