5dc34e9b83e7 — pouya@nohup.io 4 months ago
add examples/grid.sh
1 files changed, 34 insertions(+), 0 deletions(-)

A => examples/grid.sh
A => examples/grid.sh +34 -0
@@ 0,0 1,34 @@ 
+#!/bin/sh
+
+style="0|191|255|255"
+
+cmp() {
+	printf "[1p]st [0p]sf %f %f %stef\n" "$1" "$2" "$3" | tr - _ | dc
+}
+
+bop() {
+	printf "%f %f %s p\n" "$1" "$2" "$3" | tr - _ | dc
+}
+
+delta="$1"
+
+case $delta in
+[0-9]*)
+	;;
+*)
+	printf "usage: %s [delta]\n" "${0##*/}" >&2
+	exit 1
+	;;
+esac
+
+lat=-90
+while [ 1 -eq $(cmp $lat 90 '!<') ]; do
+	printf "line|%f|-180|%f|180|%s\n" "$lat" "$lat" "$style"
+	lat=$(bop "$lat" "$delta" +)
+done
+
+lon=-180
+while [ 1 -eq $(cmp $lon 180 '!<') ]; do
+	printf "line|-90|%f|90|%f|%s\n" "$lon" "$lon" "$style"
+	lon=$(bop "$lon" "$delta" +)
+done