diff options
Diffstat (limited to 'share')
| -rwxr-xr-x | share/hackvr/examples/dothack/chaosgate.py | 63 | ||||
| -rwxr-xr-x | share/hackvr/examples/dothack/test.sh | 6 | ||||
| -rw-r--r-- | share/hackvr/meshes/floppy.hackvr | 30 | 
3 files changed, 99 insertions, 0 deletions
| 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 diff --git a/share/hackvr/meshes/floppy.hackvr b/share/hackvr/meshes/floppy.hackvr new file mode 100644 index 0000000..53b1f09 --- /dev/null +++ b/share/hackvr/meshes/floppy.hackvr @@ -0,0 +1,30 @@ +#whole thing +floppy addshape 1  5  -1 1 0  .8 1 0  1 .8 0  1 -1 0  -1 -1 0 + +### this is for when I eventually make it actually 3d +#floppy addshape 1  5  -1 1 .1  .8 1 .1  1 .8 .1  1 -1 .1  -1 -1 .1 + +#the label +floppy addshape 1  4  -.8 .15 0  .8 .15 0  .8 -1 0  -.8 -1 0 + +#the lines on the label +floppy addshape 1  2  -.8 -.05 0   .8 -.05 0 +floppy addshape 1  2  -.8 -.25 0   .8 -.25 0 +floppy addshape 1  2  -.8 -.45 0   .8 -.45 0 +floppy addshape 1  2  -.8 -.65 0   .8 -.65 0 +floppy addshape 1  2  -.8 -.85 0   .8 -.85 0 + +#the metal clip slide area +floppy addshape 1  4  -.8 1 0  -.8 .3 0  .5 .3 0  .5 1 0 + +#the metal clip +floppy addshape 1  4  -.5 1 0  -.5 .3 0  .55 .3 0  .55 1 0 + +#the hole in the metal clip because... lazy. +floppy addshape 1  4  .125 .9 0  .4 .9 0  .4 .35 0  .125 .35 0 + +#the write protection hole +floppy addshape 1  4  .95 -.875 0  .85 -.875 0  .85 -.8 0  .95 -.8 0 + +floppy scale 7 7 7 +#floppy rotate 0 0 180 | 
