-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
205 lines (185 loc) · 7.91 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<title>Polycubes</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<style>
body {
padding: 0;
margin: 0;
overflow: hidden;
}
canvas {
position: fixed;
height: 100%;
}
#info {
position: fixed;
margin: 10px;
z-index: 1;
background-color: white;
overflow-y: auto;
overflow-x: hidden;
opacity: 0.8;
max-height: 100%;
width: 200px;
font-family: Monospace;
font-size: 12px;
text-align: center;
}
.rot0 {transform: rotate(0deg);}
.rot1 {transform: rotate(90deg);}
.rot2 {transform: rotate(180deg);}
.rot3 {transform: rotate(270deg);}
.modal {
position: fixed;
z-index: 2;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
visibility: hidden;
transform: scale(1.1);
transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
}
.modal-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
padding: 1rem 1rem;
max-width: 100%;
max-height: 100%;
border-radius: 0.5rem;
overflow-y: auto;
}
.show-modal {
opacity: 1;
visibility: visible;
transform: scale(1.0);
transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
}
fieldset {
padding: 0px;
margin: 3px;
border-width: thick;
border-style: solid;
border-radius: 5px;
}
a {
color: #2d889b;
}
span {
display: inline-block;
}
input[type=number] {
width: 35px;
height: 30px;
text-align: center;
border-width:0px;
border:none;
background: transparent;
vertical-align: middle;
}
button {
background-color: #e1e3e1;
width: 100%;
border: 0;
padding: 2px;
margin: 1px;
}
.primary {
background-color: #d6eed6;
padding: 5px;
}
</style>
<link rel="manifest" href="/manifest.json">
</head>
<body>
<div id="examples" class="modal" onclick="toggleModal(this.id)">
<div class="modal-content">
<h3>Examples</h3>
<a href="./?hexRule=040000000000840000000000">Dimer</a>,
<a href="./?hexRule=040087000000">Square</a>,
<a href="./?hexRule=040803000000888403000000">Linear chain</a>,
<a href="./?hexRule=05050a08000085858a880000">2D plane (checkerboard)</a>,
<a href="./?hexRule=00040008000c840088008c00">Cube</a>,
<a href="./?hexRule=0406008800008400140000008c0800000000901400000000980c171710129c1a0000000094000000000016141c000000">Robot</a>,
<a href="./?hexRule=00000006008b00008600000c000000028c00080c0c000c0c048600000000">Giraffe-duck</a>,
<a href="./?hexRule=980e1b0c0c1b020c0c01008d">64-mer</a>,
<a href="./?hexRule=070000008900080100008500">Helix</a>,
<a href="./?hexRule=860000000000040000898f0000090600000f">Star</a>
<a href="./?hexRule=000084000a0f00000500008e000000001113880000000090">Tetrahedron</a>
<h3>What is a polycube?</h3>
"A polycube is a solid figure formed by joining one or more equal cubes face to face" - <a href="https://en.wikipedia.org/wiki/Polycube">Wikipedia</a>
<h3>Ok, but what is this model about?</h3>
An output polycube is generated by stochastically assembling it from an input set of building block cubes.
Each cube can have up to six patches (one at each side) and the patches will bind together if they have complementary colours and
the same orientation.
<h3>So what do I do?</h3>
Change the input by adding, removing, or modifying the available cube types. You can change the patch colours by changing the
corresponding numbers. Positive numbers will bind to negative: 1 to -1, 2 to -2, etc. An empty patch has the value 0 and will not bind.
You can also change the patch orientations by clicking the <img src="doc/face.svg" style="vertical-align: middle;" height="35"> button.
</div>
</div>
<div id="info">
Polycubes, by Joakim Bohlin. A 3D version of <a href="http://chaoticsymmetry.co.uk/polyominoes/index-old.php">Polyominoes</a><br>
<button class="primary" onclick="toggleModal('examples')">Help</button>
<button onclick="system.resetRandom(); clearRule();">Random input</button>
<button onclick="system.resetRule(parseHexRule(mutateRule(system.getRuleStr()))); clearRule()">Mutate input</button>
<button onclick="simplifyRule()">Simplify</button>
<button onclick="simplifyRule2()">Simplify2</button>
<fieldset>
<legend>Input:</legend>
<div id="ruleset" style="overflow: hidden"></div>
<button class="primary" onclick="addSpecies()">Add cube type</button>
<span style="display: flex;">
<button onclick="system.regenerate()">Update</button>
<input type="checkbox" id="autoUpdate" checked="True", onchange="system.regenerate()">Auto update
</span>
<label for="assemblyMode">Seeding:</label>
<select id="assemblyMode" onchange="system.resetAssemblyMode(this.value)">
<option value="stochastic">Unseeded</option>
<option value="seeded" selected>Seeded</option>
</select>
<span style="display: flex;">
<input type="checkbox" id="torsion" checked="True", onchange="system.torsion=this.checked; system.regenerate()">Torsion
<input type="checkbox" id="mismatches" checked="True", onchange="system.allowMismatches=this.checked; system.regenerate()" title="Allow mismatches">Mismatches
</span>
<button onclick="toggleFog()">Toggle fog</button>
<button onclick="system.toggleLineView()">Toggle line view</button>
<button id="hideToggle" onclick="toggleRuleSet()">Hide</button>
<!--https://stackoverflow.com/a/19965480 location.search-->
</fieldset>
</div>
<canvas id="threeCanvas"></canvas>
<script src="js/libs/three.min.js"></script>
<script src="js/libs/randomColor.min.js"></script> <!--from: https://github.com/davidmerfield/randomColor-->
<script src="js/libs/WebGL.js"></script>
<script src="js/libs/GLTFExporter.js"></script>
<script src="js/libs/jszip.min.js"></script>
<script src="js/libs/FileSaver.min.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<script src="js/utils.js"></script>
<script src="js/polycubeSystem.js"></script>
<script src="js/view.js"></script>
<script src="js/patchySimFiles.js"></script>
<script src="js/newPatchySimFiles.js"></script>
<script src="js/oxviewIO.js"></script>
<script src="js/dnaSimFiles.js"></script>
<script src="js/init.js"></script>
<script>
createPolycubeSystem();
</script>
<script src="js/edit.js"></script>
<script src="js/evolve.js"></script>
</body>
</html>