Skip to content

Commit

Permalink
Enable regenerating README.md from the project examples (#170)
Browse files Browse the repository at this point in the history
Closes #169.

* [x] Generate examples stringing together multiple tools
  * [x] Generate random Lindenmayer examples
  * [x] Generate asemic writing examples
* [x] Generate examples for each tool
  * [x] wkt2svg
  * [x] render.py
  * [x] bundle
  * [x] pack
  * [x] format.py
  * [x] random-production-rules.py
  * [x] parse-production-rules.py
  * [x] interpret-lstring.py
  * [x] random-lsystem.sh
  * [x] project.py
  * [x] geom2graph
  * [x] smooth
  * [x] snap
  * [x] transform
  * [x] point-cloud
  * [x] grid
  * [x] bitwise
  * [x] dla
  * [x] streamline
  * [x] traverse
  * [x] triangulate
  * [x] urquhart
* [x] Table of contents
* [x] Remove stale example data
* [x] Remove stale example generation scripts
* [x] Swap out README.md.out with README.md
* [ ] Consider running generation in parallel?
  • Loading branch information
Notgnoshi committed May 19, 2024
2 parents d504d03 + 57b7ee9 commit 5b2d874
Show file tree
Hide file tree
Showing 90 changed files with 23,879 additions and 40,880 deletions.
1,099 changes: 571 additions & 528 deletions README.md

Large diffs are not rendered by default.

464 changes: 464 additions & 0 deletions README.md.in

Large diffs are not rendered by default.

400 changes: 0 additions & 400 deletions examples/asemic/example.svg

This file was deleted.

110 changes: 97 additions & 13 deletions examples/asemic/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,111 @@
set -o errexit
set -o pipefail
set -o nounset
set -o noclobber

glyph() {
# BEGIN ASEMIC_SETUP_SNIPPET
glyphs() {
local glyph_kind="$1"
local number="$2"
local size="$3"

{
for _ in $(seq "$number"); do
$glyph_kind "$size"
done
} | pack --width 1000 --height 1000 --padding 20
}
# END ASEMIC_SETUP_SNIPPET
extract_snippet ASEMIC_SETUP_SNIPPET

ASEMIC_RANDOM_ROUNDED=./examples/asemic/random-rounded.svg
debug "Generating $ASEMIC_RANDOM_ROUNDED ..."
# BEGIN ASEMIC_RANDOM_ROUNDED_SNIPPET
random_rounded() {
local size="$1"
local width=2
local height=3
point-cloud --log-level WARN --domain unit-square --points 15 --scale 6 |
urquhart --output-format tgf |
traverse --log-level WARN --traversals 5 --length 5 --untraversed |
transform --scale="$size" |
smooth --iterations 4 |
bundle
}
glyphs random_rounded 90 10 | wkt2svg --output $ASEMIC_RANDOM_ROUNDED
# END ASEMIC_RANDOM_ROUNDED_SNIPPET
extract_snippet ASEMIC_RANDOM_ROUNDED_SNIPPET

grid --output-format graph --width="$width" --height="$height" |
traverse --traversals 4 --length 5 --remove-after-traverse |
ASEMIC_RANDOM_TRIANGULATED=./examples/asemic/random-triangulated.svg
debug "Generating $ASEMIC_RANDOM_TRIANGULATED ..."
# BEGIN ASEMIC_RANDOM_TRIANGULATED_SNIPPET
random_triangulated() {
local size="$1"
point-cloud --log-level WARN --domain unit-square --points 10 --scale 6 |
triangulate --output-format tgf |
traverse --log-level WARN --traversals 3 --length 3 --remove-after-traverse |
transform --scale="$size" |
smooth --iterations 4 |
bundle
}
glyphs random_triangulated 100 10 | wkt2svg --output $ASEMIC_RANDOM_TRIANGULATED
# END ASEMIC_RANDOM_TRIANGULATED_SNIPPET
extract_snippet ASEMIC_RANDOM_TRIANGULATED_SNIPPET

glyphs() {
local number="$1"
local size="$2"
ASEMIC_GRID_ROUNDED=./examples/asemic/grid-rounded.svg
debug "Generating $ASEMIC_GRID_ROUNDED ..."
# BEGIN ASEMIC_GRID_ROUNDED_SNIPPET
grid_rounded() {
local size="$1"
grid --output-format graph --width=2 --height=3 |
traverse --log-level WARN --traversals 5 --length 5 --remove-after-traverse |
transform --scale="$size" |
smooth --iterations 4 |
bundle
}
glyphs grid_rounded 120 20 | wkt2svg --output $ASEMIC_GRID_ROUNDED
# END ASEMIC_GRID_ROUNDED_SNIPPET
extract_snippet ASEMIC_GRID_ROUNDED_SNIPPET

for _ in $(seq "$number"); do
glyph "$size"
done
ASEMIC_GRID_BEVELED=./examples/asemic/grid-beveled.svg
debug "Generating $ASEMIC_GRID_BEVELED ..."
# BEGIN ASEMIC_GRID_BEVELED_SNIPPET
grid_beveled() {
local size="$1"
grid --output-format graph --width=2 --height=3 |
traverse --log-level WARN --traversals 5 --length 5 --remove-after-traverse |
transform --scale="$size" |
smooth --iterations 1 |
bundle
}
glyphs grid_beveled 120 20 | wkt2svg --output $ASEMIC_GRID_BEVELED
# END ASEMIC_GRID_BEVELED_SNIPPET
extract_snippet ASEMIC_GRID_BEVELED_SNIPPET

ASEMIC_GRID_TRIANGULATED=./examples/asemic/grid-triangulated.svg
debug "Generating $ASEMIC_GRID_TRIANGULATED ..."
# BEGIN ASEMIC_GRID_TRIANGULATED_SNIPPET
grid_triangulated() {
local size="$1"
grid --grid-type triangle --output-format graph --width=2 --height=3 |
traverse --log-level WARN --traversals 4 --length 5 --remove-after-traverse |
transform --scale="$size" |
smooth --iterations 4 |
bundle
}
glyphs grid_triangulated 100 20 | wkt2svg --output $ASEMIC_GRID_TRIANGULATED
# END ASEMIC_GRID_TRIANGULATED_SNIPPET
extract_snippet ASEMIC_GRID_TRIANGULATED_SNIPPET

glyphs 100 20 |
pack --width 1000 --height 1000 --padding 20
ASEMIC_GRID_JAGGED=./examples/asemic/grid-jagged.svg
debug "Generating $ASEMIC_GRID_JAGGED ..."
# BEGIN ASEMIC_GRID_JAGGED_SNIPPET
grid_jagged() {
local size="$1"
grid --grid-type ragged --output-format graph --width=2 --height=3 |
traverse --log-level WARN --traversals 4 --length 5 --remove-after-traverse |
transform --scale="$size" |
smooth --iterations 4 |
bundle
}
glyphs grid_jagged 100 20 | wkt2svg --output $ASEMIC_GRID_JAGGED
# END ASEMIC_GRID_JAGGED_SNIPPET
extract_snippet ASEMIC_GRID_JAGGED_SNIPPET
588 changes: 588 additions & 0 deletions examples/asemic/grid-beveled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
403 changes: 403 additions & 0 deletions examples/asemic/grid-jagged.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
592 changes: 592 additions & 0 deletions examples/asemic/grid-rounded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
403 changes: 403 additions & 0 deletions examples/asemic/grid-triangulated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
185 changes: 0 additions & 185 deletions examples/asemic/hex-smooth.svg

This file was deleted.

185 changes: 0 additions & 185 deletions examples/asemic/hex.svg

This file was deleted.

203 changes: 0 additions & 203 deletions examples/asemic/quads-45.svg

This file was deleted.

400 changes: 0 additions & 400 deletions examples/asemic/quads.svg

This file was deleted.

Loading

0 comments on commit 5b2d874

Please sign in to comment.