package
Version:
v0.0.0-...-ab92d4e
Opens a new window with list of versions in this module.
Published: Jul 8, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
genmarchingsquares
This package provides a simple implementation of the marching squares algorithm for illustrative purposes for now.
Be warned... Right now I am implementing this blindly without looking anything up, so who knows if what I am doing is correct.
Scope
Create a package that takes a pixel field and outputs a 2d grid of tiles representing the contours of said field.
Done
- 2d boolean input field
- 2d output grid of tiles encoded as 4 bit values
- Simple export to PNG in garish colors
- Rotate the tile templates for different orientations
- Draw the pixel states on the exported PNG
TODO
- Scalar input field
- Threshold value for contour detection
- Interpolation of output grid based on scalar values
- Fix x/y coordinate handling (the array indices are flipped)
- Simplify tile drawing
- Documentation
- Make code nicer
Reference
Documentation
¶
ExportToPNG exports the given encoded tiles to PNG.
func MarchSquares(pixels [][]bool, dimX, dimY int) [][]byte
MarchSquares returns a grid of tiles encoded as 4 bit values that are generated from the given pixel grid.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.