1#!/bin/sh
2#   writes examples to eg/
3#   see html/qh_eg.htm
4if ! which qconvex >/dev/null 2>&1; then
5    if [ ! -d bin ]; then
6	echo 'eg/q_eg: Run eg/q_eg from the Qhull directory with bin/qconvex, or add qconvex/etc. to $PATH'
7	exit 1
8    fi
9    if [ ! -e bin/qconvex -a ! -e bin/qconvex.exe ]; then
10	echo 'eg/q_eg: Build qhull first.  qconvex is missing from bin/ directory and $PATH'
11	exit 1
12    fi
13    echo 'eg/q_eg: Temporarily add "$PWD/bin" to $PATH for access to qconvex,etc.'
14    PATH=$PWD/bin:$PATH
15    if ! which qconvex >/dev/null 2>&1; then
16	echo 'eg/q_eg: PATH=... failed.  Please execute "export PATH=$PWD/bin:$PATH" and repeat'
17	exit 1
18    fi
19fi
20mkdir -p eg
21echo ==============================
22echo ========= eg/q_eg ============
23echo == Create geomview examples ==
24echo ==============================
25echo
26set -v
27rbox c D3 | qconvex s G >eg/eg.01.cube
28rbox c d G2.0 | qconvex s G >eg/eg.02.diamond.cube
29rbox s 100 D3 | qconvex s G >eg/eg.03.sphere
30rbox s 100 D2 | qconvex s G >eg/eg.04.circle
31rbox 10 l | qconvex s G >eg/eg.05.spiral
32rbox 1000 D2 | qconvex s C-0.03 Qc Gapcv >eg/eg.06.merge.square
33rbox 1000 D3 | qconvex s G >eg/eg.07.box
34rbox c G0.4 s 500 | qconvex s G >eg/eg.08a.cube.sphere
35rbox d G0.6 s 500 | qconvex s G >eg/eg.08b.diamond.sphere
36rbox 100 L3 G0.5 s | qconvex s G >eg/eg.09.lens
37rbox 100 s P0.5,0.5,0.5 | qconvex s Ga QG0 >eg/eg.10a.sphere.visible
38rbox 100 s P0.5,0.5,0.5 | qconvex s Ga QG-0 >eg/eg.10b.sphere.beyond
39rbox 100 s P0.5,0.5,0.5 | qconvex s Ga QG0 PG >eg/eg.10c.sphere.horizon
40rbox 100 s P0.5,0.5,0.5 | qconvex s Ga QV0 PgG >eg/eg.10d.sphere.cone
41rbox 100 s P0.5,0.5,0.5 | qconvex s Ga >eg/eg.10e.sphere.new
42rbox 100 s P0.5,0.5,0.5 | qhull s Ga QV0g Q0 >eg/eg.14.sphere.corner
43rbox 500 W0 | qconvex s QR0 Qc Gvp >eg/eg.15a.surface
44rbox 500 W0 | qconvex s QR0 Qt Qc Gvp >eg/eg.15b.triangle
45rbox 500 W0 | qconvex s QR0 QJ5e-2 Qc Gvp >eg/eg.15c.joggle
46echo 2 = rbox 6 r s D2, rbox 15 B0.3 W0.25, c G0.5 >eg/eg.data.17
47echo 25 >>eg/eg.data.17
48rbox 15 D2 B0.3 W0.25 c G0.5 | tail -n +3 >>eg/eg.data.17
49rbox 6 r s D2 B0.2 | tail -n +3 >>eg/eg.data.17
50qdelaunay s Qt <eg/eg.data.17 GnraD2 >eg/eg.17a.delaunay.2
51qdelaunay s <eg/eg.data.17 GnraD2 >eg/eg.17b.delaunay.2i
52qdelaunay s <eg/eg.data.17 C-0 Ga >eg/eg.17c.delaunay.2-3
53qvoronoi s QJ <eg/eg.data.17 Gna >eg/eg.17d.voronoi.2
54qvoronoi s <eg/eg.data.17 Gna >eg/eg.17e.voronoi.2i
55rbox c G0.1 d | qdelaunay Gt Qz >eg/eg.17f.delaunay.3
56rbox 10 D2 d | qdelaunay s Qu G >eg/eg.18a.furthest.2-3
57rbox 10 D2 d | qdelaunay s Qu Pd2 G >eg/eg.18b.furthest-up.2-3
58rbox 10 D2 d | qvoronoi s Qu Gv >eg/eg.18c.furthest.2
59rbox 10 D3 | qvoronoi s FQ QV5 p | qconvex s G >eg/eg.19.voronoi.region.3
60rbox r s 20 Z1 G0.2 | qconvex s QR1 G >eg/eg.20.cone
61rbox 200 s | qconvex s Qc R0.014 Gpav >eg/eg.21b.roundoff.fixed
62rbox 1000 s| qconvex s C0.01 Qc Gcrp >eg/eg.22a.merge.sphere.01
63rbox 1000 s| qconvex s C-0.01 Qc Gcrp >eg/eg.22b.merge.sphere.-01
64rbox 1000 s| qconvex s C0.05 Qc Gcrpv >eg/eg.22c.merge.sphere.05
65rbox 1000 s| qconvex s C-0.05 Qc Gcrpv >eg/eg.22d.merge.sphere.-05
66rbox 1000 | qconvex s Gcprvah C0.1 Qc >eg/eg.23.merge.cube
67rbox 5000 D4 | qconvex s GD0v Pd0:0.5 C-0.02 C0.1 >eg/eg.24.merge.cube.4d-in-3d
68rbox 5000 D4 | qconvex s s C-0.02 C0.1 Gh >eg/eg.30.4d.merge.cube
69rbox 20 D3 | qdelaunay s G >eg/eg.31.4d.delaunay
70rbox 30 s D4 | qconvex s G Pd0d1d2D3 >eg/eg.32.4d.octant
71rbox 10 r s Z1 G0.3 | qconvex G >eg/eg.33a.cone
72rbox 10 r s Z1 G0.3 | qconvex FQ FV n | qhalf G >eg/eg.33b.cone.dual
73rbox 10 r s Z1 G0.3 | qconvex FQ FV n | qhalf FQ s Fp | qconvex G >eg/eg.33c.cone.halfspace
74
75echo ==the following should generate flipped and concave facets== >/dev/null
76rbox 200 s | qhull Q0 s R0.014 Gav Po >eg/eg.21a.roundoff.errors
77echo ==the preceding should report flipped and concave facets== >/dev/null
78echo END eg/q_eg >/dev/null
79
80
81
82