Source code for the Path animator project https://contentnation.net/en/grumpydevelop/pathanimator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Sascha Nitsch d97dbf9da7 updated README 9 months ago
c++ updated README 9 months ago
inbrowser initial javascript version 9 months ago
.gitignore initial javascript version 9 months ago
CPPLINT.cfg initial import 9 months ago
LICENSE initial import 9 months ago
README.md updated README 9 months ago

README.md

Path animator

Source code for the Path animator framework on the project page.
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