├── LICENSE.md └── mc.go /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (C) 2020 Michael Fogleman 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /mc.go: -------------------------------------------------------------------------------- 1 | package mc 2 | 3 | import "math" 4 | 5 | const eps = 1e-12 6 | 7 | type Vector struct { 8 | X, Y, Z float64 9 | } 10 | 11 | type Triangle struct { 12 | V1, V2, V3 Vector 13 | } 14 | 15 | type Evaluator interface { 16 | Evaluate(x, y, z float64) float64 17 | } 18 | 19 | func MarchingCubesGrid(w, h, d int, data []float64, value float64) []Triangle { 20 | var triangles []Triangle 21 | for z0 := 0; z0 < d-1; z0++ { 22 | z1 := z0 + 1 23 | for y0 := 0; y0 < h-1; y0++ { 24 | y1 := y0 + 1 25 | for x0 := 0; x0 < w-1; x0++ { 26 | x1 := x0 + 1 27 | v := [8]float64{ 28 | data[x0+y0*w+z0*w*h], 29 | data[x1+y0*w+z0*w*h], 30 | data[x1+y1*w+z0*w*h], 31 | data[x0+y1*w+z0*w*h], 32 | data[x0+y0*w+z1*w*h], 33 | data[x1+y0*w+z1*w*h], 34 | data[x1+y1*w+z1*w*h], 35 | data[x0+y1*w+z1*w*h], 36 | } 37 | px0, py0, pz0 := float64(x0), float64(y0), float64(z0) 38 | px1, py1, pz1 := float64(x1), float64(y1), float64(z1) 39 | p := [8]Vector{ 40 | Vector{px0, py0, pz0}, 41 | Vector{px1, py0, pz0}, 42 | Vector{px1, py1, pz0}, 43 | Vector{px0, py1, pz0}, 44 | Vector{px0, py0, pz1}, 45 | Vector{px1, py0, pz1}, 46 | Vector{px1, py1, pz1}, 47 | Vector{px0, py1, pz1}, 48 | } 49 | triangles = append(triangles, mcPolygonize(p, v, value)...) 50 | } 51 | } 52 | } 53 | return triangles 54 | } 55 | 56 | func MarchingCubes(e Evaluator, x0, y0, z0, x1, y1, z1, dx, dy, dz, value float64) []Triangle { 57 | nx := int(math.Ceil((x1 - x0) / dx)) 58 | ny := int(math.Ceil((y1 - y0) / dy)) 59 | nz := int(math.Ceil((z1 - z0) / dz)) 60 | sx := (x1 - x0) / float64(nx) 61 | sy := (y1 - y0) / float64(ny) 62 | sz := (z1 - z0) / float64(nz) 63 | var triangles []Triangle 64 | for z := 0; z < nz; z++ { 65 | for x := 0; x < nx; x++ { 66 | for y := 0; y < ny; y++ { 67 | px0, py0, pz0 := float64(x)*sx+x0, float64(y)*sy+y0, float64(z)*sz+z0 68 | px1, py1, pz1 := px0+sx, py0+sy, pz0+sz 69 | p := [8]Vector{ 70 | Vector{px0, py0, pz0}, 71 | Vector{px1, py0, pz0}, 72 | Vector{px1, py1, pz0}, 73 | Vector{px0, py1, pz0}, 74 | Vector{px0, py0, pz1}, 75 | Vector{px1, py0, pz1}, 76 | Vector{px1, py1, pz1}, 77 | Vector{px0, py1, pz1}, 78 | } 79 | var v [8]float64 80 | for i := 0; i < 8; i++ { 81 | v[i] = e.Evaluate(p[i].X, p[i].Y, p[i].Z) 82 | } 83 | triangles = append(triangles, mcPolygonize(p, v, value)...) 84 | } 85 | } 86 | } 87 | return triangles 88 | } 89 | 90 | func MarchingCubesMulti(e Evaluator, x0, y0, z0, x1, y1, z1, dx, dy, dz float64) map[float64][]Triangle { 91 | nx := int(math.Ceil((x1 - x0) / dx)) 92 | ny := int(math.Ceil((y1 - y0) / dy)) 93 | nz := int(math.Ceil((z1 - z0) / dz)) 94 | sx := (x1 - x0) / float64(nx) 95 | sy := (y1 - y0) / float64(ny) 96 | sz := (z1 - z0) / float64(nz) 97 | result := make(map[float64][]Triangle) 98 | for z := 0; z < nz; z++ { 99 | for x := 0; x < nx; x++ { 100 | for y := 0; y < ny; y++ { 101 | px0, py0, pz0 := float64(x)*sx+x0, float64(y)*sy+y0, float64(z)*sz+z0 102 | px1, py1, pz1 := px0+sx, py0+sy, pz0+sz 103 | p := [8]Vector{ 104 | Vector{px0, py0, pz0}, 105 | Vector{px1, py0, pz0}, 106 | Vector{px1, py1, pz0}, 107 | Vector{px0, py1, pz0}, 108 | Vector{px0, py0, pz1}, 109 | Vector{px1, py0, pz1}, 110 | Vector{px1, py1, pz1}, 111 | Vector{px0, py1, pz1}, 112 | } 113 | distinct := make(map[float64]bool) 114 | var values [8]float64 115 | for i := 0; i < 8; i++ { 116 | value := e.Evaluate(p[i].X, p[i].Y, p[i].Z) 117 | if value == 0 { 118 | continue 119 | } 120 | values[i] = value 121 | distinct[value] = true 122 | } 123 | for value := range distinct { 124 | var v [8]float64 125 | for i := range values { 126 | if values[i] == value { 127 | v[i] = 1 128 | } 129 | } 130 | triangles := mcPolygonize(p, v, 0.5) 131 | result[value] = append(result[value], triangles...) 132 | } 133 | } 134 | } 135 | } 136 | return result 137 | } 138 | 139 | func mcPolygonize(p [8]Vector, v [8]float64, x float64) []Triangle { 140 | index := 0 141 | for i := 0; i < 8; i++ { 142 | if v[i] < x { 143 | index |= 1 << uint(i) 144 | } 145 | } 146 | if edgeTable[index] == 0 { 147 | return nil 148 | } 149 | var points [12]Vector 150 | for i := 0; i < 12; i++ { 151 | bit := 1 << uint(i) 152 | if edgeTable[index]&bit != 0 { 153 | a := pairTable[i][0] 154 | b := pairTable[i][1] 155 | points[i] = mcInterpolate(p[a], p[b], v[a], v[b], x) 156 | } 157 | } 158 | table := triangleTable[index] 159 | count := len(table) / 3 160 | result := make([]Triangle, count) 161 | for i := 0; i < count; i++ { 162 | v1 := points[table[i*3+0]] 163 | v2 := points[table[i*3+1]] 164 | v3 := points[table[i*3+2]] 165 | result[i] = Triangle{v1, v2, v3} 166 | } 167 | return result 168 | } 169 | 170 | func mcInterpolate(p1, p2 Vector, v1, v2, x float64) Vector { 171 | if math.Abs(x-v1) < eps { 172 | return p1 173 | } 174 | if math.Abs(x-v2) < eps { 175 | return p2 176 | } 177 | if math.Abs(v1-v2) < eps { 178 | return p1 179 | } 180 | t := (x - v1) / (v2 - v1) 181 | return Vector{ 182 | p1.X + t*(p2.X-p1.X), 183 | p1.Y + t*(p2.Y-p1.Y), 184 | p1.Z + t*(p2.Z-p1.Z), 185 | } 186 | } 187 | 188 | var pairTable = [][]int{ 189 | {0, 1}, 190 | {1, 2}, 191 | {2, 3}, 192 | {3, 0}, 193 | {4, 5}, 194 | {5, 6}, 195 | {6, 7}, 196 | {7, 4}, 197 | {0, 4}, 198 | {1, 5}, 199 | {2, 6}, 200 | {3, 7}, 201 | } 202 | 203 | var edgeTable = []int{ 204 | 0x0000, 0x0109, 0x0203, 0x030a, 0x0406, 0x050f, 0x0605, 0x070c, 205 | 0x080c, 0x0905, 0x0a0f, 0x0b06, 0x0c0a, 0x0d03, 0x0e09, 0x0f00, 206 | 0x0190, 0x0099, 0x0393, 0x029a, 0x0596, 0x049f, 0x0795, 0x069c, 207 | 0x099c, 0x0895, 0x0b9f, 0x0a96, 0x0d9a, 0x0c93, 0x0f99, 0x0e90, 208 | 0x0230, 0x0339, 0x0033, 0x013a, 0x0636, 0x073f, 0x0435, 0x053c, 209 | 0x0a3c, 0x0b35, 0x083f, 0x0936, 0x0e3a, 0x0f33, 0x0c39, 0x0d30, 210 | 0x03a0, 0x02a9, 0x01a3, 0x00aa, 0x07a6, 0x06af, 0x05a5, 0x04ac, 211 | 0x0bac, 0x0aa5, 0x09af, 0x08a6, 0x0faa, 0x0ea3, 0x0da9, 0x0ca0, 212 | 0x0460, 0x0569, 0x0663, 0x076a, 0x0066, 0x016f, 0x0265, 0x036c, 213 | 0x0c6c, 0x0d65, 0x0e6f, 0x0f66, 0x086a, 0x0963, 0x0a69, 0x0b60, 214 | 0x05f0, 0x04f9, 0x07f3, 0x06fa, 0x01f6, 0x00ff, 0x03f5, 0x02fc, 215 | 0x0dfc, 0x0cf5, 0x0fff, 0x0ef6, 0x09fa, 0x08f3, 0x0bf9, 0x0af0, 216 | 0x0650, 0x0759, 0x0453, 0x055a, 0x0256, 0x035f, 0x0055, 0x015c, 217 | 0x0e5c, 0x0f55, 0x0c5f, 0x0d56, 0x0a5a, 0x0b53, 0x0859, 0x0950, 218 | 0x07c0, 0x06c9, 0x05c3, 0x04ca, 0x03c6, 0x02cf, 0x01c5, 0x00cc, 219 | 0x0fcc, 0x0ec5, 0x0dcf, 0x0cc6, 0x0bca, 0x0ac3, 0x09c9, 0x08c0, 220 | 0x08c0, 0x09c9, 0x0ac3, 0x0bca, 0x0cc6, 0x0dcf, 0x0ec5, 0x0fcc, 221 | 0x00cc, 0x01c5, 0x02cf, 0x03c6, 0x04ca, 0x05c3, 0x06c9, 0x07c0, 222 | 0x0950, 0x0859, 0x0b53, 0x0a5a, 0x0d56, 0x0c5f, 0x0f55, 0x0e5c, 223 | 0x015c, 0x0055, 0x035f, 0x0256, 0x055a, 0x0453, 0x0759, 0x0650, 224 | 0x0af0, 0x0bf9, 0x08f3, 0x09fa, 0x0ef6, 0x0fff, 0x0cf5, 0x0dfc, 225 | 0x02fc, 0x03f5, 0x00ff, 0x01f6, 0x06fa, 0x07f3, 0x04f9, 0x05f0, 226 | 0x0b60, 0x0a69, 0x0963, 0x086a, 0x0f66, 0x0e6f, 0x0d65, 0x0c6c, 227 | 0x036c, 0x0265, 0x016f, 0x0066, 0x076a, 0x0663, 0x0569, 0x0460, 228 | 0x0ca0, 0x0da9, 0x0ea3, 0x0faa, 0x08a6, 0x09af, 0x0aa5, 0x0bac, 229 | 0x04ac, 0x05a5, 0x06af, 0x07a6, 0x00aa, 0x01a3, 0x02a9, 0x03a0, 230 | 0x0d30, 0x0c39, 0x0f33, 0x0e3a, 0x0936, 0x083f, 0x0b35, 0x0a3c, 231 | 0x053c, 0x0435, 0x073f, 0x0636, 0x013a, 0x0033, 0x0339, 0x0230, 232 | 0x0e90, 0x0f99, 0x0c93, 0x0d9a, 0x0a96, 0x0b9f, 0x0895, 0x099c, 233 | 0x069c, 0x0795, 0x049f, 0x0596, 0x029a, 0x0393, 0x0099, 0x0190, 234 | 0x0f00, 0x0e09, 0x0d03, 0x0c0a, 0x0b06, 0x0a0f, 0x0905, 0x080c, 235 | 0x070c, 0x0605, 0x050f, 0x0406, 0x030a, 0x0203, 0x0109, 0x0000, 236 | } 237 | 238 | var triangleTable = [][]int{ 239 | {}, 240 | {0, 8, 3}, 241 | {0, 1, 9}, 242 | {1, 8, 3, 9, 8, 1}, 243 | {1, 2, 10}, 244 | {0, 8, 3, 1, 2, 10}, 245 | {9, 2, 10, 0, 2, 9}, 246 | {2, 8, 3, 2, 10, 8, 10, 9, 8}, 247 | {3, 11, 2}, 248 | {0, 11, 2, 8, 11, 0}, 249 | {1, 9, 0, 2, 3, 11}, 250 | {1, 11, 2, 1, 9, 11, 9, 8, 11}, 251 | {3, 10, 1, 11, 10, 3}, 252 | {0, 10, 1, 0, 8, 10, 8, 11, 10}, 253 | {3, 9, 0, 3, 11, 9, 11, 10, 9}, 254 | {9, 8, 10, 10, 8, 11}, 255 | {4, 7, 8}, 256 | {4, 3, 0, 7, 3, 4}, 257 | {0, 1, 9, 8, 4, 7}, 258 | {4, 1, 9, 4, 7, 1, 7, 3, 1}, 259 | {1, 2, 10, 8, 4, 7}, 260 | {3, 4, 7, 3, 0, 4, 1, 2, 10}, 261 | {9, 2, 10, 9, 0, 2, 8, 4, 7}, 262 | {2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4}, 263 | {8, 4, 7, 3, 11, 2}, 264 | {11, 4, 7, 11, 2, 4, 2, 0, 4}, 265 | {9, 0, 1, 8, 4, 7, 2, 3, 11}, 266 | {4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1}, 267 | {3, 10, 1, 3, 11, 10, 7, 8, 4}, 268 | {1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4}, 269 | {4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3}, 270 | {4, 7, 11, 4, 11, 9, 9, 11, 10}, 271 | {9, 5, 4}, 272 | {9, 5, 4, 0, 8, 3}, 273 | {0, 5, 4, 1, 5, 0}, 274 | {8, 5, 4, 8, 3, 5, 3, 1, 5}, 275 | {1, 2, 10, 9, 5, 4}, 276 | {3, 0, 8, 1, 2, 10, 4, 9, 5}, 277 | {5, 2, 10, 5, 4, 2, 4, 0, 2}, 278 | {2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8}, 279 | {9, 5, 4, 2, 3, 11}, 280 | {0, 11, 2, 0, 8, 11, 4, 9, 5}, 281 | {0, 5, 4, 0, 1, 5, 2, 3, 11}, 282 | {2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5}, 283 | {10, 3, 11, 10, 1, 3, 9, 5, 4}, 284 | {4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10}, 285 | {5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3}, 286 | {5, 4, 8, 5, 8, 10, 10, 8, 11}, 287 | {9, 7, 8, 5, 7, 9}, 288 | {9, 3, 0, 9, 5, 3, 5, 7, 3}, 289 | {0, 7, 8, 0, 1, 7, 1, 5, 7}, 290 | {1, 5, 3, 3, 5, 7}, 291 | {9, 7, 8, 9, 5, 7, 10, 1, 2}, 292 | {10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3}, 293 | {8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2}, 294 | {2, 10, 5, 2, 5, 3, 3, 5, 7}, 295 | {7, 9, 5, 7, 8, 9, 3, 11, 2}, 296 | {9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11}, 297 | {2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7}, 298 | {11, 2, 1, 11, 1, 7, 7, 1, 5}, 299 | {9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11}, 300 | {5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0}, 301 | {11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0}, 302 | {11, 10, 5, 7, 11, 5}, 303 | {10, 6, 5}, 304 | {0, 8, 3, 5, 10, 6}, 305 | {9, 0, 1, 5, 10, 6}, 306 | {1, 8, 3, 1, 9, 8, 5, 10, 6}, 307 | {1, 6, 5, 2, 6, 1}, 308 | {1, 6, 5, 1, 2, 6, 3, 0, 8}, 309 | {9, 6, 5, 9, 0, 6, 0, 2, 6}, 310 | {5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8}, 311 | {2, 3, 11, 10, 6, 5}, 312 | {11, 0, 8, 11, 2, 0, 10, 6, 5}, 313 | {0, 1, 9, 2, 3, 11, 5, 10, 6}, 314 | {5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11}, 315 | {6, 3, 11, 6, 5, 3, 5, 1, 3}, 316 | {0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6}, 317 | {3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9}, 318 | {6, 5, 9, 6, 9, 11, 11, 9, 8}, 319 | {5, 10, 6, 4, 7, 8}, 320 | {4, 3, 0, 4, 7, 3, 6, 5, 10}, 321 | {1, 9, 0, 5, 10, 6, 8, 4, 7}, 322 | {10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4}, 323 | {6, 1, 2, 6, 5, 1, 4, 7, 8}, 324 | {1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7}, 325 | {8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6}, 326 | {7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9}, 327 | {3, 11, 2, 7, 8, 4, 10, 6, 5}, 328 | {5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11}, 329 | {0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6}, 330 | {9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6}, 331 | {8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6}, 332 | {5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11}, 333 | {0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7}, 334 | {6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9}, 335 | {10, 4, 9, 6, 4, 10}, 336 | {4, 10, 6, 4, 9, 10, 0, 8, 3}, 337 | {10, 0, 1, 10, 6, 0, 6, 4, 0}, 338 | {8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10}, 339 | {1, 4, 9, 1, 2, 4, 2, 6, 4}, 340 | {3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4}, 341 | {0, 2, 4, 4, 2, 6}, 342 | {8, 3, 2, 8, 2, 4, 4, 2, 6}, 343 | {10, 4, 9, 10, 6, 4, 11, 2, 3}, 344 | {0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6}, 345 | {3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10}, 346 | {6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1}, 347 | {9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3}, 348 | {8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1}, 349 | {3, 11, 6, 3, 6, 0, 0, 6, 4}, 350 | {6, 4, 8, 11, 6, 8}, 351 | {7, 10, 6, 7, 8, 10, 8, 9, 10}, 352 | {0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10}, 353 | {10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0}, 354 | {10, 6, 7, 10, 7, 1, 1, 7, 3}, 355 | {1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7}, 356 | {2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9}, 357 | {7, 8, 0, 7, 0, 6, 6, 0, 2}, 358 | {7, 3, 2, 6, 7, 2}, 359 | {2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7}, 360 | {2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7}, 361 | {1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11}, 362 | {11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1}, 363 | {8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6}, 364 | {0, 9, 1, 11, 6, 7}, 365 | {7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0}, 366 | {7, 11, 6}, 367 | {7, 6, 11}, 368 | {3, 0, 8, 11, 7, 6}, 369 | {0, 1, 9, 11, 7, 6}, 370 | {8, 1, 9, 8, 3, 1, 11, 7, 6}, 371 | {10, 1, 2, 6, 11, 7}, 372 | {1, 2, 10, 3, 0, 8, 6, 11, 7}, 373 | {2, 9, 0, 2, 10, 9, 6, 11, 7}, 374 | {6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8}, 375 | {7, 2, 3, 6, 2, 7}, 376 | {7, 0, 8, 7, 6, 0, 6, 2, 0}, 377 | {2, 7, 6, 2, 3, 7, 0, 1, 9}, 378 | {1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6}, 379 | {10, 7, 6, 10, 1, 7, 1, 3, 7}, 380 | {10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8}, 381 | {0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7}, 382 | {7, 6, 10, 7, 10, 8, 8, 10, 9}, 383 | {6, 8, 4, 11, 8, 6}, 384 | {3, 6, 11, 3, 0, 6, 0, 4, 6}, 385 | {8, 6, 11, 8, 4, 6, 9, 0, 1}, 386 | {9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6}, 387 | {6, 8, 4, 6, 11, 8, 2, 10, 1}, 388 | {1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6}, 389 | {4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9}, 390 | {10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3}, 391 | {8, 2, 3, 8, 4, 2, 4, 6, 2}, 392 | {0, 4, 2, 4, 6, 2}, 393 | {1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8}, 394 | {1, 9, 4, 1, 4, 2, 2, 4, 6}, 395 | {8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1}, 396 | {10, 1, 0, 10, 0, 6, 6, 0, 4}, 397 | {4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3}, 398 | {10, 9, 4, 6, 10, 4}, 399 | {4, 9, 5, 7, 6, 11}, 400 | {0, 8, 3, 4, 9, 5, 11, 7, 6}, 401 | {5, 0, 1, 5, 4, 0, 7, 6, 11}, 402 | {11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5}, 403 | {9, 5, 4, 10, 1, 2, 7, 6, 11}, 404 | {6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5}, 405 | {7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2}, 406 | {3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6}, 407 | {7, 2, 3, 7, 6, 2, 5, 4, 9}, 408 | {9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7}, 409 | {3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0}, 410 | {6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8}, 411 | {9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7}, 412 | {1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4}, 413 | {4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10}, 414 | {7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10}, 415 | {6, 9, 5, 6, 11, 9, 11, 8, 9}, 416 | {3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5}, 417 | {0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11}, 418 | {6, 11, 3, 6, 3, 5, 5, 3, 1}, 419 | {1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6}, 420 | {0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10}, 421 | {11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5}, 422 | {6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3}, 423 | {5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2}, 424 | {9, 5, 6, 9, 6, 0, 0, 6, 2}, 425 | {1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8}, 426 | {1, 5, 6, 2, 1, 6}, 427 | {1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6}, 428 | {10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0}, 429 | {0, 3, 8, 5, 6, 10}, 430 | {10, 5, 6}, 431 | {11, 5, 10, 7, 5, 11}, 432 | {11, 5, 10, 11, 7, 5, 8, 3, 0}, 433 | {5, 11, 7, 5, 10, 11, 1, 9, 0}, 434 | {10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1}, 435 | {11, 1, 2, 11, 7, 1, 7, 5, 1}, 436 | {0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11}, 437 | {9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7}, 438 | {7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2}, 439 | {2, 5, 10, 2, 3, 5, 3, 7, 5}, 440 | {8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5}, 441 | {9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2}, 442 | {9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2}, 443 | {1, 3, 5, 3, 7, 5}, 444 | {0, 8, 7, 0, 7, 1, 1, 7, 5}, 445 | {9, 0, 3, 9, 3, 5, 5, 3, 7}, 446 | {9, 8, 7, 5, 9, 7}, 447 | {5, 8, 4, 5, 10, 8, 10, 11, 8}, 448 | {5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0}, 449 | {0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5}, 450 | {10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4}, 451 | {2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8}, 452 | {0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11}, 453 | {0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5}, 454 | {9, 4, 5, 2, 11, 3}, 455 | {2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4}, 456 | {5, 10, 2, 5, 2, 4, 4, 2, 0}, 457 | {3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9}, 458 | {5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2}, 459 | {8, 4, 5, 8, 5, 3, 3, 5, 1}, 460 | {0, 4, 5, 1, 0, 5}, 461 | {8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5}, 462 | {9, 4, 5}, 463 | {4, 11, 7, 4, 9, 11, 9, 10, 11}, 464 | {0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11}, 465 | {1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11}, 466 | {3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4}, 467 | {4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2}, 468 | {9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3}, 469 | {11, 7, 4, 11, 4, 2, 2, 4, 0}, 470 | {11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4}, 471 | {2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9}, 472 | {9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7}, 473 | {3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10}, 474 | {1, 10, 2, 8, 7, 4}, 475 | {4, 9, 1, 4, 1, 7, 7, 1, 3}, 476 | {4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1}, 477 | {4, 0, 3, 7, 4, 3}, 478 | {4, 8, 7}, 479 | {9, 10, 8, 10, 11, 8}, 480 | {3, 0, 9, 3, 9, 11, 11, 9, 10}, 481 | {0, 1, 10, 0, 10, 8, 8, 10, 11}, 482 | {3, 1, 10, 11, 3, 10}, 483 | {1, 2, 11, 1, 11, 9, 9, 11, 8}, 484 | {3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9}, 485 | {0, 2, 11, 8, 0, 11}, 486 | {3, 2, 11}, 487 | {2, 3, 8, 2, 8, 10, 10, 8, 9}, 488 | {9, 10, 2, 0, 9, 2}, 489 | {2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8}, 490 | {1, 10, 2}, 491 | {1, 3, 8, 9, 1, 8}, 492 | {0, 9, 1}, 493 | {0, 3, 8}, 494 | {}, 495 | } 496 | --------------------------------------------------------------------------------