File: compute

package info (click to toggle)
qhull 2020.2-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,508 kB
  • sloc: ansic: 45,806; cpp: 11,645; sh: 2,474; makefile: 911; xml: 203
file content (53 lines) | stat: -rwxr-xr-x 1,014 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -e
tmpfile=$(mktemp)
trap "rm $tmpfile" EXIT

# 2D square with 100 random points inside
rbox 100 c D2 | qconvex p | tee "$tmpfile"
diff -uZ "$tmpfile" - << EOF
2
4
  -0.5   -0.5
  -0.5    0.5
   0.5   -0.5
   0.5    0.5
EOF
# 2D square with 100 random points on the border
rbox 100 c W0 D2 | qconvex p | tee "$tmpfile"
diff -uZ "$tmpfile" - << EOF
2
4
  -0.5   -0.5
  -0.5    0.5
   0.5   -0.5
   0.5    0.5
EOF
# 3D cube with 100 random points inside
rbox 100 c D3 | qconvex p |tee "$tmpfile"
diff -uZ "$tmpfile" - << EOF
3
8
  -0.5   -0.5   -0.5
  -0.5   -0.5    0.5
  -0.5    0.5   -0.5
  -0.5    0.5    0.5
   0.5   -0.5   -0.5
   0.5   -0.5    0.5
   0.5    0.5   -0.5
   0.5    0.5    0.5
EOF
# 3D cube with 100 random points on the surfaces
rbox 100 c W0 D3 | qconvex p |tee "$tmpfile"
diff -uZ "$tmpfile" - << EOF
3
8
  -0.5   -0.5   -0.5
  -0.5   -0.5    0.5
  -0.5    0.5   -0.5
  -0.5    0.5    0.5
   0.5   -0.5   -0.5
   0.5   -0.5    0.5
   0.5    0.5   -0.5
   0.5    0.5    0.5
EOF