Last active
July 28, 2023 06:18
-
-
Save wchargin/6100c797cba433840de70ea7fcc20a47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shlex | |
import subprocess | |
BIN = "./target/release/qql-cli" | |
SEED = "0x44266f38ea9ef4e85a77310518b1cb6d5a56349bed2514b9d9e2ffff10e2cb2f" | |
WIDTH = 2400 | |
STEPS = 8 | |
def lerp(a, b, t): | |
return a * (1 - t) + b * t | |
def main(): | |
cx, cy = 4804 / 9600, 6015.25 / (9600 * 1.25) | |
print((cx, cy)) | |
print() | |
scales = [0.0003, 0.001, 0.0025, 0.01, 0.05, 0.1, 0.5, 1.0] | |
minscale = scales[0] | |
for (i, scale) in enumerate(scales): | |
scaleprogress = (scale - minscale) / (1 - minscale) | |
xmin = lerp(cx - scale / 2, 0, scaleprogress ** 2) | |
ymin = lerp(cy - scale / 2, 0, scaleprogress ** 2) | |
viewport = "%fx%f+%f+%f" % (scale, scale, xmin, ymin) | |
width = str(round(WIDTH / scale)) | |
steps = str(min(round(STEPS / scale), 1024)) | |
print("(#%s) scale %s -> width=%s, viewport=%s, steps=%s" % (i, scale, width, viewport, steps)) | |
cmd = [ | |
BIN, | |
SEED, | |
"--viewport", viewport, | |
"--width", width, | |
"-o", "anderszoom-%02d.png" % i, | |
"--min-circle-steps", steps, | |
] | |
print(shlex.join(cmd)) | |
subprocess.check_call(cmd) | |
print() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment