![]() |
libsxbp
v0.27
Experimental generation of 2D spiralling lines based on input binary data.
|
This compilation unit provides functions for calculating the length of all lines in a spiral such that the length of each line is at least 1 and none of them collide. More...

Go to the source code of this file.
Functions | |
| sxbp_status_t | sxbp_resize_spiral (sxbp_spiral_t *spiral, uint32_t index, sxbp_length_t length, sxbp_length_t perfection_threshold) |
| Attempt to set a given line of a spiral to a given length. More... | |
| sxbp_status_t | sxbp_plot_spiral (sxbp_spiral_t *spiral, sxbp_length_t perfection_threshold, uint32_t max_line, void(*progress_callback)(sxbp_spiral_t *spiral, uint32_t latest_line, uint32_t target_line, void *progress_callback_user_data), void *progress_callback_user_data) |
| Solve the given incomplete spiral such that each line has a length of at least 1 unit. More... | |
This compilation unit provides functions for calculating the length of all lines in a spiral such that the length of each line is at least 1 and none of them collide.
| sxbp_status_t sxbp_plot_spiral | ( | sxbp_spiral_t * | spiral, |
| sxbp_length_t | perfection_threshold, | ||
| uint32_t | max_line, | ||
| void(*)(sxbp_spiral_t *spiral, uint32_t latest_line, uint32_t target_line, void *progress_callback_user_data) | progress_callback, | ||
| void * | progress_callback_user_data | ||
| ) |
Solve the given incomplete spiral such that each line has a length of at least 1 unit.
This function will solve a given spiral such that each line of the spiral has a length of at least 1 unit, and that none of these lines collide with one another. The algorithm operates recursively on the spiral to achieve this. A spiral at any point of completion may be passed to this function and the algorithm will solve just the parts which have yet to be solved if partial work has already been done to solve the spiral. A progress callback may optionally also be given to the function. If this is non-NULL, then this callback function will be called every time the algorithm finds the length of another line. Once this function has finished, it may be possible to render the spiral.
| [in,out] | spiral | The spiral to solve. Function operates on the spiral in-place (mutating operation). |
| perfection_threshold | The maximum line length of colliding lines at which aggressive optimisations are allowed (or 0 to disable these optimisations completely). | |
| max_line | The index of the highest line to plot to. | |
| progress_callback | An optional function pointer to use as a callback which gets called every time a new line length is successfully found. The signature of the callback should be like so: If a callback is not required, this argument should be NULL. The callback takes four arguments, where:
| |
| progress_callback_user_data | An optional void pointer to a user-defined type, useful for passing context or state to the callback function if it needs to do something requiring file handles or some other context handle. This argument should be NULL if not required. |
| sxbp_status_t sxbp_resize_spiral | ( | sxbp_spiral_t * | spiral, |
| uint32_t | index, | ||
| sxbp_length_t | length, | ||
| sxbp_length_t | perfection_threshold | ||
| ) |
Attempt to set a given line of a spiral to a given length.
If this cannot be done because the operation would cause a line collision, then backtrack and re-size the previous lines recursively until a non-colliding conclusion can be found.
| [in,out] | spiral | The spiral for which the line should be resized. |
| index | The index of the line to resize. | |
| length | The length to attempt to resize the line to. | |
| perfection_threshold | The maximum line length of colliding lines at which aggressive optimisations are allowed (or 0 to disable these optimisations completely). |
1.8.11