From e4704318327aec71a584571e80b6163988cdf6b8 Mon Sep 17 00:00:00 2001 From: epoch Date: Thu, 30 Apr 2020 05:10:42 -0500 Subject: the floppy disk hackvr mesh, and the chaosgate generator and its tester-script --- share/hackvr/examples/dothack/chaosgate.py | 63 ++++++++++++++++++++++++++++++ share/hackvr/examples/dothack/test.sh | 6 +++ 2 files changed, 69 insertions(+) create mode 100755 share/hackvr/examples/dothack/chaosgate.py create mode 100755 share/hackvr/examples/dothack/test.sh (limited to 'share/hackvr/examples/dothack') diff --git a/share/hackvr/examples/dothack/chaosgate.py b/share/hackvr/examples/dothack/chaosgate.py new file mode 100755 index 0000000..56bf25d --- /dev/null +++ b/share/hackvr/examples/dothack/chaosgate.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +import math + +def fp(p): + return " {} {} {}".format(p[0],p[1],p[2]) + +def print_rect(r): + print("gate addshape 4 4 {} {} {} {}".format(fp(r[0]),fp(r[1]),fp(r[2]),fp(r[3]))) + +d=1 + +sides = 12.0 +step = 360.0/sides +rot=0.0 +zoff = 0.0 +while rot < 360: +# print("rot: {}".format(rot)) + x1=math.sin(rot * math.pi / 180.0) + y1=math.cos(rot * math.pi / 180.0) + rot = rot + step + x2=math.sin(rot * math.pi / 180.0) + y2=math.cos(rot * math.pi / 180.0) + +# print("{} {}".format(x1,y1)) + + ### now to calculate points for the 4 rectangles we need to draw... + v1 = x1 * (d+30.0) # inner first point + v2 = x1 * (d+32.0) # outer first point + v3 = x1 * (d+31.0) # center first point + + v4 = y1 * (d+30.0) + v5 = y1 * (d+32.0) + v6 = y1 * (d+31.0) + + v7 = x2 * (d+30.0) + v8 = x2 * (d+32.0) + v9 = x2 * (d+31.0) + + v10 = y2 * (d+30.0) + v11 = y2 * (d+32.0) + v12 = y2 * (d+31.0) + + p1 = (v1, v4, zoff + 0.0) + p2 = (v2, v5, zoff + 0.0) + p3 = (v3, v6, zoff + 1.0) + p4 = (v3, v6, zoff - 1.0) + + p5 = (v7, v10, zoff + 0.0) + p6 = (v8, v11, zoff + 0.0) + p7 = (v9, v12, zoff + 1.0) + p8 = (v9, v12, zoff - 1.0) + + r1 = (p1, p5, p7, p3) #inner near + r2 = (p1, p5, p8, p4) #inner far + r3 = (p2, p6, p7, p3) #outer near + r4 = (p2, p6, p8, p4) #outer far + + ### first rectange is... + print_rect(r1) + print_rect(r2) + print_rect(r3) + print_rect(r4) diff --git a/share/hackvr/examples/dothack/test.sh b/share/hackvr/examples/dothack/test.sh new file mode 100755 index 0000000..7a30544 --- /dev/null +++ b/share/hackvr/examples/dothack/test.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +nonblocktail \ + <(./chaosgate.py) \ + <(echo gate move 0 0 150) \ + <(while true;do for i in $(seq 0 5 360);do echo "gate rotate 0 $i 0";sleep .1;done;done) \ + | hackvr_open -- cgit v1.2.3