-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
59 lines (59 loc) · 1.54 KB
/
index.html
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
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<script src="gl-matrix-min.js"></script>
<script src="libgsl.js"></script>
<script src="index.js"></script>
</head>
<body>
<h1>Dual contouring</h1>
<p>
A simplified implementation of the dual contouring algorithm, as described
in the following paper:
<a href="http://www.frankpetterson.com/publications/dualcontour/dualcontour.pdf">
http://www.frankpetterson.com/publications/dualcontour/dualcontour.pdf
</a>
</p>
<p>
The shape you see is procedurally generated, using the description you
see below. To play with it, change the description of the shape, and then
click REGENERATE.
</p>
<canvas id="canvas" width="512" height="512"></canvas>
<textarea id="textarea" rows="25" cols="80" style="display:block">
difference(
intersection(
scale(
box(),
[0.75, 0.75, 0.75]
),
sphere()
),
union(
union(
rotateX(
scale(
cylinder(),
[0.5, 1.0, 0.5]
),
0.5 * Math.PI
),
rotateZ(
scale(
cylinder(),
[0.5, 1.0, 0.5]
),
0.5 * Math.PI
)
),
scale(
cylinder(),
[0.5, 1.0, 0.5]
)
)
);
</textarea>
<button onclick="generateMesh()">REGENERATE</button>
</body>
</html>