From e7b8ae6120fc1153f77158610db81f2c3cb2a3f9 Mon Sep 17 00:00:00 2001 From: Daniel Ledda Date: Wed, 2 Jun 2021 08:50:52 +0200 Subject: [PATCH] updates --- .gitignore | 2 + .idea/deno.xml | 6 - .idea/soma.iml | 1 + .idea/workspace.xml | 75 +- .vscode/extensions.json | 3 - .vscode/settings.json | 3 - package-lock.json | 7 +- package.json | 6 +- public/resources/bevel-cube/000000.mtl | 12 + public/resources/bevel-cube/000001.mtl | 10 + public/resources/bevel-cube/000001.obj | 287 +++++++ public/resources/bevel-cube/none.obj | 676 +++++++++++++++++ public/resources/bevel-cube/x.mtl | 12 + public/resources/bevel-cube/x.obj | 455 +++++++++++ public/resources/bevel-cube/xy.mtl | 12 + public/resources/bevel-cube/xy.obj | 299 ++++++++ public/resources/bevel-cube/xymx.mtl | 12 + public/resources/bevel-cube/xymx.obj | 131 ++++ public/resources/bevel-cube/xymxmy.mtl | 12 + public/resources/bevel-cube/xymxmy.obj | 47 ++ public/resources/bevel-cube/xyz.mtl | 12 + public/resources/bevel-cube/xyz.obj | 197 +++++ public/resources/bevel-cube/xyzmx.mtl | 12 + public/resources/bevel-cube/xyzmx.obj | 88 +++ public/resources/bevel_cube.mtl | 10 + public/resources/bevel_cube.obj | 557 ++++++++++++++ public/solver/SomaSolution.js | 88 +++ public/solver/SomaSolver.js | 48 ++ public/solver/VoxelSpace.js | 275 +++++++ public/solver/main.js | 8 + report.20210524.173340.100206.0.001.json | 571 -------------- report.20210524.182447.107803.0.001.json | 571 -------------- src/App.svelte | 18 +- src/CubeInput.svelte | 19 +- src/OBJLoader.js | 911 +++++++++++++++++++++++ src/OrbitControls.js | 795 -------------------- src/Polycube3D.svelte | 33 +- src/PolycubeScene.ts | 165 ++++ src/RotationControl.ts | 45 ++ src/Sidebar.svelte | 28 +- src/SolutionInteractor.svelte | 8 +- src/SolutionList.svelte | 30 + src/solver/SomaSolution.ts | 14 + src/solver/SomaSolver.ts | 10 +- src/solver/VoxelSpace.ts | 9 +- src/solver/main.js | 10 - src/solver/main.ts | 111 +-- src/store.ts | 28 +- src/threeTest.ts | 134 ---- tsconfig.json | 8 +- 50 files changed, 4609 insertions(+), 2272 deletions(-) delete mode 100644 .idea/deno.xml delete mode 100644 .vscode/extensions.json delete mode 100644 .vscode/settings.json create mode 100644 public/resources/bevel-cube/000000.mtl create mode 100644 public/resources/bevel-cube/000001.mtl create mode 100644 public/resources/bevel-cube/000001.obj create mode 100644 public/resources/bevel-cube/none.obj create mode 100644 public/resources/bevel-cube/x.mtl create mode 100644 public/resources/bevel-cube/x.obj create mode 100644 public/resources/bevel-cube/xy.mtl create mode 100644 public/resources/bevel-cube/xy.obj create mode 100644 public/resources/bevel-cube/xymx.mtl create mode 100644 public/resources/bevel-cube/xymx.obj create mode 100644 public/resources/bevel-cube/xymxmy.mtl create mode 100644 public/resources/bevel-cube/xymxmy.obj create mode 100644 public/resources/bevel-cube/xyz.mtl create mode 100644 public/resources/bevel-cube/xyz.obj create mode 100644 public/resources/bevel-cube/xyzmx.mtl create mode 100644 public/resources/bevel-cube/xyzmx.obj create mode 100644 public/resources/bevel_cube.mtl create mode 100644 public/resources/bevel_cube.obj create mode 100644 public/solver/SomaSolution.js create mode 100644 public/solver/SomaSolver.js create mode 100644 public/solver/VoxelSpace.js create mode 100644 public/solver/main.js delete mode 100644 report.20210524.173340.100206.0.001.json delete mode 100644 report.20210524.182447.107803.0.001.json create mode 100644 src/OBJLoader.js delete mode 100644 src/OrbitControls.js create mode 100644 src/PolycubeScene.ts create mode 100644 src/RotationControl.ts create mode 100644 src/SolutionList.svelte delete mode 100644 src/solver/main.js delete mode 100644 src/threeTest.ts diff --git a/.gitignore b/.gitignore index 146078c..555f981 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /node_modules /public/build/ +/.vscode +/.idea diff --git a/.idea/deno.xml b/.idea/deno.xml deleted file mode 100644 index b03feb5..0000000 --- a/.idea/deno.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/soma.iml b/.idea/soma.iml index 24643cc..85d8fe3 100644 --- a/.idea/soma.iml +++ b/.idea/soma.iml @@ -3,6 +3,7 @@ + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ebd1ecd..3ffd6ff 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,29 +2,32 @@ - - - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -65,12 +69,14 @@ - + + + @@ -98,21 +104,36 @@ + + + + + + - + - + + + + + @@ -122,6 +143,10 @@ + + + + diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index bdef820..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "recommendations": ["svelte.svelte-vscode"] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 29bb3b1..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "svelte.enable-ts-plugin": true -} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1957e6c..e5d4bae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -934,10 +934,9 @@ "dev": true }, "typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", - "dev": true + "version": "4.4.0-dev.20210525", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.0-dev.20210525.tgz", + "integrity": "sha512-hpPEilDaUKKUgh7UmsjDzf3+8dSVICYRHxrXLFOhhKe5gHktNYVFGYdRhUApIPbWhAbwJxIssM3X89QW/+y/+A==" }, "wrappy": { "version": "1.0.2", diff --git a/package.json b/package.json index 49d35bd..93d9969 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ "svelte": "^3.0.0", "svelte-check": "^1.0.0", "svelte-preprocess": "^4.0.0", - "tslib": "^2.0.0", - "typescript": "^4.0.0" + "tslib": "^2.0.0" }, "dependencies": { "sirv-cli": "^1.0.0", - "three": "^0.128.0" + "three": "^0.128.0", + "typescript": "^4.4.0-dev.20210525" } } diff --git a/public/resources/bevel-cube/000000.mtl b/public/resources/bevel-cube/000000.mtl new file mode 100644 index 0000000..5882e03 --- /dev/null +++ b/public/resources/bevel-cube/000000.mtl @@ -0,0 +1,12 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500.000001 +Ka 1.000000 1.000000 1.000000 +Kd 0.800000 0.800000 0.800000 +Ks 0.800000 0.800000 0.800000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 diff --git a/public/resources/bevel-cube/000001.mtl b/public/resources/bevel-cube/000001.mtl new file mode 100644 index 0000000..f231bdf --- /dev/null +++ b/public/resources/bevel-cube/000001.mtl @@ -0,0 +1,10 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500 +Ka 0.8 0.8 0.8 +Kd 0.8 0.8 0.8 +Ks 0.8 0.8 0.8 +d 1 +illum 2 diff --git a/public/resources/bevel-cube/000001.obj b/public/resources/bevel-cube/000001.obj new file mode 100644 index 0000000..05a67fe --- /dev/null +++ b/public/resources/bevel-cube/000001.obj @@ -0,0 +1,287 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib 000001.mtl +o Cube_Cube.001 +v -0.447727 0.391799 0.476834 +v -0.391799 0.391799 0.500000 +v -0.391799 0.447727 0.476834 +v -0.449707 0.449707 0.449707 +v -0.391799 0.476834 0.447727 +v -0.391799 0.500000 0.391799 +v -0.447727 0.476834 0.391799 +v -0.476834 0.391799 0.447727 +v -0.476834 0.447727 0.391799 +v -0.500000 0.391799 0.391799 +v -0.447727 0.476834 -0.391799 +v -0.391799 0.500000 -0.391799 +v -0.391799 0.476834 -0.447727 +v -0.449707 0.449707 -0.449707 +v -0.391799 0.447727 -0.476834 +v -0.391799 0.391799 -0.500000 +v -0.447727 0.391799 -0.476834 +v -0.476834 0.447727 -0.391799 +v -0.476834 0.391799 -0.447727 +v -0.500000 0.391799 -0.391799 +v 0.447727 0.476834 0.391799 +v 0.391799 0.500000 0.391799 +v 0.391799 0.476834 0.447727 +v 0.449707 0.449707 0.449707 +v 0.391799 0.447727 0.476834 +v 0.391799 0.391799 0.500000 +v 0.447727 0.391799 0.476834 +v 0.476834 0.447727 0.391799 +v 0.476834 0.391799 0.447727 +v 0.500000 0.391799 0.391799 +v 0.391799 0.476834 -0.447727 +v 0.391799 0.500000 -0.391799 +v 0.447727 0.476834 -0.391799 +v 0.449707 0.449707 -0.449707 +v 0.476834 0.447727 -0.391799 +v 0.500000 0.391799 -0.391799 +v 0.476834 0.391799 -0.447727 +v 0.391799 0.447727 -0.476834 +v 0.447727 0.391799 -0.476834 +v 0.391799 0.391799 -0.500000 +v -0.447727 -0.504219 0.476834 +v -0.391799 -0.504219 0.500000 +v -0.476834 -0.504219 0.447727 +v -0.500000 -0.504219 0.391799 +v -0.391799 -0.504219 -0.500000 +v -0.447727 -0.504219 -0.476834 +v -0.476834 -0.504219 -0.447727 +v -0.500000 -0.504219 -0.391799 +v 0.391799 -0.504219 0.500000 +v 0.447727 -0.504219 0.476834 +v 0.476834 -0.504219 0.447727 +v 0.500000 -0.504219 0.391799 +v 0.500000 -0.504219 -0.391799 +v 0.476834 -0.504219 -0.447727 +v 0.447727 -0.504219 -0.476834 +v 0.391799 -0.504219 -0.500000 +vt 0.632277 0.527050 +vt 0.632277 0.722950 +vt 0.617723 0.722950 +vt 0.617723 0.527050 +vt 0.652050 0.736932 +vt 0.847950 0.736932 +vt 0.847950 0.744209 +vt 0.652050 0.744209 +vt 0.847950 0.513068 +vt 0.652050 0.513068 +vt 0.652050 0.505791 +vt 0.847950 0.505791 +vt 0.652050 0.527050 +vt 0.847950 0.527050 +vt 0.847950 0.722950 +vt 0.652050 0.722950 +vt 0.861932 0.722950 +vt 0.861932 0.527050 +vt 0.869209 0.527050 +vt 0.869208 0.722950 +vt 0.597950 0.986932 +vt 0.597950 0.981140 +vt 0.606140 0.981140 +vt 0.606140 0.991171 +vt 0.847950 0.731140 +vt 0.856140 0.731140 +vt 0.856140 0.741171 +vt 0.597950 0.994209 +vt 0.606140 0.989969 +vt 0.606140 1.000000 +vt 0.597950 1.000000 +vt 0.862828 0.512172 +vt 0.847950 0.500000 +vt 0.856140 0.500000 +vt 0.856140 0.510031 +vt 0.864969 0.518860 +vt 0.875000 0.518860 +vt 0.875000 0.527050 +vt 0.643860 0.722950 +vt 0.643860 0.731140 +vt 0.623797 0.731140 +vt 0.652050 0.750000 +vt 0.643860 0.750000 +vt 0.643860 0.739969 +vt 0.626203 0.731140 +vt 0.606140 0.731140 +vt 0.606140 0.722950 +vt 0.652050 0.518860 +vt 0.643860 0.518860 +vt 0.643860 0.508829 +vt 0.606140 0.527050 +vt 0.606140 0.518860 +vt 0.626203 0.518860 +vt 0.643860 0.510031 +vt 0.643860 0.500000 +vt 0.652050 0.500000 +vt 0.612828 0.986625 +vt 0.856140 0.739969 +vt 0.866171 0.731140 +vt 0.861625 0.512172 +vt 0.597950 0.257277 +vt 0.597950 0.242723 +vt 0.606140 0.248797 +vt 0.637172 0.737828 +vt 0.597950 0.757277 +vt 0.597950 0.742723 +vt 0.606140 0.748798 +vt 0.637172 0.513375 +vt 0.623797 0.518860 +vt 0.597950 0.507277 +vt 0.597950 0.492723 +vt 0.606140 0.498798 +vt 0.597950 0.222950 +vt 0.597950 0.027050 +vt 0.606140 0.027050 +vt 0.606140 0.222950 +vt 0.597950 0.472950 +vt 0.597950 0.277050 +vt 0.606140 0.277050 +vt 0.606140 0.472950 +vt 0.597950 0.722950 +vt 0.597950 0.527050 +vt 0.597950 0.972950 +vt 0.597950 0.777050 +vt 0.606140 0.777050 +vt 0.606140 0.972950 +vt 0.643860 0.500000 +vt 0.652050 0.500000 +vt 0.597950 0.757277 +vt 0.597950 0.742723 +vt 0.597950 0.994209 +vt 0.597950 0.986932 +vt 0.597950 1.000000 +vt 0.597950 0.222950 +vt 0.597950 0.027050 +vt 0.597950 0.722950 +vt 0.597950 0.527050 +vt 0.847950 0.500000 +vt 0.856140 0.500000 +vt 0.652050 0.750000 +vt 0.643860 0.750000 +vt 0.597950 0.981140 +vt 0.606140 0.527050 +vt 0.606140 0.518860 +vt 0.597950 0.257277 +vt 0.597950 0.242723 +vt 0.875000 0.518860 +vt 0.875000 0.527050 +vt 0.597950 0.507277 +vt 0.597950 0.492723 +vt 0.597950 0.472950 +vt 0.597950 0.277050 +vt 0.606140 0.731140 +vt 0.606140 0.722950 +vt 0.597950 0.972950 +vt 0.597950 0.777050 +vn 0.5505 0.8168 -0.1727 +vn 0.5518 0.8162 0.1716 +vn 0.8162 0.5518 0.1714 +vn 0.8162 0.5518 -0.1716 +vn 0.1714 0.8162 0.5518 +vn -0.1715 0.8171 0.5503 +vn -0.1714 0.5518 0.8162 +vn 0.1716 0.5518 0.8162 +vn -0.1714 0.8162 -0.5518 +vn 0.1716 0.8162 -0.5518 +vn 0.1714 0.5518 -0.8162 +vn -0.1716 0.5518 -0.8162 +vn 0.1955 0.9610 -0.1955 +vn -0.1955 0.9610 -0.1955 +vn -0.1955 0.9610 0.1955 +vn 0.1939 0.9617 0.1939 +vn -0.5518 0.8162 0.1714 +vn -0.5518 0.8162 -0.1716 +vn -0.8162 0.5518 -0.1714 +vn -0.8162 0.5518 0.1716 +vn -0.5518 0.1714 0.8162 +vn -0.1955 0.1955 0.9610 +vn -0.5795 0.5795 0.5730 +vn -0.8171 0.1716 0.5503 +vn -0.9610 0.1955 0.1955 +vn -0.5774 0.5774 -0.5774 +vn -0.1955 0.1955 -0.9610 +vn -0.5518 0.1714 -0.8162 +vn -0.8162 0.1714 -0.5518 +vn -0.9610 0.1955 -0.1955 +vn 0.5774 0.5774 0.5774 +vn 0.1955 0.1955 0.9610 +vn 0.5518 0.1714 0.8162 +vn 0.8162 0.1714 0.5518 +vn 0.9610 0.1955 0.1955 +vn 0.5739 0.5791 -0.5791 +vn 0.9610 0.1955 -0.1955 +vn 0.8156 0.1713 -0.5527 +vn 0.5518 0.1714 -0.8162 +vn 0.1955 0.1955 -0.9610 +vn 0.5556 0.0000 -0.8315 +vn 0.1951 0.0000 -0.9808 +vn 0.5556 0.0000 0.8315 +vn 0.8315 0.0000 0.5556 +vn -0.8315 0.0000 0.5556 +vn -0.5556 0.0000 0.8315 +vn -0.9808 0.0000 0.1951 +vn -0.9808 0.0000 -0.1951 +vn 0.9808 0.0000 0.1951 +vn 0.9808 0.0000 -0.1951 +vn -0.1951 0.0000 -0.9808 +vn -0.5556 0.0000 -0.8315 +vn 0.1951 0.0000 0.9808 +vn -0.1951 0.0000 0.9808 +vn 0.8315 0.0000 -0.5556 +vn -0.8315 0.0000 -0.5556 +usemtl None +s 1 +f 33/1/1 21/2/2 28/3/3 35/4/4 +f 23/5/5 5/6/6 3/7/7 25/8/8 +f 13/9/9 31/10/10 38/11/11 15/12/12 +f 32/13/13 12/14/14 6/15/15 22/16/16 +f 7/17/17 11/18/18 18/19/19 9/20/20 +f 1/21/21 2/22/22 3/23/7 4/24/23 +f 5/6/6 6/25/15 7/26/17 4/27/23 +f 8/28/24 4/29/23 9/30/20 10/31/25 +f 11/18/18 12/14/14 13/9/9 14/32/26 +f 15/12/12 16/33/27 17/34/28 14/35/26 +f 18/19/19 14/36/26 19/37/29 20/38/30 +f 21/2/2 22/39/16 23/40/5 24/41/31 +f 25/8/8 26/42/32 27/43/33 24/44/31 +f 28/3/3 24/45/31 29/46/34 30/47/35 +f 31/10/10 32/48/13 33/49/1 34/50/36 +f 35/4/4 36/51/37 37/52/38 34/53/36 +f 38/11/11 34/54/36 39/55/39 40/56/40 +f 8/28/24 1/21/21 4/57/23 +f 3/7/7 5/6/6 4/58/23 +f 7/17/17 9/20/20 4/59/23 +f 18/19/19 11/18/18 14/60/26 +f 13/9/9 15/12/12 14/32/26 +f 17/61/28 19/62/29 14/63/26 +f 28/3/3 21/2/2 24/45/31 +f 23/5/5 25/8/8 24/64/31 +f 27/65/33 29/66/34 24/67/31 +f 38/11/11 31/10/10 34/68/36 +f 33/1/1 35/4/4 34/69/36 +f 37/70/38 39/71/39 34/72/36 +f 6/15/15 12/14/14 11/18/18 7/17/17 +f 20/73/30 10/74/25 9/75/20 18/76/19 +f 12/14/14 32/13/13 31/10/10 13/9/9 +f 40/77/40 16/78/27 15/79/12 38/80/11 +f 32/13/13 22/16/16 21/2/2 33/1/1 +f 30/81/35 36/82/37 35/4/4 28/3/3 +f 22/16/16 6/15/15 5/6/6 23/5/5 +f 2/83/22 26/84/32 25/85/8 3/86/7 +f 40/56/40 39/55/39 55/87/41 56/88/42 +f 29/66/34 27/65/33 50/89/43 51/90/44 +f 1/21/21 8/28/24 43/91/45 41/92/46 +f 8/28/24 10/31/25 44/93/47 43/91/45 +f 10/74/25 20/73/30 48/94/48 44/95/47 +f 36/82/37 30/81/35 52/96/49 53/97/50 +f 17/34/28 16/33/27 45/98/51 46/99/52 +f 27/43/33 26/42/32 49/100/53 50/101/43 +f 2/22/22 1/21/21 41/92/46 42/102/54 +f 37/52/38 36/51/37 53/103/50 54/104/55 +f 19/62/29 17/61/28 46/105/52 47/106/56 +f 20/38/30 19/37/29 47/107/56 48/108/48 +f 39/71/39 37/70/38 54/109/55 55/110/41 +f 16/78/27 40/77/40 56/111/42 45/112/51 +f 30/47/35 29/46/34 51/113/44 52/114/49 +f 26/84/32 2/83/22 42/115/54 49/116/53 diff --git a/public/resources/bevel-cube/none.obj b/public/resources/bevel-cube/none.obj new file mode 100644 index 0000000..3ce257c --- /dev/null +++ b/public/resources/bevel-cube/none.obj @@ -0,0 +1,676 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib 000000.mtl +o Cube_Cube.001 +v 0.399961 0.500000 -0.399961 +v 0.500000 0.399961 -0.399961 +v 0.399961 0.399961 -0.500000 +v 0.438244 0.492385 -0.399961 +v 0.470699 0.470699 -0.399961 +v 0.399961 0.492385 -0.438244 +v 0.439203 0.483194 -0.439203 +v 0.465612 0.465612 -0.437212 +v 0.457718 0.457718 -0.457718 +v 0.492385 0.399961 -0.438244 +v 0.470699 0.399961 -0.470699 +v 0.492385 0.438244 -0.399961 +v 0.483194 0.439203 -0.439203 +v 0.465612 0.437212 -0.465612 +v 0.399961 0.438244 -0.492385 +v 0.399961 0.470699 -0.470699 +v 0.438244 0.399961 -0.492385 +v 0.439203 0.439203 -0.483194 +v 0.437212 0.465612 -0.465612 +v 0.500000 -0.399961 -0.399961 +v 0.399961 -0.500000 -0.399961 +v 0.399961 -0.399961 -0.500000 +v 0.492385 -0.438244 -0.399961 +v 0.470699 -0.470699 -0.399961 +v 0.492385 -0.399961 -0.438244 +v 0.483194 -0.439203 -0.439203 +v 0.465612 -0.465612 -0.437212 +v 0.457718 -0.457718 -0.457718 +v 0.399961 -0.492385 -0.438244 +v 0.399961 -0.470699 -0.470699 +v 0.438244 -0.492385 -0.399961 +v 0.439203 -0.483194 -0.439203 +v 0.437212 -0.465612 -0.465612 +v 0.438244 -0.399961 -0.492385 +v 0.470699 -0.399961 -0.470699 +v 0.399961 -0.438244 -0.492385 +v 0.439203 -0.439203 -0.483194 +v 0.465612 -0.437212 -0.465612 +v 0.500000 0.399961 0.399961 +v 0.399961 0.500000 0.399961 +v 0.399961 0.399961 0.500000 +v 0.492385 0.438244 0.399961 +v 0.470699 0.470699 0.399961 +v 0.492385 0.399961 0.438244 +v 0.483194 0.439203 0.439203 +v 0.465612 0.465612 0.437212 +v 0.457718 0.457718 0.457718 +v 0.399961 0.492385 0.438244 +v 0.399961 0.470699 0.470699 +v 0.438244 0.492385 0.399961 +v 0.439203 0.483194 0.439203 +v 0.437212 0.465612 0.465612 +v 0.438244 0.399961 0.492385 +v 0.470699 0.399961 0.470699 +v 0.399961 0.438244 0.492385 +v 0.439203 0.439203 0.483194 +v 0.465612 0.437212 0.465612 +v 0.399961 -0.399961 0.500000 +v 0.399961 -0.500000 0.399961 +v 0.500000 -0.399961 0.399961 +v 0.399961 -0.438244 0.492385 +v 0.399961 -0.470699 0.470699 +v 0.438244 -0.399961 0.492385 +v 0.439203 -0.439203 0.483194 +v 0.437212 -0.465612 0.465612 +v 0.457718 -0.457718 0.457718 +v 0.438244 -0.492385 0.399961 +v 0.470699 -0.470699 0.399961 +v 0.399961 -0.492385 0.438244 +v 0.439203 -0.483194 0.439203 +v 0.465612 -0.465612 0.437212 +v 0.492385 -0.399961 0.438244 +v 0.470699 -0.399961 0.470699 +v 0.492385 -0.438244 0.399961 +v 0.483194 -0.439203 0.439203 +v 0.465612 -0.437212 0.465612 +v -0.500000 0.399961 -0.399961 +v -0.399961 0.500000 -0.399961 +v -0.399961 0.399961 -0.500000 +v -0.492385 0.438244 -0.399961 +v -0.470699 0.470699 -0.399961 +v -0.492385 0.399961 -0.438244 +v -0.483194 0.439203 -0.439203 +v -0.465612 0.465612 -0.437212 +v -0.457718 0.457718 -0.457718 +v -0.399961 0.492385 -0.438244 +v -0.399961 0.470699 -0.470699 +v -0.438244 0.492385 -0.399961 +v -0.439203 0.483194 -0.439203 +v -0.437212 0.465612 -0.465612 +v -0.438244 0.399961 -0.492385 +v -0.470699 0.399961 -0.470699 +v -0.399961 0.438244 -0.492385 +v -0.439203 0.439203 -0.483194 +v -0.465612 0.437212 -0.465612 +v -0.399961 -0.399961 -0.500000 +v -0.399961 -0.500000 -0.399961 +v -0.500000 -0.399961 -0.399961 +v -0.399961 -0.438244 -0.492385 +v -0.399961 -0.470699 -0.470699 +v -0.438244 -0.399961 -0.492385 +v -0.439203 -0.439203 -0.483194 +v -0.437212 -0.465612 -0.465612 +v -0.457718 -0.457718 -0.457718 +v -0.438244 -0.492385 -0.399961 +v -0.470699 -0.470699 -0.399961 +v -0.399961 -0.492385 -0.438244 +v -0.439203 -0.483194 -0.439203 +v -0.465612 -0.465612 -0.437212 +v -0.492385 -0.399961 -0.438244 +v -0.470699 -0.399961 -0.470699 +v -0.492385 -0.438244 -0.399961 +v -0.483194 -0.439203 -0.439203 +v -0.465612 -0.437212 -0.465612 +v -0.500000 0.399961 0.399961 +v -0.399961 0.399961 0.500000 +v -0.399961 0.500000 0.399961 +v -0.492385 0.399961 0.438244 +v -0.470699 0.399961 0.470699 +v -0.492385 0.438244 0.399961 +v -0.483194 0.439203 0.439203 +v -0.465612 0.437212 0.465612 +v -0.457718 0.457718 0.457718 +v -0.399961 0.438244 0.492385 +v -0.399961 0.470699 0.470699 +v -0.438244 0.399961 0.492385 +v -0.439203 0.439203 0.483194 +v -0.437212 0.465612 0.465612 +v -0.438244 0.492385 0.399961 +v -0.470699 0.470699 0.399961 +v -0.399961 0.492385 0.438244 +v -0.439203 0.483194 0.439203 +v -0.465612 0.465612 0.437212 +v -0.399961 -0.399961 0.500000 +v -0.500000 -0.399961 0.399961 +v -0.399961 -0.500000 0.399961 +v -0.438244 -0.399961 0.492385 +v -0.470699 -0.399961 0.470699 +v -0.399961 -0.438244 0.492385 +v -0.439203 -0.439203 0.483194 +v -0.465612 -0.437212 0.465612 +v -0.457718 -0.457718 0.457718 +v -0.492385 -0.438244 0.399961 +v -0.470699 -0.470699 0.399961 +v -0.492385 -0.399961 0.438244 +v -0.483194 -0.439203 0.439203 +v -0.465612 -0.465612 0.437212 +v -0.399961 -0.492385 0.438244 +v -0.399961 -0.470699 0.470699 +v -0.438244 -0.492385 0.399961 +v -0.439203 -0.483194 0.439203 +v -0.437212 -0.465612 0.465612 +vt 0.150010 0.525010 +vt 0.349990 0.525010 +vt 0.349990 0.724990 +vt 0.150010 0.724990 +vt 0.650010 0.525010 +vt 0.849990 0.525010 +vt 0.849990 0.724990 +vt 0.650010 0.724990 +vt 0.400010 0.275010 +vt 0.599990 0.275010 +vt 0.599990 0.474990 +vt 0.400010 0.474990 +vt 0.400010 0.775010 +vt 0.599990 0.775010 +vt 0.599990 0.974990 +vt 0.400010 0.974990 +vt 0.400010 0.025010 +vt 0.599990 0.025010 +vt 0.599990 0.224990 +vt 0.400010 0.224990 +vt 0.400010 0.525010 +vt 0.390439 0.525010 +vt 0.390199 0.515199 +vt 0.400010 0.515439 +vt 0.375000 0.525010 +vt 0.375000 0.515697 +vt 0.390697 0.500000 +vt 0.400010 0.500000 +vt 0.375000 0.510570 +vt 0.599990 0.265439 +vt 0.609801 0.265199 +vt 0.609561 0.275010 +vt 0.599990 0.250000 +vt 0.609303 0.250000 +vt 0.625000 0.265697 +vt 0.625000 0.275010 +vt 0.614430 0.250000 +vt 0.859561 0.724990 +vt 0.859801 0.734801 +vt 0.849990 0.734561 +vt 0.875000 0.724990 +vt 0.875000 0.734303 +vt 0.859303 0.750000 +vt 0.849990 0.750000 +vt 0.875000 0.739430 +vt 0.390439 0.275010 +vt 0.390199 0.265199 +vt 0.400010 0.265439 +vt 0.375000 0.275010 +vt 0.375000 0.265697 +vt 0.390697 0.250000 +vt 0.400010 0.250000 +vt 0.375000 0.260570 +vt 0.599990 0.015439 +vt 0.609801 0.015199 +vt 0.609561 0.025010 +vt 0.599990 0.000000 +vt 0.609303 0.000000 +vt 0.625000 0.015697 +vt 0.625000 0.025010 +vt 0.614430 0.000000 +vt 0.650010 0.734561 +vt 0.640199 0.734801 +vt 0.640439 0.724990 +vt 0.650010 0.750000 +vt 0.640697 0.750000 +vt 0.625000 0.734303 +vt 0.625000 0.724990 +vt 0.635570 0.750000 +vt 0.609561 0.474990 +vt 0.609801 0.484801 +vt 0.599990 0.484561 +vt 0.625000 0.474990 +vt 0.625000 0.484303 +vt 0.609303 0.500000 +vt 0.599990 0.500000 +vt 0.625000 0.489430 +vt 0.400010 0.724990 +vt 0.400010 0.734561 +vt 0.390199 0.734801 +vt 0.390439 0.724990 +vt 0.400010 0.750000 +vt 0.390697 0.750000 +vt 0.375000 0.734303 +vt 0.375000 0.724990 +vt 0.385570 0.750000 +vt 0.349990 0.515439 +vt 0.359801 0.515199 +vt 0.359561 0.525010 +vt 0.349990 0.500000 +vt 0.359303 0.500000 +vt 0.375000 0.515697 +vt 0.375000 0.525010 +vt 0.364430 0.500000 +vt 0.140439 0.525010 +vt 0.140199 0.515199 +vt 0.150010 0.515439 +vt 0.125000 0.525010 +vt 0.125000 0.515697 +vt 0.140697 0.500000 +vt 0.150010 0.500000 +vt 0.125000 0.510570 +vt 0.609561 0.224990 +vt 0.609801 0.234801 +vt 0.599990 0.234561 +vt 0.625000 0.224990 +vt 0.625000 0.234303 +vt 0.609303 0.250000 +vt 0.599990 0.250000 +vt 0.625000 0.239430 +vt 0.400010 0.484561 +vt 0.390199 0.484801 +vt 0.390439 0.474990 +vt 0.400010 0.500000 +vt 0.390697 0.500000 +vt 0.375000 0.484303 +vt 0.375000 0.474990 +vt 0.385570 0.500000 +vt 0.609561 0.974990 +vt 0.609801 0.984801 +vt 0.599990 0.984561 +vt 0.625000 0.974990 +vt 0.625000 0.984303 +vt 0.609303 1.000000 +vt 0.599990 1.000000 +vt 0.625000 0.989430 +vt 0.599990 0.525010 +vt 0.599990 0.515439 +vt 0.609801 0.515199 +vt 0.609561 0.525010 +vt 0.599990 0.500000 +vt 0.609303 0.500000 +vt 0.625000 0.515697 +vt 0.625000 0.525010 +vt 0.614430 0.500000 +vt 0.849990 0.515439 +vt 0.859801 0.515199 +vt 0.859561 0.525010 +vt 0.849990 0.500000 +vt 0.859303 0.500000 +vt 0.875000 0.515697 +vt 0.875000 0.525010 +vt 0.864430 0.500000 +vt 0.640439 0.525010 +vt 0.640199 0.515199 +vt 0.650010 0.515439 +vt 0.625000 0.525010 +vt 0.625000 0.515697 +vt 0.640697 0.500000 +vt 0.650010 0.500000 +vt 0.625000 0.510570 +vt 0.390439 0.025010 +vt 0.390199 0.015199 +vt 0.400010 0.015439 +vt 0.375000 0.025010 +vt 0.375000 0.015697 +vt 0.390697 0.000000 +vt 0.400010 0.000000 +vt 0.375000 0.010570 +vt 0.400010 0.984561 +vt 0.390199 0.984801 +vt 0.390439 0.974990 +vt 0.400010 1.000000 +vt 0.390697 1.000000 +vt 0.375000 0.984303 +vt 0.375000 0.974990 +vt 0.385570 1.000000 +vt 0.599990 0.765439 +vt 0.609801 0.765199 +vt 0.609561 0.775010 +vt 0.599990 0.750000 +vt 0.609303 0.750000 +vt 0.625000 0.765697 +vt 0.625000 0.775010 +vt 0.614430 0.750000 +vt 0.359561 0.724990 +vt 0.359801 0.734801 +vt 0.349990 0.734561 +vt 0.375000 0.724990 +vt 0.375000 0.734303 +vt 0.359303 0.750000 +vt 0.349990 0.750000 +vt 0.375000 0.739430 +vt 0.599990 0.724990 +vt 0.609561 0.724990 +vt 0.609801 0.734801 +vt 0.599990 0.734561 +vt 0.625000 0.724990 +vt 0.625000 0.734303 +vt 0.609303 0.750000 +vt 0.599990 0.750000 +vt 0.625000 0.739430 +vt 0.150010 0.734561 +vt 0.140199 0.734801 +vt 0.140439 0.724990 +vt 0.150010 0.750000 +vt 0.140697 0.750000 +vt 0.125000 0.734303 +vt 0.125000 0.724990 +vt 0.135570 0.750000 +vt 0.390439 0.775010 +vt 0.390199 0.765199 +vt 0.400010 0.765439 +vt 0.375000 0.775010 +vt 0.375000 0.765697 +vt 0.390697 0.750000 +vt 0.400010 0.750000 +vt 0.375000 0.760570 +vt 0.400010 0.234561 +vt 0.390199 0.234801 +vt 0.390439 0.224990 +vt 0.400010 0.250000 +vt 0.390697 0.250000 +vt 0.375000 0.234303 +vt 0.375000 0.224990 +vt 0.385570 0.250000 +vn 0.1004 -0.1004 0.9899 +vn 0.1004 0.1004 0.9899 +vn -0.1004 0.1004 0.9899 +vn -0.1004 -0.1004 0.9899 +vn -0.1004 -0.1004 -0.9899 +vn -0.1004 0.1004 -0.9899 +vn 0.1004 0.1004 -0.9899 +vn 0.1004 -0.1004 -0.9899 +vn 0.9899 -0.1004 -0.1004 +vn 0.9899 0.1004 -0.1004 +vn 0.9899 0.1004 0.1004 +vn 0.9899 -0.1004 0.1004 +vn -0.9899 -0.1004 0.1004 +vn -0.9899 0.1004 0.1004 +vn -0.9899 0.1004 -0.1004 +vn -0.9899 -0.1004 -0.1004 +vn -0.1004 -0.9899 -0.1004 +vn 0.1004 -0.9899 -0.1004 +vn 0.1004 -0.9899 0.1004 +vn -0.1004 -0.9899 0.1004 +vn 0.1004 0.9899 -0.1004 +vn 0.3792 0.9201 -0.0981 +vn 0.3673 0.8545 -0.3673 +vn 0.0981 0.9201 -0.3792 +vn 0.7041 0.7041 -0.0919 +vn 0.6663 0.6663 -0.3347 +vn 0.3347 0.6663 -0.6663 +vn 0.0919 0.7041 -0.7041 +vn 0.5774 0.5774 -0.5774 +vn 0.9201 0.0981 -0.3792 +vn 0.8545 0.3673 -0.3673 +vn 0.9201 0.3792 -0.0981 +vn 0.7041 0.0919 -0.7041 +vn 0.6663 0.3347 -0.6663 +vn 0.0981 0.3792 -0.9201 +vn 0.3673 0.3673 -0.8545 +vn 0.3792 0.0981 -0.9201 +vn 0.9201 -0.3792 -0.0981 +vn 0.8545 -0.3673 -0.3673 +vn 0.9201 -0.0981 -0.3792 +vn 0.7041 -0.7041 -0.0919 +vn 0.6663 -0.6663 -0.3347 +vn 0.6663 -0.3347 -0.6663 +vn 0.7041 -0.0919 -0.7041 +vn 0.5774 -0.5774 -0.5773 +vn 0.0981 -0.9201 -0.3792 +vn 0.3673 -0.8545 -0.3673 +vn 0.3792 -0.9201 -0.0981 +vn 0.0919 -0.7041 -0.7041 +vn 0.3347 -0.6663 -0.6663 +vn 0.3792 -0.0981 -0.9201 +vn 0.3673 -0.3673 -0.8545 +vn 0.0981 -0.3792 -0.9201 +vn 0.9201 0.3792 0.0981 +vn 0.8545 0.3673 0.3673 +vn 0.9201 0.0981 0.3792 +vn 0.7041 0.7041 0.0919 +vn 0.6663 0.6663 0.3347 +vn 0.6663 0.3347 0.6663 +vn 0.7041 0.0919 0.7041 +vn 0.5774 0.5774 0.5773 +vn 0.1004 0.9899 0.1004 +vn 0.0981 0.9201 0.3792 +vn 0.3673 0.8545 0.3673 +vn 0.3792 0.9201 0.0981 +vn 0.0919 0.7041 0.7041 +vn 0.3347 0.6663 0.6663 +vn 0.3792 0.0981 0.9201 +vn 0.3673 0.3673 0.8545 +vn 0.0981 0.3792 0.9201 +vn 0.0981 -0.3792 0.9201 +vn 0.3673 -0.3673 0.8545 +vn 0.3792 -0.0981 0.9201 +vn 0.0919 -0.7041 0.7041 +vn 0.3347 -0.6663 0.6663 +vn 0.6663 -0.3347 0.6663 +vn 0.7041 -0.0919 0.7041 +vn 0.5773 -0.5774 0.5774 +vn 0.3792 -0.9201 0.0981 +vn 0.3673 -0.8545 0.3673 +vn 0.0981 -0.9201 0.3792 +vn 0.7041 -0.7041 0.0919 +vn 0.6663 -0.6663 0.3347 +vn 0.9201 -0.0981 0.3792 +vn 0.8545 -0.3673 0.3673 +vn 0.9201 -0.3792 0.0981 +vn -0.9201 0.3792 -0.0981 +vn -0.8545 0.3673 -0.3673 +vn -0.9201 0.0981 -0.3792 +vn -0.7041 0.7041 -0.0919 +vn -0.6663 0.6663 -0.3347 +vn -0.6663 0.3347 -0.6663 +vn -0.7041 0.0919 -0.7041 +vn -0.5774 0.5774 -0.5773 +vn -0.1004 0.9899 -0.1004 +vn -0.0981 0.9201 -0.3792 +vn -0.3673 0.8545 -0.3673 +vn -0.3792 0.9201 -0.0981 +vn -0.0919 0.7041 -0.7041 +vn -0.3347 0.6663 -0.6663 +vn -0.3792 0.0981 -0.9201 +vn -0.3673 0.3673 -0.8545 +vn -0.0981 0.3792 -0.9201 +vn -0.0981 -0.3792 -0.9201 +vn -0.3673 -0.3673 -0.8545 +vn -0.3792 -0.0981 -0.9201 +vn -0.0919 -0.7041 -0.7041 +vn -0.3347 -0.6663 -0.6663 +vn -0.6663 -0.3347 -0.6663 +vn -0.7041 -0.0919 -0.7041 +vn -0.5773 -0.5774 -0.5774 +vn -0.3792 -0.9201 -0.0981 +vn -0.3673 -0.8545 -0.3673 +vn -0.0981 -0.9201 -0.3792 +vn -0.7041 -0.7041 -0.0919 +vn -0.6663 -0.6663 -0.3347 +vn -0.9201 -0.0981 -0.3792 +vn -0.8545 -0.3673 -0.3673 +vn -0.9201 -0.3792 -0.0981 +vn -0.9201 0.0981 0.3792 +vn -0.8545 0.3673 0.3673 +vn -0.9201 0.3792 0.0981 +vn -0.7041 0.0919 0.7041 +vn -0.6663 0.3347 0.6663 +vn -0.6663 0.6663 0.3347 +vn -0.7041 0.7041 0.0919 +vn -0.5774 0.5774 0.5773 +vn -0.0981 0.3792 0.9201 +vn -0.3673 0.3673 0.8545 +vn -0.3792 0.0981 0.9201 +vn -0.0919 0.7041 0.7041 +vn -0.3347 0.6663 0.6663 +vn -0.1004 0.9899 0.1004 +vn -0.3792 0.9201 0.0981 +vn -0.3673 0.8545 0.3673 +vn -0.0981 0.9201 0.3792 +vn -0.3792 -0.0981 0.9201 +vn -0.3673 -0.3673 0.8545 +vn -0.0981 -0.3792 0.9201 +vn -0.7041 -0.0919 0.7041 +vn -0.6663 -0.3347 0.6663 +vn -0.3347 -0.6663 0.6663 +vn -0.0919 -0.7041 0.7041 +vn -0.5774 -0.5774 0.5773 +vn -0.9201 -0.3792 0.0981 +vn -0.8545 -0.3673 0.3673 +vn -0.9201 -0.0981 0.3792 +vn -0.7041 -0.7041 0.0919 +vn -0.6663 -0.6663 0.3347 +vn -0.0981 -0.9201 0.3792 +vn -0.3673 -0.8545 0.3673 +vn -0.3792 -0.9201 0.0981 +usemtl None +s 1 +f 58/1/1 41/2/2 116/3/3 134/4/4 +f 96/5/5 79/6/6 3/7/7 22/8/8 +f 20/9/9 2/10/10 39/11/11 60/12/12 +f 135/13/13 115/14/14 77/15/15 98/16/16 +f 97/17/17 21/18/18 59/19/19 136/20/20 +f 1/21/21 4/22/22 7/23/23 6/24/24 +f 4/22/22 5/25/25 8/26/26 7/23/23 +f 6/24/24 7/23/23 19/27/27 16/28/28 +f 7/23/23 8/26/26 9/29/29 19/27/27 +f 2/10/10 10/30/30 13/31/31 12/32/32 +f 10/30/30 11/33/33 14/34/34 13/31/31 +f 12/32/32 13/31/31 8/35/26 5/36/25 +f 13/31/31 14/34/34 9/37/29 8/35/26 +f 3/7/7 15/38/35 18/39/36 17/40/37 +f 15/38/35 16/41/28 19/42/27 18/39/36 +f 17/40/37 18/39/36 14/43/34 11/44/33 +f 18/39/36 19/42/27 9/45/29 14/43/34 +f 20/9/9 23/46/38 26/47/39 25/48/40 +f 23/46/38 24/49/41 27/50/42 26/47/39 +f 25/48/40 26/47/39 38/51/43 35/52/44 +f 26/47/39 27/50/42 28/53/45 38/51/43 +f 21/18/18 29/54/46 32/55/47 31/56/48 +f 29/54/46 30/57/49 33/58/50 32/55/47 +f 31/56/48 32/55/47 27/59/42 24/60/41 +f 32/55/47 33/58/50 28/61/45 27/59/42 +f 22/8/8 34/62/51 37/63/52 36/64/53 +f 34/62/51 35/65/44 38/66/43 37/63/52 +f 36/64/53 37/63/52 33/67/50 30/68/49 +f 37/63/52 38/66/43 28/69/45 33/67/50 +f 39/11/11 42/70/54 45/71/55 44/72/56 +f 42/70/54 43/73/57 46/74/58 45/71/55 +f 44/72/56 45/71/55 57/75/59 54/76/60 +f 45/71/55 46/74/58 47/77/61 57/75/59 +f 40/78/62 48/79/63 51/80/64 50/81/65 +f 48/79/63 49/82/66 52/83/67 51/80/64 +f 50/81/65 51/80/64 46/84/58 43/85/57 +f 51/80/64 52/83/67 47/86/61 46/84/58 +f 41/2/2 53/87/68 56/88/69 55/89/70 +f 53/87/68 54/90/60 57/91/59 56/88/69 +f 55/89/70 56/88/69 52/92/67 49/93/66 +f 56/88/69 57/91/59 47/94/61 52/92/67 +f 58/1/1 61/95/71 64/96/72 63/97/73 +f 61/95/71 62/98/74 65/99/75 64/96/72 +f 63/97/73 64/96/72 76/100/76 73/101/77 +f 64/96/72 65/99/75 66/102/78 76/100/76 +f 59/19/19 67/103/79 70/104/80 69/105/81 +f 67/103/79 68/106/82 71/107/83 70/104/80 +f 69/105/81 70/104/80 65/108/75 62/109/74 +f 70/104/80 71/107/83 66/110/78 65/108/75 +f 60/12/12 72/111/84 75/112/85 74/113/86 +f 72/111/84 73/114/77 76/115/76 75/112/85 +f 74/113/86 75/112/85 71/116/83 68/117/82 +f 75/112/85 76/115/76 66/118/78 71/116/83 +f 77/15/15 80/119/87 83/120/88 82/121/89 +f 80/119/87 81/122/90 84/123/91 83/120/88 +f 82/121/89 83/120/88 95/124/92 92/125/93 +f 83/120/88 84/123/91 85/126/94 95/124/92 +f 78/127/95 86/128/96 89/129/97 88/130/98 +f 86/128/96 87/131/99 90/132/100 89/129/97 +f 88/130/98 89/129/97 84/133/91 81/134/90 +f 89/129/97 90/132/100 85/135/94 84/133/91 +f 79/6/6 91/136/101 94/137/102 93/138/103 +f 91/136/101 92/139/93 95/140/92 94/137/102 +f 93/138/103 94/137/102 90/141/100 87/142/99 +f 94/137/102 95/140/92 85/143/94 90/141/100 +f 96/5/5 99/144/104 102/145/105 101/146/106 +f 99/144/104 100/147/107 103/148/108 102/145/105 +f 101/146/106 102/145/105 114/149/109 111/150/110 +f 102/145/105 103/148/108 104/151/111 114/149/109 +f 97/17/17 105/152/112 108/153/113 107/154/114 +f 105/152/112 106/155/115 109/156/116 108/153/113 +f 107/154/114 108/153/113 103/157/108 100/158/107 +f 108/153/113 109/156/116 104/159/111 103/157/108 +f 98/16/16 110/160/117 113/161/118 112/162/119 +f 110/160/117 111/163/110 114/164/109 113/161/118 +f 112/162/119 113/161/118 109/165/116 106/166/115 +f 113/161/118 114/164/109 104/167/111 109/165/116 +f 115/14/14 118/168/120 121/169/121 120/170/122 +f 118/168/120 119/171/123 122/172/124 121/169/121 +f 120/170/122 121/169/121 133/173/125 130/174/126 +f 121/169/121 122/172/124 123/175/127 133/173/125 +f 116/3/3 124/176/128 127/177/129 126/178/130 +f 124/176/128 125/179/131 128/180/132 127/177/129 +f 126/178/130 127/177/129 122/181/124 119/182/123 +f 127/177/129 128/180/132 123/183/127 122/181/124 +f 117/184/133 129/185/134 132/186/135 131/187/136 +f 129/185/134 130/188/126 133/189/125 132/186/135 +f 131/187/136 132/186/135 128/190/132 125/191/131 +f 132/186/135 133/189/125 123/192/127 128/190/132 +f 134/4/4 137/193/137 140/194/138 139/195/139 +f 137/193/137 138/196/140 141/197/141 140/194/138 +f 139/195/139 140/194/138 152/198/142 149/199/143 +f 140/194/138 141/197/141 142/200/144 152/198/142 +f 135/13/13 143/201/145 146/202/146 145/203/147 +f 143/201/145 144/204/148 147/205/149 146/202/146 +f 145/203/147 146/202/146 141/206/141 138/207/140 +f 146/202/146 147/205/149 142/208/144 141/206/141 +f 136/20/20 148/209/150 151/210/151 150/211/152 +f 148/209/150 149/212/143 152/213/142 151/210/151 +f 150/211/152 151/210/151 147/214/149 144/215/148 +f 151/210/151 152/213/142 142/216/144 147/214/149 +f 136/20/20 59/19/19 69/105/81 148/209/150 +f 148/209/150 69/105/81 62/109/74 149/212/143 +f 149/199/143 62/98/74 61/95/71 139/195/139 +f 139/195/139 61/95/71 58/1/1 134/4/4 +f 59/19/19 21/18/18 31/56/48 67/103/79 +f 67/103/79 31/56/48 24/60/41 68/106/82 +f 68/117/82 24/49/41 23/46/38 74/113/86 +f 74/113/86 23/46/38 20/9/9 60/12/12 +f 1/21/21 40/78/62 50/81/65 4/22/22 +f 4/22/22 50/81/65 43/85/57 5/25/25 +f 5/36/25 43/73/57 42/70/54 12/32/32 +f 12/32/32 42/70/54 39/11/11 2/10/10 +f 21/18/18 97/17/17 107/154/114 29/54/46 +f 29/54/46 107/154/114 100/158/107 30/57/49 +f 30/68/49 100/147/107 99/144/104 36/64/53 +f 36/64/53 99/144/104 96/5/5 22/8/8 +f 117/184/133 78/127/95 88/130/98 129/185/134 +f 129/185/134 88/130/98 81/134/90 130/188/126 +f 130/174/126 81/122/90 80/119/87 120/170/122 +f 120/170/122 80/119/87 77/15/15 115/14/14 +f 97/17/17 136/20/20 150/211/152 105/152/112 +f 105/152/112 150/211/152 144/215/148 106/155/115 +f 106/166/115 144/204/148 143/201/145 112/162/119 +f 112/162/119 143/201/145 135/13/13 98/16/16 +f 40/78/62 117/184/133 131/187/136 48/79/63 +f 48/79/63 131/187/136 125/191/131 49/82/66 +f 49/93/66 125/179/131 124/176/128 55/89/70 +f 55/89/70 124/176/128 116/3/3 41/2/2 +f 41/2/2 58/1/1 63/97/73 53/87/68 +f 53/87/68 63/97/73 73/101/77 54/90/60 +f 54/76/60 73/114/77 72/111/84 44/72/56 +f 44/72/56 72/111/84 60/12/12 39/11/11 +f 2/10/10 20/9/9 25/48/40 10/30/30 +f 10/30/30 25/48/40 35/52/44 11/33/33 +f 11/44/33 35/65/44 34/62/51 17/40/37 +f 17/40/37 34/62/51 22/8/8 3/7/7 +f 134/4/4 116/3/3 126/178/130 137/193/137 +f 137/193/137 126/178/130 119/182/123 138/196/140 +f 138/207/140 119/171/123 118/168/120 145/203/147 +f 145/203/147 118/168/120 115/14/14 135/13/13 +f 78/127/95 1/21/21 6/24/24 86/128/96 +f 86/128/96 6/24/24 16/28/28 87/131/99 +f 87/142/99 16/41/28 15/38/35 93/138/103 +f 93/138/103 15/38/35 3/7/7 79/6/6 +f 79/6/6 96/5/5 101/146/106 91/136/101 +f 91/136/101 101/146/106 111/150/110 92/139/93 +f 92/125/93 111/163/110 110/160/117 82/121/89 +f 82/121/89 110/160/117 98/16/16 77/15/15 +f 1/21/21 78/127/95 117/184/133 40/78/62 diff --git a/public/resources/bevel-cube/x.mtl b/public/resources/bevel-cube/x.mtl new file mode 100644 index 0000000..5882e03 --- /dev/null +++ b/public/resources/bevel-cube/x.mtl @@ -0,0 +1,12 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500.000001 +Ka 1.000000 1.000000 1.000000 +Kd 0.800000 0.800000 0.800000 +Ks 0.800000 0.800000 0.800000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 diff --git a/public/resources/bevel-cube/x.obj b/public/resources/bevel-cube/x.obj new file mode 100644 index 0000000..88243b6 --- /dev/null +++ b/public/resources/bevel-cube/x.obj @@ -0,0 +1,455 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib x.mtl +o Cube_Cube.001 +v 0.499961 0.500000 -0.399961 +v 0.499961 0.399961 -0.500000 +v 0.499961 0.492385 -0.438244 +v 0.499961 0.438244 -0.492385 +v 0.499961 0.470699 -0.470699 +v 0.499961 -0.500000 -0.399961 +v 0.499961 -0.399961 -0.500000 +v 0.499961 -0.492385 -0.438244 +v 0.499961 -0.470699 -0.470699 +v 0.499961 -0.438244 -0.492385 +v 0.499961 0.500000 0.399961 +v 0.499961 0.399961 0.500000 +v 0.499961 0.492385 0.438244 +v 0.499961 0.470699 0.470699 +v 0.499961 0.438244 0.492385 +v 0.499961 -0.399961 0.500000 +v 0.499961 -0.500000 0.399961 +v 0.499961 -0.438244 0.492385 +v 0.499961 -0.470699 0.470699 +v 0.499961 -0.492385 0.438244 +v -0.500000 0.399961 -0.399961 +v -0.399961 0.500000 -0.399961 +v -0.399961 0.399961 -0.500000 +v -0.492385 0.438244 -0.399961 +v -0.470699 0.470699 -0.399961 +v -0.492385 0.399961 -0.438244 +v -0.483194 0.439203 -0.439203 +v -0.465612 0.465612 -0.437212 +v -0.457718 0.457718 -0.457718 +v -0.399961 0.492385 -0.438244 +v -0.399961 0.470699 -0.470699 +v -0.438244 0.492385 -0.399961 +v -0.439203 0.483194 -0.439203 +v -0.437212 0.465612 -0.465612 +v -0.438244 0.399961 -0.492385 +v -0.470699 0.399961 -0.470699 +v -0.399961 0.438244 -0.492385 +v -0.439203 0.439203 -0.483194 +v -0.465612 0.437212 -0.465612 +v -0.399961 -0.399961 -0.500000 +v -0.399961 -0.500000 -0.399961 +v -0.500000 -0.399961 -0.399961 +v -0.399961 -0.438244 -0.492385 +v -0.399961 -0.470699 -0.470699 +v -0.438244 -0.399961 -0.492385 +v -0.439203 -0.439203 -0.483194 +v -0.437212 -0.465612 -0.465612 +v -0.457718 -0.457718 -0.457718 +v -0.438244 -0.492385 -0.399961 +v -0.470699 -0.470699 -0.399961 +v -0.399961 -0.492385 -0.438244 +v -0.439203 -0.483194 -0.439203 +v -0.465612 -0.465612 -0.437212 +v -0.492385 -0.399961 -0.438244 +v -0.470699 -0.399961 -0.470699 +v -0.492385 -0.438244 -0.399961 +v -0.483194 -0.439203 -0.439203 +v -0.465612 -0.437212 -0.465612 +v -0.500000 0.399961 0.399961 +v -0.399961 0.399961 0.500000 +v -0.399961 0.500000 0.399961 +v -0.492385 0.399961 0.438244 +v -0.470699 0.399961 0.470699 +v -0.492385 0.438244 0.399961 +v -0.483194 0.439203 0.439203 +v -0.465612 0.437212 0.465612 +v -0.457718 0.457718 0.457718 +v -0.399961 0.438244 0.492385 +v -0.399961 0.470699 0.470699 +v -0.438244 0.399961 0.492385 +v -0.439203 0.439203 0.483194 +v -0.437212 0.465612 0.465612 +v -0.438244 0.492385 0.399961 +v -0.470699 0.470699 0.399961 +v -0.399961 0.492385 0.438244 +v -0.439203 0.483194 0.439203 +v -0.465612 0.465612 0.437212 +v -0.399961 -0.399961 0.500000 +v -0.500000 -0.399961 0.399961 +v -0.399961 -0.500000 0.399961 +v -0.438244 -0.399961 0.492385 +v -0.470699 -0.399961 0.470699 +v -0.399961 -0.438244 0.492385 +v -0.439203 -0.439203 0.483194 +v -0.465612 -0.437212 0.465612 +v -0.457718 -0.457718 0.457718 +v -0.492385 -0.438244 0.399961 +v -0.470699 -0.470699 0.399961 +v -0.492385 -0.399961 0.438244 +v -0.483194 -0.439203 0.439203 +v -0.465612 -0.465612 0.437212 +v -0.399961 -0.492385 0.438244 +v -0.399961 -0.470699 0.470699 +v -0.438244 -0.492385 0.399961 +v -0.439203 -0.483194 0.439203 +v -0.437212 -0.465612 0.465612 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.150010 0.525010 +vt 0.349990 0.525010 +vt 0.349990 0.724990 +vt 0.150010 0.724990 +vt 0.650010 0.525010 +vt 0.849990 0.525010 +vt 0.849990 0.724990 +vt 0.650010 0.724990 +vt 0.400010 0.775010 +vt 0.599990 0.775010 +vt 0.599990 0.974990 +vt 0.400010 0.974990 +vt 0.400010 0.025010 +vt 0.599990 0.025010 +vt 0.599990 0.224990 +vt 0.400010 0.224990 +vt 0.609561 0.974990 +vt 0.609801 0.984801 +vt 0.599990 0.984561 +vt 0.625000 0.974990 +vt 0.625000 0.984303 +vt 0.609303 1.000000 +vt 0.599990 1.000000 +vt 0.625000 0.989430 +vt 0.599990 0.525010 +vt 0.599990 0.515439 +vt 0.609801 0.515199 +vt 0.609561 0.525010 +vt 0.599990 0.500000 +vt 0.609303 0.500000 +vt 0.625000 0.515697 +vt 0.625000 0.525010 +vt 0.614430 0.500000 +vt 0.849990 0.515439 +vt 0.859801 0.515199 +vt 0.859561 0.525010 +vt 0.849990 0.500000 +vt 0.859303 0.500000 +vt 0.875000 0.515697 +vt 0.875000 0.525010 +vt 0.864430 0.500000 +vt 0.640439 0.525010 +vt 0.640199 0.515199 +vt 0.650010 0.515439 +vt 0.625000 0.525010 +vt 0.625000 0.515697 +vt 0.640697 0.500000 +vt 0.650010 0.500000 +vt 0.625000 0.510570 +vt 0.390439 0.025010 +vt 0.390199 0.015199 +vt 0.400010 0.015439 +vt 0.375000 0.025010 +vt 0.375000 0.015697 +vt 0.390697 0.000000 +vt 0.400010 0.000000 +vt 0.375000 0.010570 +vt 0.400010 0.984561 +vt 0.390199 0.984801 +vt 0.390439 0.974990 +vt 0.400010 1.000000 +vt 0.390697 1.000000 +vt 0.375000 0.984303 +vt 0.375000 0.974990 +vt 0.385570 1.000000 +vt 0.599990 0.765439 +vt 0.609801 0.765199 +vt 0.609561 0.775010 +vt 0.599990 0.750000 +vt 0.609303 0.750000 +vt 0.625000 0.765697 +vt 0.625000 0.775010 +vt 0.614430 0.750000 +vt 0.359561 0.724990 +vt 0.359801 0.734801 +vt 0.349990 0.734561 +vt 0.375000 0.724990 +vt 0.375000 0.734303 +vt 0.359303 0.750000 +vt 0.349990 0.750000 +vt 0.375000 0.739430 +vt 0.599990 0.724990 +vt 0.609561 0.724990 +vt 0.609801 0.734801 +vt 0.599990 0.734561 +vt 0.625000 0.724990 +vt 0.625000 0.734303 +vt 0.609303 0.750000 +vt 0.599990 0.750000 +vt 0.625000 0.739430 +vt 0.150010 0.734561 +vt 0.140199 0.734801 +vt 0.140439 0.724990 +vt 0.150010 0.750000 +vt 0.140697 0.750000 +vt 0.125000 0.734303 +vt 0.125000 0.724990 +vt 0.135570 0.750000 +vt 0.390439 0.775010 +vt 0.390199 0.765199 +vt 0.400010 0.765439 +vt 0.375000 0.775010 +vt 0.375000 0.765697 +vt 0.390697 0.750000 +vt 0.400010 0.750000 +vt 0.375000 0.760570 +vt 0.400010 0.234561 +vt 0.390199 0.234801 +vt 0.390439 0.224990 +vt 0.400010 0.250000 +vt 0.390697 0.250000 +vt 0.375000 0.234303 +vt 0.375000 0.224990 +vt 0.385570 0.250000 +vt 0.599990 0.234561 +vt 0.599990 0.250000 +vt 0.125000 0.525010 +vt 0.140439 0.525010 +vt 0.599990 0.015439 +vt 0.599990 0.000000 +vt 0.625000 0.724990 +vt 0.640439 0.724990 +vt 0.400010 0.724990 +vt 0.400010 0.734561 +vt 0.400010 0.750000 +vt 0.375000 0.525010 +vt 0.359561 0.525010 +vt 0.400010 0.525010 +vt 0.400010 0.515439 +vt 0.400010 0.500000 +vt 0.875000 0.724990 +vt 0.859561 0.724990 +vn 1.0000 0.0000 0.0000 +vn 0.0000 -0.0980 0.9952 +vn 0.0000 0.0980 0.9952 +vn -0.1004 0.1004 0.9899 +vn -0.1004 -0.1004 0.9899 +vn -0.1004 -0.1004 -0.9899 +vn -0.1004 0.1004 -0.9899 +vn 0.0000 0.0980 -0.9952 +vn 0.0000 -0.0980 -0.9952 +vn -0.9899 -0.1004 0.1004 +vn -0.9899 0.1004 0.1004 +vn -0.9899 0.1004 -0.1004 +vn -0.9899 -0.1004 -0.1004 +vn -0.1004 -0.9899 -0.1004 +vn 0.0000 -0.9952 -0.0980 +vn 0.0000 -0.9952 0.0980 +vn -0.1004 -0.9899 0.1004 +vn -0.9201 0.3792 -0.0981 +vn -0.8545 0.3673 -0.3673 +vn -0.9201 0.0981 -0.3792 +vn -0.7041 0.7041 -0.0919 +vn -0.6663 0.6663 -0.3347 +vn -0.6663 0.3347 -0.6663 +vn -0.7041 0.0919 -0.7041 +vn -0.5774 0.5774 -0.5773 +vn -0.1004 0.9899 -0.1004 +vn -0.0981 0.9201 -0.3792 +vn -0.3673 0.8545 -0.3673 +vn -0.3792 0.9201 -0.0981 +vn -0.0919 0.7041 -0.7041 +vn -0.3347 0.6663 -0.6663 +vn -0.3792 0.0981 -0.9201 +vn -0.3673 0.3673 -0.8545 +vn -0.0981 0.3792 -0.9201 +vn -0.0981 -0.3792 -0.9201 +vn -0.3673 -0.3673 -0.8545 +vn -0.3792 -0.0981 -0.9201 +vn -0.0919 -0.7041 -0.7041 +vn -0.3347 -0.6663 -0.6663 +vn -0.6663 -0.3347 -0.6663 +vn -0.7041 -0.0919 -0.7041 +vn -0.5773 -0.5774 -0.5774 +vn -0.3792 -0.9201 -0.0981 +vn -0.3673 -0.8545 -0.3673 +vn -0.0981 -0.9201 -0.3792 +vn -0.7041 -0.7041 -0.0919 +vn -0.6663 -0.6663 -0.3347 +vn -0.9201 -0.0981 -0.3792 +vn -0.8545 -0.3673 -0.3673 +vn -0.9201 -0.3792 -0.0981 +vn -0.9201 0.0981 0.3792 +vn -0.8545 0.3673 0.3673 +vn -0.9201 0.3792 0.0981 +vn -0.7041 0.0919 0.7041 +vn -0.6663 0.3347 0.6663 +vn -0.6663 0.6663 0.3347 +vn -0.7041 0.7041 0.0919 +vn -0.5774 0.5774 0.5773 +vn -0.0981 0.3792 0.9201 +vn -0.3673 0.3673 0.8545 +vn -0.3792 0.0981 0.9201 +vn -0.0919 0.7041 0.7041 +vn -0.3347 0.6663 0.6663 +vn -0.1004 0.9899 0.1004 +vn -0.3792 0.9201 0.0981 +vn -0.3673 0.8545 0.3673 +vn -0.0981 0.9201 0.3792 +vn -0.3792 -0.0981 0.9201 +vn -0.3673 -0.3673 0.8545 +vn -0.0981 -0.3792 0.9201 +vn -0.7041 -0.0919 0.7041 +vn -0.6663 -0.3347 0.6663 +vn -0.3347 -0.6663 0.6663 +vn -0.0919 -0.7041 0.7041 +vn -0.5774 -0.5774 0.5773 +vn -0.9201 -0.3792 0.0981 +vn -0.8545 -0.3673 0.3673 +vn -0.9201 -0.0981 0.3792 +vn -0.7041 -0.7041 0.0919 +vn -0.6663 -0.6663 0.3347 +vn -0.0981 -0.9201 0.3792 +vn -0.3673 -0.8545 0.3673 +vn -0.3792 -0.9201 0.0981 +vn 0.0000 -0.9239 0.3827 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 -0.3827 0.9239 +vn 0.0000 -0.9239 -0.3827 +vn 0.0000 -0.7071 -0.7071 +vn 0.0000 -0.3827 -0.9239 +vn 0.0000 0.9952 0.0980 +vn 0.0000 0.9239 0.3827 +vn 0.0000 0.7071 0.7071 +vn 0.0000 0.3827 0.9239 +vn 0.0000 0.9952 -0.0980 +vn 0.0000 0.9239 -0.3827 +vn 0.0000 0.7071 -0.7071 +vn 0.0000 0.3827 -0.9239 +usemtl None +s off +f 4/1/1 5/2/1 2/3/1 +f 11/4/1 13/5/1 14/6/1 +f 7/7/1 1/8/1 6/9/1 +f 10/10/1 7/7/1 9/11/1 +f 17/12/1 16/13/1 19/14/1 +f 7/7/1 6/9/1 9/11/1 +f 1/8/1 7/7/1 2/3/1 +f 1/8/1 2/3/1 5/2/1 +f 11/4/1 6/9/1 1/8/1 +f 11/4/1 17/12/1 6/9/1 +f 6/9/1 8/15/1 9/11/1 +f 17/12/1 12/16/1 16/13/1 +f 12/16/1 11/4/1 14/6/1 +f 15/17/1 12/16/1 14/6/1 +f 20/18/1 17/12/1 19/14/1 +f 12/16/1 17/12/1 11/4/1 +f 18/19/1 19/14/1 16/13/1 +f 3/20/1 1/8/1 5/2/1 +s 1 +f 16/21/2 12/22/3 60/23/4 78/24/5 +f 40/25/6 23/26/7 2/27/8 7/28/9 +f 79/29/10 59/30/11 21/31/12 42/32/13 +f 41/33/14 6/34/15 17/35/16 80/36/17 +f 21/31/12 24/37/18 27/38/19 26/39/20 +f 24/37/18 25/40/21 28/41/22 27/38/19 +f 26/39/20 27/38/19 39/42/23 36/43/24 +f 27/38/19 28/41/22 29/44/25 39/42/23 +f 22/45/26 30/46/27 33/47/28 32/48/29 +f 30/46/27 31/49/30 34/50/31 33/47/28 +f 32/48/29 33/47/28 28/51/22 25/52/21 +f 33/47/28 34/50/31 29/53/25 28/51/22 +f 23/26/7 35/54/32 38/55/33 37/56/34 +f 35/54/32 36/57/24 39/58/23 38/55/33 +f 37/56/34 38/55/33 34/59/31 31/60/30 +f 38/55/33 39/58/23 29/61/25 34/59/31 +f 40/25/6 43/62/35 46/63/36 45/64/37 +f 43/62/35 44/65/38 47/66/39 46/63/36 +f 45/64/37 46/63/36 58/67/40 55/68/41 +f 46/63/36 47/66/39 48/69/42 58/67/40 +f 41/33/14 49/70/43 52/71/44 51/72/45 +f 49/70/43 50/73/46 53/74/47 52/71/44 +f 51/72/45 52/71/44 47/75/39 44/76/38 +f 52/71/44 53/74/47 48/77/42 47/75/39 +f 42/32/13 54/78/48 57/79/49 56/80/50 +f 54/78/48 55/81/41 58/82/40 57/79/49 +f 56/80/50 57/79/49 53/83/47 50/84/46 +f 57/79/49 58/82/40 48/85/42 53/83/47 +f 59/30/11 62/86/51 65/87/52 64/88/53 +f 62/86/51 63/89/54 66/90/55 65/87/52 +f 64/88/53 65/87/52 77/91/56 74/92/57 +f 65/87/52 66/90/55 67/93/58 77/91/56 +f 60/23/4 68/94/59 71/95/60 70/96/61 +f 68/94/59 69/97/62 72/98/63 71/95/60 +f 70/96/61 71/95/60 66/99/55 63/100/54 +f 71/95/60 72/98/63 67/101/58 66/99/55 +f 61/102/64 73/103/65 76/104/66 75/105/67 +f 73/103/65 74/106/57 77/107/56 76/104/66 +f 75/105/67 76/104/66 72/108/63 69/109/62 +f 76/104/66 77/107/56 67/110/58 72/108/63 +f 78/24/5 81/111/68 84/112/69 83/113/70 +f 81/111/68 82/114/71 85/115/72 84/112/69 +f 83/113/70 84/112/69 96/116/73 93/117/74 +f 84/112/69 85/115/72 86/118/75 96/116/73 +f 79/29/10 87/119/76 90/120/77 89/121/78 +f 87/119/76 88/122/79 91/123/80 90/120/77 +f 89/121/78 90/120/77 85/124/72 82/125/71 +f 90/120/77 91/123/80 86/126/75 85/124/72 +f 80/36/17 92/127/81 95/128/82 94/129/83 +f 92/127/81 93/130/74 96/131/73 95/128/82 +f 94/129/83 95/128/82 91/132/80 88/133/79 +f 95/128/82 96/131/73 86/134/75 91/132/80 +f 80/36/17 17/35/16 20/135/84 92/127/81 +f 92/127/81 20/135/84 19/136/85 93/130/74 +f 93/117/74 19/137/85 18/138/86 83/113/70 +f 83/113/70 18/138/86 16/21/2 78/24/5 +f 6/34/15 41/33/14 51/72/45 8/139/87 +f 8/139/87 51/72/45 44/76/38 9/140/88 +f 9/141/88 44/65/38 43/62/35 10/142/89 +f 10/142/89 43/62/35 40/25/6 7/28/9 +f 61/102/64 22/45/26 32/48/29 73/103/65 +f 73/103/65 32/48/29 25/52/21 74/106/57 +f 74/92/57 25/40/21 24/37/18 64/88/53 +f 64/88/53 24/37/18 21/31/12 59/30/11 +f 41/33/14 80/36/17 94/129/83 49/70/43 +f 49/70/43 94/129/83 88/133/79 50/73/46 +f 50/84/46 88/122/79 87/119/76 56/80/50 +f 56/80/50 87/119/76 79/29/10 42/32/13 +f 11/143/90 61/102/64 75/105/67 13/144/91 +f 13/144/91 75/105/67 69/109/62 14/145/92 +f 14/146/92 69/97/62 68/94/59 15/147/93 +f 15/147/93 68/94/59 60/23/4 12/22/3 +f 78/24/5 60/23/4 70/96/61 81/111/68 +f 81/111/68 70/96/61 63/100/54 82/114/71 +f 82/125/71 63/89/54 62/86/51 89/121/78 +f 89/121/78 62/86/51 59/30/11 79/29/10 +f 22/45/26 1/148/94 3/149/95 30/46/27 +f 30/46/27 3/149/95 5/150/96 31/49/30 +f 31/60/30 5/151/96 4/152/97 37/56/34 +f 37/56/34 4/152/97 2/27/8 23/26/7 +f 23/26/7 40/25/6 45/64/37 35/54/32 +f 35/54/32 45/64/37 55/68/41 36/57/24 +f 36/43/24 55/81/41 54/78/48 26/39/20 +f 26/39/20 54/78/48 42/32/13 21/31/12 +f 1/148/94 22/45/26 61/102/64 11/143/90 diff --git a/public/resources/bevel-cube/xy.mtl b/public/resources/bevel-cube/xy.mtl new file mode 100644 index 0000000..5882e03 --- /dev/null +++ b/public/resources/bevel-cube/xy.mtl @@ -0,0 +1,12 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500.000001 +Ka 1.000000 1.000000 1.000000 +Kd 0.800000 0.800000 0.800000 +Ks 0.800000 0.800000 0.800000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 diff --git a/public/resources/bevel-cube/xy.obj b/public/resources/bevel-cube/xy.obj new file mode 100644 index 0000000..5fb17c4 --- /dev/null +++ b/public/resources/bevel-cube/xy.obj @@ -0,0 +1,299 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib xy.mtl +o Cube_Cube.001 +v 0.499961 0.500000 -0.499961 +v 0.499961 -0.500000 -0.499961 +v 0.499961 0.500000 0.399961 +v 0.499961 0.399961 0.500000 +v 0.499961 0.492385 0.438244 +v 0.499961 0.470699 0.470699 +v 0.499961 0.438244 0.492385 +v 0.499961 -0.399961 0.500000 +v 0.499961 -0.500000 0.399961 +v 0.499961 -0.438244 0.492385 +v 0.499961 -0.470699 0.470699 +v 0.499961 -0.492385 0.438244 +v -0.500000 0.399961 -0.499961 +v -0.399961 0.500000 -0.499961 +v -0.492385 0.438244 -0.499961 +v -0.470699 0.470699 -0.499961 +v -0.438244 0.492385 -0.499961 +v -0.399961 -0.500000 -0.499961 +v -0.500000 -0.399961 -0.499961 +v -0.438244 -0.492385 -0.499961 +v -0.470699 -0.470699 -0.499961 +v -0.492385 -0.438244 -0.499961 +v -0.500000 0.399961 0.399961 +v -0.399961 0.399961 0.500000 +v -0.399961 0.500000 0.399961 +v -0.492385 0.399961 0.438244 +v -0.470699 0.399961 0.470699 +v -0.492385 0.438244 0.399961 +v -0.483194 0.439203 0.439203 +v -0.465612 0.437212 0.465612 +v -0.457718 0.457718 0.457718 +v -0.399961 0.438244 0.492385 +v -0.399961 0.470699 0.470699 +v -0.438244 0.399961 0.492385 +v -0.439203 0.439203 0.483194 +v -0.437212 0.465612 0.465612 +v -0.438244 0.492385 0.399961 +v -0.470699 0.470699 0.399961 +v -0.399961 0.492385 0.438244 +v -0.439203 0.483194 0.439203 +v -0.465612 0.465612 0.437212 +v -0.399961 -0.399961 0.500000 +v -0.500000 -0.399961 0.399961 +v -0.399961 -0.500000 0.399961 +v -0.438244 -0.399961 0.492385 +v -0.470699 -0.399961 0.470699 +v -0.399961 -0.438244 0.492385 +v -0.439203 -0.439203 0.483194 +v -0.465612 -0.437212 0.465612 +v -0.457718 -0.457718 0.457718 +v -0.492385 -0.438244 0.399961 +v -0.470699 -0.470699 0.399961 +v -0.492385 -0.399961 0.438244 +v -0.483194 -0.439203 0.439203 +v -0.465612 -0.465612 0.437212 +v -0.399961 -0.492385 0.438244 +v -0.399961 -0.470699 0.470699 +v -0.438244 -0.492385 0.399961 +v -0.439203 -0.483194 0.439203 +v -0.437212 -0.465612 0.465612 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.150010 0.525010 +vt 0.349990 0.525010 +vt 0.349990 0.724990 +vt 0.150010 0.724990 +vt 0.400010 0.775010 +vt 0.599990 0.775010 +vt 0.599990 0.974990 +vt 0.400010 0.974990 +vt 0.400010 0.025010 +vt 0.599990 0.025010 +vt 0.599990 0.224990 +vt 0.400010 0.224990 +vt 0.599990 0.765439 +vt 0.609801 0.765199 +vt 0.609561 0.775010 +vt 0.599990 0.750000 +vt 0.609303 0.750000 +vt 0.625000 0.765697 +vt 0.625000 0.775010 +vt 0.614430 0.750000 +vt 0.359561 0.724990 +vt 0.359801 0.734801 +vt 0.349990 0.734561 +vt 0.375000 0.724990 +vt 0.375000 0.734303 +vt 0.359303 0.750000 +vt 0.349990 0.750000 +vt 0.375000 0.739430 +vt 0.599990 0.724990 +vt 0.609561 0.724990 +vt 0.609801 0.734801 +vt 0.599990 0.734561 +vt 0.625000 0.724990 +vt 0.625000 0.734303 +vt 0.609303 0.750000 +vt 0.599990 0.750000 +vt 0.625000 0.739430 +vt 0.150010 0.734561 +vt 0.140199 0.734801 +vt 0.140439 0.724990 +vt 0.150010 0.750000 +vt 0.140697 0.750000 +vt 0.125000 0.734303 +vt 0.125000 0.724990 +vt 0.135570 0.750000 +vt 0.390439 0.775010 +vt 0.390199 0.765199 +vt 0.400010 0.765439 +vt 0.375000 0.775010 +vt 0.375000 0.765697 +vt 0.390697 0.750000 +vt 0.400010 0.750000 +vt 0.375000 0.760570 +vt 0.400010 0.234561 +vt 0.390199 0.234801 +vt 0.390439 0.224990 +vt 0.400010 0.250000 +vt 0.390697 0.250000 +vt 0.375000 0.234303 +vt 0.375000 0.224990 +vt 0.385570 0.250000 +vt 0.599990 0.234561 +vt 0.599990 0.250000 +vt 0.125000 0.525010 +vt 0.140439 0.525010 +vt 0.599990 0.525010 +vt 0.609561 0.525010 +vt 0.625000 0.525010 +vt 0.625000 0.974990 +vt 0.609561 0.974990 +vt 0.390439 0.025010 +vt 0.375000 0.025010 +vt 0.375000 0.974990 +vt 0.390439 0.974990 +vt 0.400010 0.724990 +vt 0.400010 0.734561 +vt 0.400010 0.750000 +vt 0.375000 0.525010 +vt 0.359561 0.525010 +vt 0.400010 0.525010 +vn 0.0000 0.0000 -1.0000 +vn 1.0000 -0.0000 0.0000 +vn 0.0000 -0.0980 0.9952 +vn 0.0000 0.0980 0.9952 +vn -0.1004 0.1004 0.9899 +vn -0.1004 -0.1004 0.9899 +vn -0.9899 -0.1004 0.1004 +vn -0.9899 0.1004 0.1004 +vn -0.9952 0.0980 0.0000 +vn -0.9952 -0.0980 -0.0000 +vn -0.0980 -0.9952 -0.0000 +vn 0.0000 -1.0000 -0.0000 +vn 0.0000 -0.9952 0.0980 +vn -0.1004 -0.9899 0.1004 +vn -0.9201 0.0981 0.3792 +vn -0.8545 0.3673 0.3673 +vn -0.9201 0.3792 0.0981 +vn -0.7041 0.0919 0.7041 +vn -0.6663 0.3347 0.6663 +vn -0.6663 0.6663 0.3347 +vn -0.7041 0.7041 0.0919 +vn -0.5774 0.5774 0.5773 +vn -0.0981 0.3792 0.9201 +vn -0.3673 0.3673 0.8545 +vn -0.3792 0.0981 0.9201 +vn -0.0919 0.7041 0.7041 +vn -0.3347 0.6663 0.6663 +vn -0.1004 0.9899 0.1004 +vn -0.3792 0.9201 0.0981 +vn -0.3673 0.8545 0.3673 +vn -0.0981 0.9201 0.3792 +vn -0.3792 -0.0981 0.9201 +vn -0.3673 -0.3673 0.8545 +vn -0.0981 -0.3792 0.9201 +vn -0.7041 -0.0919 0.7041 +vn -0.6663 -0.3347 0.6663 +vn -0.3347 -0.6663 0.6663 +vn -0.0919 -0.7041 0.7041 +vn -0.5774 -0.5774 0.5773 +vn -0.9201 -0.3792 0.0981 +vn -0.8545 -0.3673 0.3673 +vn -0.9201 -0.0981 0.3792 +vn -0.7041 -0.7041 0.0919 +vn -0.6663 -0.6663 0.3347 +vn -0.0981 -0.9201 0.3792 +vn -0.3673 -0.8545 0.3673 +vn -0.3792 -0.9201 0.0981 +vn 0.0000 -0.9239 0.3827 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 -0.3827 0.9239 +vn -0.0980 0.9952 0.0000 +vn -0.3827 0.9239 0.0000 +vn -0.7071 0.7071 0.0000 +vn -0.9239 0.3827 0.0000 +vn -0.3827 -0.9239 0.0000 +vn -0.7071 -0.7071 0.0000 +vn -0.9239 -0.3827 -0.0000 +vn 0.0000 0.9952 0.0980 +vn 0.0000 0.9239 0.3827 +vn 0.0000 0.7071 0.7071 +vn 0.0000 0.3827 0.9239 +vn 0.0000 1.0000 0.0000 +usemtl None +s off +f 2/1/1 18/2/1 14/3/1 +f 14/3/1 13/4/1 16/5/1 +f 13/4/1 15/6/1 16/5/1 +f 17/7/1 14/3/1 16/5/1 +f 22/8/1 19/9/1 21/10/1 +f 19/9/1 18/2/1 21/10/1 +f 18/2/1 20/11/1 21/10/1 +f 1/12/1 2/1/1 14/3/1 +f 13/4/1 14/3/1 19/9/1 +f 14/3/1 18/2/1 19/9/1 +f 3/13/2 5/14/2 6/15/2 +f 9/16/2 8/17/2 11/18/2 +f 3/13/2 2/1/2 1/12/2 +f 3/13/2 9/16/2 2/1/2 +f 9/16/2 4/19/2 8/17/2 +f 4/19/2 3/13/2 6/15/2 +f 7/20/2 4/19/2 6/15/2 +f 12/21/2 9/16/2 11/18/2 +f 4/19/2 9/16/2 3/13/2 +f 10/22/2 11/18/2 8/17/2 +s 1 +f 8/23/3 4/24/4 24/25/5 42/26/6 +f 43/27/7 23/28/8 13/29/9 19/30/10 +f 18/31/11 2/32/12 9/33/13 44/34/14 +f 23/28/8 26/35/15 29/36/16 28/37/17 +f 26/35/15 27/38/18 30/39/19 29/36/16 +f 28/37/17 29/36/16 41/40/20 38/41/21 +f 29/36/16 30/39/19 31/42/22 41/40/20 +f 24/25/5 32/43/23 35/44/24 34/45/25 +f 32/43/23 33/46/26 36/47/27 35/44/24 +f 34/45/25 35/44/24 30/48/19 27/49/18 +f 35/44/24 36/47/27 31/50/22 30/48/19 +f 25/51/28 37/52/29 40/53/30 39/54/31 +f 37/52/29 38/55/21 41/56/20 40/53/30 +f 39/54/31 40/53/30 36/57/27 33/58/26 +f 40/53/30 41/56/20 31/59/22 36/57/27 +f 42/26/6 45/60/32 48/61/33 47/62/34 +f 45/60/32 46/63/35 49/64/36 48/61/33 +f 47/62/34 48/61/33 60/65/37 57/66/38 +f 48/61/33 49/64/36 50/67/39 60/65/37 +f 43/27/7 51/68/40 54/69/41 53/70/42 +f 51/68/40 52/71/43 55/72/44 54/69/41 +f 53/70/42 54/69/41 49/73/36 46/74/35 +f 54/69/41 55/72/44 50/75/39 49/73/36 +f 44/34/14 56/76/45 59/77/46 58/78/47 +f 56/76/45 57/79/38 60/80/37 59/77/46 +f 58/78/47 59/77/46 55/81/44 52/82/43 +f 59/77/46 60/80/37 50/83/39 55/81/44 +f 44/34/14 9/33/13 12/84/48 56/76/45 +f 56/76/45 12/84/48 11/85/49 57/79/38 +f 57/66/38 11/86/49 10/87/50 47/62/34 +f 47/62/34 10/87/50 8/23/3 42/26/6 +f 25/51/28 14/88/51 17/89/52 37/52/29 +f 37/52/29 17/89/52 16/90/53 38/55/21 +f 38/41/21 16/91/53 15/92/54 28/37/17 +f 28/37/17 15/92/54 13/29/9 23/28/8 +f 18/31/11 44/34/14 58/78/47 20/93/55 +f 20/93/55 58/78/47 52/82/43 21/94/56 +f 21/95/56 52/71/43 51/68/40 22/96/57 +f 22/96/57 51/68/40 43/27/7 19/30/10 +f 3/97/58 25/51/28 39/54/31 5/98/59 +f 5/98/59 39/54/31 33/58/26 6/99/60 +f 6/100/60 33/46/26 32/43/23 7/101/61 +f 7/101/61 32/43/23 24/25/5 4/24/4 +f 42/26/6 24/25/5 34/45/25 45/60/32 +f 45/60/32 34/45/25 27/49/18 46/63/35 +f 46/74/35 27/38/18 26/35/15 53/70/42 +f 53/70/42 26/35/15 23/28/8 43/27/7 +f 1/102/62 14/88/51 25/51/28 3/97/58 diff --git a/public/resources/bevel-cube/xymx.mtl b/public/resources/bevel-cube/xymx.mtl new file mode 100644 index 0000000..5882e03 --- /dev/null +++ b/public/resources/bevel-cube/xymx.mtl @@ -0,0 +1,12 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500.000001 +Ka 1.000000 1.000000 1.000000 +Kd 0.800000 0.800000 0.800000 +Ks 0.800000 0.800000 0.800000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 diff --git a/public/resources/bevel-cube/xymx.obj b/public/resources/bevel-cube/xymx.obj new file mode 100644 index 0000000..e06deca --- /dev/null +++ b/public/resources/bevel-cube/xymx.obj @@ -0,0 +1,131 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib xymx.mtl +o Cube_Cube.001 +v 0.499961 0.500000 -0.499961 +v 0.499961 -0.500000 -0.499961 +v 0.499961 0.500000 0.399961 +v 0.499961 0.399961 0.500000 +v 0.499961 0.492385 0.438244 +v 0.499961 0.470699 0.470699 +v 0.499961 0.438244 0.492385 +v 0.499961 -0.399961 0.500000 +v 0.499961 -0.500000 0.399961 +v 0.499961 -0.438244 0.492385 +v 0.499961 -0.470699 0.470699 +v 0.499961 -0.492385 0.438244 +v -0.499961 0.500000 -0.499961 +v -0.499961 -0.500000 -0.499961 +v -0.499961 0.399961 0.500000 +v -0.499961 0.500000 0.399961 +v -0.499961 0.438244 0.492385 +v -0.499961 0.470699 0.470699 +v -0.499961 0.492385 0.438244 +v -0.499961 -0.399961 0.500000 +v -0.499961 -0.500000 0.399961 +v -0.499961 -0.438244 0.492385 +v -0.499961 -0.492385 0.438244 +v -0.499961 -0.470699 0.470699 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.150010 0.525010 +vt 0.349990 0.525010 +vt 0.349990 0.724990 +vt 0.150010 0.724990 +vt 0.400010 0.025010 +vt 0.599990 0.025010 +vt 0.599990 0.224990 +vt 0.400010 0.224990 +vt 0.599990 0.234561 +vt 0.400010 0.234561 +vt 0.599990 0.250000 +vt 0.400010 0.250000 +vt 0.125000 0.724990 +vt 0.125000 0.525010 +vt 0.140439 0.525010 +vt 0.140439 0.724990 +vt 0.400010 0.724990 +vt 0.599990 0.724990 +vt 0.599990 0.734561 +vt 0.400010 0.734561 +vt 0.599990 0.750000 +vt 0.400010 0.750000 +vt 0.375000 0.525010 +vt 0.375000 0.724990 +vt 0.359561 0.724990 +vt 0.359561 0.525010 +vt 0.400010 0.525010 +vt 0.599990 0.525010 +vn 0.0000 0.0000 -1.0000 +vn 1.0000 -0.0000 0.0000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 -0.0980 0.9952 +vn 0.0000 0.0980 0.9952 +vn 0.0000 -1.0000 -0.0000 +vn 0.0000 -0.9952 0.0980 +vn 0.0000 -0.9239 0.3827 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 -0.3827 0.9239 +vn 0.0000 0.9952 0.0980 +vn 0.0000 0.9239 0.3827 +vn 0.0000 0.7071 0.7071 +vn 0.0000 0.3827 0.9239 +vn 0.0000 1.0000 0.0000 +usemtl None +s off +f 2/1/1 14/2/1 13/3/1 +f 1/4/1 2/1/1 13/3/1 +f 3/5/2 5/6/2 6/7/2 +f 9/8/2 8/9/2 11/10/2 +f 3/5/2 2/1/2 1/4/2 +f 3/5/2 9/8/2 2/1/2 +f 9/8/2 4/11/2 8/9/2 +f 4/11/2 3/5/2 6/7/2 +f 7/12/2 4/11/2 6/7/2 +f 12/13/2 9/8/2 11/10/2 +f 4/11/2 9/8/2 3/5/2 +f 10/14/2 11/10/2 8/9/2 +f 16/15/3 13/3/3 14/2/3 +f 16/15/3 14/2/3 21/16/3 +f 21/16/3 20/17/3 16/15/3 +f 20/17/3 15/18/3 16/15/3 +f 21/16/3 23/19/3 24/20/3 +f 19/21/3 16/15/3 18/22/3 +f 20/17/3 21/16/3 24/20/3 +f 15/18/3 17/23/3 18/22/3 +f 16/15/3 15/18/3 18/22/3 +f 24/20/3 22/24/3 20/17/3 +s 1 +f 8/25/4 4/26/5 15/27/5 20/28/4 +f 14/29/6 2/30/6 9/31/7 21/32/7 +f 21/32/7 9/31/7 12/33/8 23/34/8 +f 23/34/8 12/33/8 11/35/9 24/36/9 +f 24/37/9 11/38/9 10/39/10 22/40/10 +f 22/40/10 10/39/10 8/25/4 20/28/4 +f 3/41/11 16/42/11 19/43/12 5/44/12 +f 5/44/12 19/43/12 18/45/13 6/46/13 +f 6/47/13 18/48/13 17/49/14 7/50/14 +f 7/50/14 17/49/14 15/27/5 4/26/5 +f 1/51/15 13/52/15 16/42/11 3/41/11 diff --git a/public/resources/bevel-cube/xymxmy.mtl b/public/resources/bevel-cube/xymxmy.mtl new file mode 100644 index 0000000..5882e03 --- /dev/null +++ b/public/resources/bevel-cube/xymxmy.mtl @@ -0,0 +1,12 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500.000001 +Ka 1.000000 1.000000 1.000000 +Kd 0.800000 0.800000 0.800000 +Ks 0.800000 0.800000 0.800000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 diff --git a/public/resources/bevel-cube/xymxmy.obj b/public/resources/bevel-cube/xymxmy.obj new file mode 100644 index 0000000..615195c --- /dev/null +++ b/public/resources/bevel-cube/xymxmy.obj @@ -0,0 +1,47 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib xymxmy.mtl +o Cube_Cube.001 +v 0.499961 0.500000 -0.499961 +v 0.499961 -0.500000 -0.499961 +v 0.499961 0.500000 0.499961 +v 0.499961 -0.500000 0.499961 +v -0.499961 0.500000 -0.499961 +v -0.499961 -0.500000 -0.499961 +v -0.499961 0.500000 0.499961 +v -0.499961 -0.500000 0.499961 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.400010 0.025010 +vt 0.599990 0.025010 +vt 0.599990 0.224990 +vt 0.400010 0.224990 +vt 0.400010 0.525010 +vt 0.599990 0.525010 +vt 0.599990 0.724990 +vt 0.400010 0.724990 +vn 0.0000 0.0000 -1.0000 +vn 1.0000 0.0000 0.0000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 -0.0000 1.0000 +vn 0.0000 -1.0000 -0.0000 +vn 0.0000 1.0000 0.0000 +usemtl None +s off +f 2/1/1 6/2/1 5/3/1 +f 1/4/1 2/1/1 5/3/1 +f 3/5/2 2/1/2 1/4/2 +f 3/5/2 4/6/2 2/1/2 +f 7/7/3 5/3/3 6/2/3 +f 7/7/3 6/2/3 8/8/3 +f 4/6/4 7/7/4 8/8/4 +f 4/6/4 3/5/4 7/7/4 +s 1 +f 6/9/5 2/10/5 4/11/5 8/12/5 +f 1/13/6 5/14/6 7/15/6 3/16/6 diff --git a/public/resources/bevel-cube/xyz.mtl b/public/resources/bevel-cube/xyz.mtl new file mode 100644 index 0000000..5882e03 --- /dev/null +++ b/public/resources/bevel-cube/xyz.mtl @@ -0,0 +1,12 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500.000001 +Ka 1.000000 1.000000 1.000000 +Kd 0.800000 0.800000 0.800000 +Ks 0.800000 0.800000 0.800000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 diff --git a/public/resources/bevel-cube/xyz.obj b/public/resources/bevel-cube/xyz.obj new file mode 100644 index 0000000..ecc356b --- /dev/null +++ b/public/resources/bevel-cube/xyz.obj @@ -0,0 +1,197 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib xyz.mtl +o Cube_Cube.001 +v 0.499961 0.500000 -0.499961 +v 0.499961 -0.500000 -0.499961 +v 0.499961 0.499961 0.500000 +v 0.499961 -0.399961 0.500000 +v 0.499961 -0.500000 0.399961 +v 0.499961 -0.438244 0.492385 +v 0.499961 -0.470699 0.470699 +v 0.499961 -0.492385 0.438244 +v -0.500000 0.499961 -0.499961 +v -0.399961 -0.500000 -0.499961 +v -0.500000 -0.399961 -0.499961 +v -0.438244 -0.492385 -0.499961 +v -0.470699 -0.470699 -0.499961 +v -0.492385 -0.438244 -0.499961 +v -0.500000 0.499961 0.399961 +v -0.399961 0.499961 0.500000 +v -0.492385 0.499961 0.438244 +v -0.470699 0.499961 0.470699 +v -0.438244 0.499961 0.492385 +v -0.399961 -0.399961 0.500000 +v -0.500000 -0.399961 0.399961 +v -0.399961 -0.500000 0.399961 +v -0.438244 -0.399961 0.492385 +v -0.470699 -0.399961 0.470699 +v -0.399961 -0.438244 0.492385 +v -0.439203 -0.439203 0.483194 +v -0.465612 -0.437212 0.465612 +v -0.457718 -0.457718 0.457718 +v -0.492385 -0.438244 0.399961 +v -0.470699 -0.470699 0.399961 +v -0.492385 -0.399961 0.438244 +v -0.483194 -0.439203 0.439203 +v -0.465612 -0.465612 0.437212 +v -0.399961 -0.492385 0.438244 +v -0.399961 -0.470699 0.470699 +v -0.438244 -0.492385 0.399961 +v -0.439203 -0.483194 0.439203 +v -0.437212 -0.465612 0.465612 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.150010 0.525010 +vt 0.349990 0.525010 +vt 0.349990 0.724990 +vt 0.150010 0.724990 +vt 0.400010 0.775010 +vt 0.599990 0.775010 +vt 0.599990 0.974990 +vt 0.400010 0.974990 +vt 0.400010 0.025010 +vt 0.599990 0.025010 +vt 0.599990 0.224990 +vt 0.400010 0.224990 +vt 0.150010 0.734561 +vt 0.140199 0.734801 +vt 0.140439 0.724990 +vt 0.150010 0.750000 +vt 0.140697 0.750000 +vt 0.125000 0.734303 +vt 0.125000 0.724990 +vt 0.135570 0.750000 +vt 0.390439 0.775010 +vt 0.390199 0.765199 +vt 0.400010 0.765439 +vt 0.375000 0.775010 +vt 0.375000 0.765697 +vt 0.390697 0.750000 +vt 0.400010 0.750000 +vt 0.375000 0.760570 +vt 0.400010 0.234561 +vt 0.390199 0.234801 +vt 0.390439 0.224990 +vt 0.400010 0.250000 +vt 0.390697 0.250000 +vt 0.375000 0.234303 +vt 0.375000 0.224990 +vt 0.385570 0.250000 +vt 0.599990 0.234561 +vt 0.599990 0.250000 +vt 0.125000 0.525010 +vt 0.140439 0.525010 +vt 0.390439 0.025010 +vt 0.375000 0.025010 +vt 0.375000 0.974990 +vt 0.390439 0.974990 +vt 0.349990 0.734561 +vt 0.349990 0.750000 +vt 0.599990 0.750000 +vt 0.599990 0.765439 +vn -0.0000 -0.0000 -1.0000 +vn 0.0000 1.0000 0.0000 +vn 1.0000 0.0000 0.0000 +vn 0.0000 -0.0980 0.9952 +vn 0.0000 -0.0000 1.0000 +vn -0.0980 -0.0000 0.9952 +vn -0.1004 -0.1004 0.9899 +vn -0.9899 -0.1004 0.1004 +vn -0.9952 0.0000 0.0980 +vn -1.0000 0.0000 0.0000 +vn -0.9952 -0.0980 -0.0000 +vn -0.0980 -0.9952 -0.0000 +vn 0.0000 -1.0000 -0.0000 +vn 0.0000 -0.9952 0.0980 +vn -0.1004 -0.9899 0.1004 +vn -0.3792 -0.0981 0.9201 +vn -0.3673 -0.3673 0.8545 +vn -0.0981 -0.3792 0.9201 +vn -0.7041 -0.0919 0.7041 +vn -0.6663 -0.3347 0.6663 +vn -0.3347 -0.6663 0.6663 +vn -0.0919 -0.7041 0.7041 +vn -0.5774 -0.5774 0.5773 +vn -0.9201 -0.3792 0.0981 +vn -0.8545 -0.3673 0.3673 +vn -0.9201 -0.0981 0.3792 +vn -0.7041 -0.7041 0.0919 +vn -0.6663 -0.6663 0.3347 +vn -0.0981 -0.9201 0.3792 +vn -0.3673 -0.8545 0.3673 +vn -0.3792 -0.9201 0.0981 +vn 0.0000 -0.9239 0.3827 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 -0.3827 0.9239 +vn -0.3827 -0.9239 0.0000 +vn -0.7071 -0.7071 0.0000 +vn -0.9239 -0.3827 -0.0000 +vn -0.3827 -0.0000 0.9239 +vn -0.7071 0.0000 0.7071 +vn -0.9239 0.0000 0.3827 +usemtl None +s off +f 14/1/1 11/2/1 13/3/1 +f 11/2/1 10/4/1 13/3/1 +f 10/4/1 12/5/1 13/3/1 +f 16/6/2 3/7/2 1/8/2 +f 16/6/2 15/9/2 18/10/2 +f 19/11/2 16/6/2 18/10/2 +f 1/8/1 2/12/1 10/4/1 +f 5/13/3 2/12/3 1/8/3 +f 15/9/2 16/6/2 1/8/2 +f 11/2/1 9/14/1 1/8/1 +f 15/9/2 17/15/2 18/10/2 +f 3/7/3 5/13/3 1/8/3 +f 15/9/2 1/8/2 9/14/2 +f 11/2/1 1/8/1 10/4/1 +f 5/13/3 4/16/3 7/17/3 +f 5/13/3 3/7/3 4/16/3 +f 8/18/3 5/13/3 7/17/3 +f 6/19/3 7/17/3 4/16/3 +s 1 +f 4/20/4 3/21/5 16/22/6 20/23/7 +f 21/24/8 15/25/9 9/26/10 11/27/11 +f 10/28/12 2/29/13 5/30/14 22/31/15 +f 20/23/7 23/32/16 26/33/17 25/34/18 +f 23/32/16 24/35/19 27/36/20 26/33/17 +f 25/34/18 26/33/17 38/37/21 35/38/22 +f 26/33/17 27/36/20 28/39/23 38/37/21 +f 21/24/8 29/40/24 32/41/25 31/42/26 +f 29/40/24 30/43/27 33/44/28 32/41/25 +f 31/42/26 32/41/25 27/45/20 24/46/19 +f 32/41/25 33/44/28 28/47/23 27/45/20 +f 22/31/15 34/48/29 37/49/30 36/50/31 +f 34/48/29 35/51/22 38/52/21 37/49/30 +f 36/50/31 37/49/30 33/53/28 30/54/27 +f 37/49/30 38/52/21 28/55/23 33/53/28 +f 22/31/15 5/30/14 8/56/32 34/48/29 +f 34/48/29 8/56/32 7/57/33 35/51/22 +f 35/38/22 7/58/33 6/59/34 25/34/18 +f 25/34/18 6/59/34 4/20/4 20/23/7 +f 10/28/12 22/31/15 36/50/31 12/60/35 +f 12/60/35 36/50/31 30/54/27 13/61/36 +f 13/62/36 30/43/27 29/40/24 14/63/37 +f 14/63/37 29/40/24 21/24/8 11/27/11 +f 20/23/7 16/22/6 19/64/38 23/32/16 +f 23/32/16 19/64/38 18/65/39 24/35/19 +f 24/46/19 18/66/39 17/67/40 31/42/26 +f 31/42/26 17/67/40 15/25/9 21/24/8 diff --git a/public/resources/bevel-cube/xyzmx.mtl b/public/resources/bevel-cube/xyzmx.mtl new file mode 100644 index 0000000..5882e03 --- /dev/null +++ b/public/resources/bevel-cube/xyzmx.mtl @@ -0,0 +1,12 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500.000001 +Ka 1.000000 1.000000 1.000000 +Kd 0.800000 0.800000 0.800000 +Ks 0.800000 0.800000 0.800000 +Ke 0.000000 0.000000 0.000000 +Ni 1.450000 +d 1.000000 +illum 2 diff --git a/public/resources/bevel-cube/xyzmx.obj b/public/resources/bevel-cube/xyzmx.obj new file mode 100644 index 0000000..c4fc922 --- /dev/null +++ b/public/resources/bevel-cube/xyzmx.obj @@ -0,0 +1,88 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib xyzmx.mtl +o Cube_Cube.001 +v -0.499961 0.500000 -0.499961 +v -0.499961 -0.500000 -0.499961 +v 0.499961 -0.500000 -0.499961 +v -0.499961 0.499961 0.500000 +v -0.499961 -0.500000 0.399961 +v -0.499961 -0.399961 0.500000 +v -0.499960 -0.492385 0.438244 +v -0.499960 -0.470699 0.470699 +v -0.499960 -0.438244 0.492385 +v 0.499961 0.499961 0.500000 +v 0.499961 -0.399961 0.500000 +v 0.499961 -0.500000 0.399961 +v 0.499961 -0.438244 0.492385 +v 0.499961 -0.470699 0.470699 +v 0.499961 -0.492385 0.438244 +v 0.499961 0.500000 -0.499961 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.000000 +vt 0.400010 0.775010 +vt 0.599990 0.775010 +vt 0.599990 0.974990 +vt 0.400010 0.974990 +vt 0.400010 0.025010 +vt 0.599990 0.025010 +vt 0.599990 0.224990 +vt 0.400010 0.224990 +vt 0.390439 0.224990 +vt 0.390439 0.025010 +vt 0.375000 0.224990 +vt 0.375000 0.025010 +vt 0.375000 0.974990 +vt 0.375000 0.775010 +vt 0.390439 0.775010 +vt 0.390439 0.974990 +vn -1.0000 0.0000 0.0000 +vn 0.0000 -0.0000 -1.0000 +vn -0.0000 1.0000 0.0000 +vn 1.0000 0.0000 -0.0000 +vn 0.0000 -0.0980 0.9952 +vn 0.0000 0.0000 1.0000 +vn 0.0000 -0.9952 0.0980 +vn 0.0000 -1.0000 -0.0000 +vn 0.0000 -0.9239 0.3827 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 -0.3827 0.9239 +usemtl None +s off +f 9/1/1 6/2/1 8/3/1 +f 6/2/1 5/4/1 8/3/1 +f 5/4/1 7/5/1 8/3/1 +f 1/6/1 2/7/1 5/4/1 +f 3/8/2 2/7/2 1/6/2 +f 6/2/1 4/9/1 1/6/1 +f 10/10/3 1/6/3 4/9/3 +f 6/2/1 1/6/1 5/4/1 +f 16/11/3 1/6/3 10/10/3 +f 10/10/4 11/12/4 16/11/4 +f 11/12/4 13/13/4 14/14/4 +f 16/11/2 3/8/2 1/6/2 +f 12/15/4 11/12/4 14/14/4 +f 15/16/4 12/15/4 14/14/4 +f 12/15/4 3/8/4 16/11/4 +f 11/12/4 12/15/4 16/11/4 +s 1 +f 11/17/5 10/18/6 4/19/6 6/20/5 +f 5/21/7 2/22/8 3/23/8 12/24/7 +f 5/21/7 12/24/7 15/25/9 7/26/9 +f 7/26/9 15/25/9 14/27/10 8/28/10 +f 8/29/10 14/30/10 13/31/11 9/32/11 +f 9/32/11 13/31/11 11/17/5 6/20/5 diff --git a/public/resources/bevel_cube.mtl b/public/resources/bevel_cube.mtl new file mode 100644 index 0000000..f231bdf --- /dev/null +++ b/public/resources/bevel_cube.mtl @@ -0,0 +1,10 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 500 +Ka 0.8 0.8 0.8 +Kd 0.8 0.8 0.8 +Ks 0.8 0.8 0.8 +d 1 +illum 2 diff --git a/public/resources/bevel_cube.obj b/public/resources/bevel_cube.obj new file mode 100644 index 0000000..e9bb051 --- /dev/null +++ b/public/resources/bevel_cube.obj @@ -0,0 +1,557 @@ +# Blender v2.82 (sub 7) OBJ File: '' +# www.blender.org +mtllib bevel_cube.mtl +o Cube_Cube.002 +v 0.798071 -0.798071 1.000000 +v 0.798071 0.798071 1.000000 +v 1.000000 0.798071 0.798071 +v 0.798071 1.000000 0.798071 +v 1.000000 -0.798071 0.798071 +v 0.798071 -1.000000 0.798071 +v 1.000000 -0.798071 -0.798071 +v 1.000000 0.798071 -0.798071 +v 0.798071 0.798071 -1.000000 +v 0.798071 1.000000 -0.798071 +v 0.798071 -0.798071 -1.000000 +v 0.798071 -1.000000 -0.798071 +v -0.798071 -0.798071 -1.000000 +v -0.798071 0.798071 -1.000000 +v -1.000000 0.798071 -0.798071 +v -0.798071 1.000000 -0.798071 +v -0.798071 1.000000 0.798071 +v -1.000000 0.798071 0.798071 +v -0.798071 0.798071 1.000000 +v -0.798071 -0.798071 1.000000 +v -1.000000 -0.798071 -0.798071 +v -1.000000 -0.798071 0.798071 +v -0.798071 -1.000000 0.798071 +v -0.798071 -1.000000 -0.798071 +v -0.892152 -0.961030 0.798071 +v -0.798071 -1.000000 0.798071 +v -0.798071 -0.961030 0.892152 +v -0.898181 -0.910004 0.898181 +v -0.798071 -0.892152 0.961030 +v -0.798071 -0.798071 1.000000 +v -0.892152 -0.798071 0.961030 +v -0.898181 -0.898181 0.910004 +v -0.961030 -0.892152 0.798071 +v -0.910004 -0.898181 0.898181 +v -0.961030 -0.798071 0.892152 +v -1.000000 -0.798071 0.798071 +v -0.892152 0.798071 0.961030 +v -0.798071 0.798071 1.000000 +v -0.798071 0.892152 0.961030 +v -0.898181 0.898181 0.910004 +v -0.798071 0.961030 0.892152 +v -0.798071 1.000000 0.798071 +v -0.892152 0.961030 0.798071 +v -0.898181 0.910004 0.898181 +v -0.961030 0.798071 0.892152 +v -0.910004 0.898181 0.898181 +v -0.961030 0.892152 0.798071 +v -1.000000 0.798071 0.798071 +v -0.798071 -0.961030 -0.892152 +v -0.798071 -1.000000 -0.798071 +v -0.892152 -0.961030 -0.798071 +v -0.898181 -0.910004 -0.898181 +v -0.961030 -0.892152 -0.798071 +v -1.000000 -0.798071 -0.798071 +v -0.961030 -0.798071 -0.892152 +v -0.910004 -0.898181 -0.898181 +v -0.798071 -0.892152 -0.961030 +v -0.898181 -0.898181 -0.910004 +v -0.892152 -0.798071 -0.961030 +v -0.798071 -0.798071 -1.000000 +v -0.892152 0.961030 -0.798071 +v -0.798071 1.000000 -0.798071 +v -0.798071 0.961030 -0.892152 +v -0.898181 0.910004 -0.898181 +v -0.798071 0.892152 -0.961030 +v -0.798071 0.798071 -1.000000 +v -0.892152 0.798071 -0.961030 +v -0.898181 0.898181 -0.910004 +v -0.961030 0.892152 -0.798071 +v -0.910004 0.898181 -0.898181 +v -0.961030 0.798071 -0.892152 +v -1.000000 0.798071 -0.798071 +v 0.798071 -0.961030 0.892152 +v 0.798071 -1.000000 0.798071 +v 0.892152 -0.961030 0.798071 +v 0.898181 -0.910004 0.898181 +v 0.961030 -0.892152 0.798071 +v 1.000000 -0.798071 0.798071 +v 0.961030 -0.798071 0.892152 +v 0.910004 -0.898181 0.898181 +v 0.798071 -0.892152 0.961030 +v 0.898181 -0.898181 0.910004 +v 0.892152 -0.798071 0.961030 +v 0.798071 -0.798071 1.000000 +v 0.892152 0.961030 0.798071 +v 0.798071 1.000000 0.798071 +v 0.798071 0.961030 0.892152 +v 0.898181 0.910004 0.898181 +v 0.798071 0.892152 0.961030 +v 0.798071 0.798071 1.000000 +v 0.892152 0.798071 0.961030 +v 0.898181 0.898181 0.910004 +v 0.961030 0.892152 0.798071 +v 0.910004 0.898181 0.898181 +v 0.961030 0.798071 0.892152 +v 1.000000 0.798071 0.798071 +v 0.892152 -0.961030 -0.798071 +v 0.798071 -1.000000 -0.798071 +v 0.798071 -0.961030 -0.892152 +v 0.898181 -0.910004 -0.898181 +v 0.798071 -0.892152 -0.961030 +v 0.798071 -0.798071 -1.000000 +v 0.892152 -0.798071 -0.961030 +v 0.898181 -0.898181 -0.910004 +v 0.961030 -0.892152 -0.798071 +v 0.910004 -0.898181 -0.898181 +v 0.961030 -0.798071 -0.892152 +v 1.000000 -0.798071 -0.798071 +v 0.798071 0.961030 -0.892152 +v 0.798071 1.000000 -0.798071 +v 0.892152 0.961030 -0.798071 +v 0.898181 0.910004 -0.898181 +v 0.961030 0.892152 -0.798071 +v 1.000000 0.798071 -0.798071 +v 0.961030 0.798071 -0.892152 +v 0.910004 0.898181 -0.898181 +v 0.798071 0.892152 -0.961030 +v 0.898181 0.898181 -0.910004 +v 0.892152 0.798071 -0.961030 +v 0.798071 0.798071 -1.000000 +vt 0.400241 0.025241 +vt 0.599759 0.025241 +vt 0.599759 0.224759 +vt 0.400241 0.224759 +vt 0.150241 0.525241 +vt 0.349759 0.525241 +vt 0.349759 0.724759 +vt 0.150241 0.724759 +vt 0.650241 0.736519 +vt 0.849759 0.736519 +vt 0.849759 0.745129 +vt 0.650241 0.745129 +vt 0.400241 0.775241 +vt 0.599759 0.775241 +vt 0.599759 0.974759 +vt 0.400241 0.974759 +vt 0.362273 0.737273 +vt 0.363750 0.737273 +vt 0.362273 0.738750 +vt 0.599759 0.758610 +vt 0.400241 0.758610 +vt 0.400241 0.741390 +vt 0.599759 0.741390 +vt 0.400241 0.986519 +vt 0.599759 0.986519 +vt 0.599759 0.995129 +vt 0.400241 0.995129 +vt 0.150241 0.736519 +vt 0.349759 0.736519 +vt 0.349759 0.745129 +vt 0.150241 0.745129 +vt 0.138481 0.724759 +vt 0.150241 0.724759 +vt 0.137727 0.737273 +vt 0.150241 0.750000 +vt 0.143352 0.750000 +vt 0.143352 0.741563 +vt 0.599759 0.981648 +vt 0.606648 0.981648 +vt 0.606648 0.990085 +vt 0.349759 0.731648 +vt 0.356648 0.731648 +vt 0.356648 0.740085 +vt 0.383610 0.724759 +vt 0.393352 0.724759 +vt 0.393352 0.731648 +vt 0.376478 0.731648 +vt 0.356648 0.741563 +vt 0.356648 0.750000 +vt 0.349759 0.750000 +vt 0.650241 0.750000 +vt 0.643352 0.750000 +vt 0.643352 0.741563 +vt 0.366390 0.525241 +vt 0.356648 0.525241 +vt 0.356648 0.518352 +vt 0.373522 0.518352 +vt 0.137727 0.738750 +vt 0.393352 0.991563 +vt 0.393352 0.990085 +vt 0.366390 0.724759 +vt 0.373522 0.731648 +vt 0.393352 0.751478 +vt 0.393352 0.748522 +vt 0.150241 0.525241 +vt 0.138481 0.525241 +vt 0.400241 0.974759 +vt 0.599759 0.974759 +vt 0.349759 0.525241 +vt 0.150241 0.513481 +vt 0.349759 0.513481 +vt 0.349759 0.724759 +vt 0.599759 0.775241 +vt 0.400241 0.775241 +vt 0.393352 0.974759 +vt 0.393352 0.775241 +vt 0.606648 0.775241 +vt 0.606648 0.974759 +vt 0.633610 0.525241 +vt 0.633610 0.724759 +vt 0.616390 0.724759 +vt 0.616390 0.525241 +vt 0.150241 0.504871 +vt 0.349759 0.504871 +vt 0.612273 0.987273 +vt 0.613750 0.987273 +vt 0.612273 0.988751 +vt 0.862273 0.512727 +vt 0.862273 0.511250 +vt 0.863750 0.512727 +vt 0.599759 0.258610 +vt 0.400241 0.258610 +vt 0.400241 0.241390 +vt 0.599759 0.241390 +vt 0.849759 0.513481 +vt 0.650241 0.513481 +vt 0.650241 0.504871 +vt 0.849759 0.504871 +vt 0.383610 0.525241 +vt 0.362273 0.512727 +vt 0.362273 0.511250 +vt 0.363750 0.512727 +vt 0.599759 0.508610 +vt 0.400241 0.508610 +vt 0.400241 0.491390 +vt 0.599759 0.491390 +vt 0.136250 0.737273 +vt 0.137727 0.512727 +vt 0.136250 0.512727 +vt 0.137727 0.511250 +vt 0.637727 0.512727 +vt 0.636250 0.512727 +vt 0.637727 0.511250 +vt 0.637727 0.737273 +vt 0.637727 0.738750 +vt 0.636250 0.737273 +vt 0.861519 0.724759 +vt 0.861519 0.525241 +vt 0.870129 0.525241 +vt 0.870129 0.724759 +vt 0.129871 0.724759 +vt 0.133437 0.731648 +vt 0.125000 0.731648 +vt 0.125000 0.724759 +vt 0.849759 0.731648 +vt 0.856648 0.731648 +vt 0.856648 0.740085 +vt 0.606648 0.991563 +vt 0.606648 1.000000 +vt 0.599759 1.000000 +vt 0.129871 0.525241 +vt 0.125000 0.525241 +vt 0.125000 0.518352 +vt 0.133437 0.518352 +vt 0.143352 0.508437 +vt 0.143352 0.500000 +vt 0.150241 0.500000 +vt 0.849759 0.525241 +vt 0.849759 0.500000 +vt 0.856648 0.500000 +vt 0.856648 0.508437 +vt 0.866563 0.518352 +vt 0.875000 0.518352 +vt 0.875000 0.525241 +vt 0.643352 0.724759 +vt 0.643352 0.731648 +vt 0.626478 0.731648 +vt 0.623522 0.731648 +vt 0.606648 0.731648 +vt 0.606648 0.724759 +vt 0.349759 0.500000 +vt 0.356648 0.500000 +vt 0.356648 0.508437 +vt 0.376478 0.518352 +vt 0.393352 0.518352 +vt 0.393352 0.525241 +vt 0.650241 0.518352 +vt 0.643352 0.518352 +vt 0.643352 0.509915 +vt 0.606648 0.525241 +vt 0.606648 0.518352 +vt 0.623522 0.518352 +vt 0.643352 0.508437 +vt 0.643352 0.500000 +vt 0.650241 0.500000 +vt 0.856648 0.741563 +vt 0.866563 0.731648 +vt 0.865085 0.731648 +vt 0.393352 0.251478 +vt 0.393352 0.248522 +vt 0.606648 0.248522 +vt 0.606648 0.251478 +vt 0.606648 0.748522 +vt 0.606648 0.751478 +vt 0.393352 0.501478 +vt 0.393352 0.498522 +vt 0.626478 0.518352 +vt 0.606648 0.498522 +vt 0.606648 0.501478 +vt 0.400241 0.025241 +vt 0.400241 0.224759 +vt 0.393352 0.224759 +vt 0.393352 0.025241 +vt 0.599759 0.025241 +vt 0.400241 0.018352 +vt 0.599759 0.018352 +vt 0.849759 0.724759 +vt 0.599759 0.224759 +vt 0.606648 0.025241 +vt 0.606648 0.224759 +vt 0.599759 0.275241 +vt 0.400241 0.275241 +vt 0.400241 0.474759 +vt 0.393352 0.474759 +vt 0.393352 0.275241 +vt 0.650241 0.525241 +vt 0.599759 0.474759 +vt 0.606648 0.275241 +vt 0.606648 0.474759 +vt 0.599759 0.525241 +vt 0.400241 0.525241 +vt 0.400241 0.724759 +vt 0.650241 0.724759 +vt 0.599759 0.724759 +vt 0.650241 0.525241 +vt 0.849759 0.525241 +vt 0.849759 0.724759 +vt 0.650241 0.724759 +vt 0.400241 0.275241 +vt 0.599759 0.275241 +vt 0.599759 0.474759 +vt 0.400241 0.474759 +vt 0.400241 0.525241 +vt 0.599759 0.525241 +vt 0.599759 0.724759 +vt 0.400241 0.724759 +vn -1.0000 0.0000 0.0000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 0.7071 0.7071 +vn 0.0000 0.0000 1.0000 +vn 0.5774 -0.5774 0.5774 +vn 0.7071 0.0000 0.7071 +vn -0.7071 0.0000 0.7071 +vn 0.0000 -0.7071 0.7071 +vn -0.3793 -0.8439 0.3793 +vn -0.3793 -0.3793 0.8439 +vn -0.3793 0.3793 0.8439 +vn 0.3793 -0.8439 0.3793 +vn 0.8439 -0.3793 0.3793 +vn 0.3793 -0.3793 0.8439 +vn 0.3793 0.3793 0.8439 +vn 0.3793 -0.8439 -0.3793 +vn -0.3029 -0.6739 0.6739 +vn -0.6739 -0.3029 0.6739 +vn 0.3029 -0.6739 0.6739 +vn 0.6739 -0.6739 0.3029 +vn 0.6739 -0.3029 0.6739 +vn -0.3827 -0.9239 0.0000 +vn -0.3827 0.0000 0.9239 +vn 0.0000 -0.9239 -0.3827 +vn 0.3827 -0.9239 0.0000 +vn 0.3827 0.0000 0.9239 +vn 0.0000 -0.9239 0.3827 +vn 0.0000 -0.3827 0.9239 +vn 0.0000 0.3827 0.9239 +vn 0.5396 0.8233 -0.1761 +vn 0.5396 0.8233 0.1761 +vn 0.8233 0.5396 0.1761 +vn 0.8233 0.5396 -0.1761 +vn 0.1533 -0.6988 -0.6988 +vn -0.2338 -0.7625 -0.6033 +vn -0.1763 -0.5538 -0.8137 +vn 0.1787 -0.5368 -0.8246 +vn -0.5319 0.5319 0.6589 +vn -0.4969 0.7115 0.4969 +vn -0.7115 0.4969 0.4969 +vn -0.4957 0.7132 -0.4957 +vn -0.4957 0.4957 -0.7132 +vn -0.7207 0.4902 -0.4902 +vn -0.5368 0.1787 -0.8246 +vn -0.5538 -0.1763 -0.8137 +vn -0.8137 -0.1763 -0.5538 +vn -0.8137 0.1763 -0.5538 +vn -0.1761 0.8233 -0.5396 +vn 0.1761 0.8233 -0.5396 +vn 0.1761 0.5396 -0.8233 +vn -0.1761 0.5396 -0.8233 +vn 0.7071 -0.7071 0.0000 +vn 0.7008 -0.7008 -0.1330 +vn 0.8233 -0.5396 -0.1761 +vn 0.8315 -0.5556 0.0000 +vn 0.5228 -0.6733 -0.5228 +vn 0.4957 -0.4957 -0.7132 +vn 0.7132 -0.4957 -0.4957 +vn 0.8233 0.1761 -0.5396 +vn 0.8233 -0.1761 -0.5396 +vn 0.5396 -0.1761 -0.8233 +vn 0.5396 0.1761 -0.8233 +vn -0.6331 -0.6331 0.4454 +vn -0.5774 -0.5774 0.5774 +vn -0.7130 -0.5549 0.4286 +vn -0.4969 -0.7115 -0.4969 +vn -0.7115 -0.4969 -0.4969 +vn -0.4969 -0.4969 -0.7115 +vn 0.4957 0.7132 -0.4957 +vn 0.7132 0.4957 -0.4957 +vn 0.4957 0.4957 -0.7132 +vn 0.4957 0.7132 0.4957 +vn 0.5228 0.5228 0.6733 +vn 0.7132 0.4957 0.4957 +vn -0.5538 0.8137 0.1763 +vn -0.5368 0.8246 -0.1787 +vn -0.8137 0.5538 -0.1763 +vn -0.8137 0.5538 0.1763 +vn -0.8138 -0.5538 0.1763 +vn -0.9010 -0.1934 0.3884 +vn -0.9284 -0.2628 0.2628 +vn -0.2342 0.8380 0.4928 +vn -0.2628 0.9284 0.2628 +vn -0.8380 0.2342 0.4928 +vn -0.9284 0.2628 0.2628 +vn -0.3793 -0.8439 -0.3793 +vn -0.6033 -0.7625 -0.2338 +vn -0.8138 -0.5538 -0.1763 +vn -0.9284 -0.2628 -0.2628 +vn -0.2628 -0.2628 -0.9284 +vn -0.2588 0.9306 -0.2588 +vn -0.2588 0.2588 -0.9306 +vn -0.9284 0.2628 -0.2628 +vn 0.2588 0.9306 0.2588 +vn 0.2353 0.8501 0.4711 +vn 0.8501 0.2353 0.4711 +vn 0.9306 0.2588 0.2588 +vn 0.2588 -0.2588 -0.9306 +vn 0.9306 -0.2588 -0.2588 +vn 0.2588 0.9306 -0.2588 +vn 0.9306 0.2588 -0.2588 +vn 0.2588 0.2588 -0.9306 +vn -0.6988 -0.6988 0.1533 +vn -0.6739 0.3029 0.6739 +vn -0.3029 0.6739 0.6739 +vn 0.3029 0.6739 0.6739 +vn 0.6739 0.3029 0.6739 +vn 0.9239 -0.3827 0.0000 +vn 0.9239 0.0000 0.3827 +vn 0.0000 1.0000 0.0000 +vn 0.0000 0.0000 -1.0000 +vn 1.0000 0.0000 0.0000 +usemtl None +s 1 +f 36/1/1 48/2/1 72/3/1 54/4/1 +s off +f 50/5/2 98/6/2 74/7/2 26/8/2 +f 87/9/3 41/10/3 39/11/3 89/12/3 +f 84/13/4 90/14/4 38/15/4 30/16/4 +f 76/17/5 80/18/5 82/19/5 +f 91/20/6 83/21/6 79/22/6 95/23/6 +f 31/24/7 37/25/7 45/26/7 35/27/7 +f 27/28/8 73/29/8 81/30/8 29/31/8 +f 25/32/9 23/33/9 27/28/9 28/34/9 +f 29/31/10 20/35/10 31/36/10 32/37/10 +f 37/25/11 19/38/11 39/39/11 40/40/11 +f 73/29/12 6/41/12 75/42/12 76/43/12 +f 77/44/13 5/45/13 79/46/13 80/47/13 +f 81/30/14 82/48/14 83/49/14 1/50/14 +f 89/12/15 2/51/15 91/52/15 92/53/15 +f 97/54/16 12/55/16 99/56/16 100/57/16 +f 27/28/17 29/31/17 32/58/17 28/34/17 +f 31/24/18 35/27/18 34/59/18 32/60/18 +f 81/30/19 73/29/19 76/17/19 82/19/19 +f 75/61/20 77/44/20 80/47/20 76/62/20 +f 79/22/21 83/21/21 82/63/21 80/64/21 +f 24/65/22 23/33/22 25/32/22 51/66/22 +f 20/67/23 19/68/23 37/25/23 31/24/23 +f 12/69/24 24/65/24 49/70/24 99/71/24 +f 6/72/25 12/69/25 97/54/25 75/61/25 +f 2/73/26 1/74/26 83/21/26 91/20/26 +f 23/33/27 6/72/27 73/29/27 27/28/27 +f 1/74/28 20/67/28 29/75/28 81/76/28 +f 19/68/29 2/73/29 89/77/29 39/78/29 +s 2 +f 111/79/30 85/80/31 93/81/32 113/82/33 +f 99/71/34 49/70/35 57/83/36 101/84/37 +f 40/85/38 44/86/39 46/87/40 +f 64/88/41 68/89/42 70/90/43 +f 67/91/44 59/92/45 55/93/46 71/94/47 +f 63/95/48 109/96/49 117/97/50 65/98/51 +f 75/61/52 97/54/53 105/99/54 77/44/55 +f 100/100/56 104/101/57 106/102/58 +f 115/103/59 107/104/60 103/105/61 119/106/62 +f 28/34/63 32/58/64 34/107/65 +f 52/108/66 56/109/67 58/110/68 +f 112/111/69 116/112/70 118/113/71 +f 88/114/72 92/115/73 94/116/74 +f 43/117/75 61/118/76 69/119/77 47/120/78 +f 33/121/79 34/122/65 35/123/80 22/124/81 +f 41/10/82 17/125/83 43/126/75 44/127/39 +f 45/26/84 46/128/40 47/129/78 18/130/85 +f 49/70/35 24/65/86 51/66/87 52/108/66 +f 53/131/88 21/132/89 55/133/46 56/134/67 +f 57/83/36 58/135/68 59/136/45 13/137/90 +f 61/118/76 16/138/91 63/95/48 64/88/41 +f 65/98/51 14/139/92 67/140/44 68/141/42 +f 69/119/77 70/142/43 71/143/47 15/144/93 +f 85/80/31 4/145/94 87/146/95 88/147/72 +f 93/81/32 94/148/74 95/149/96 3/150/97 +f 101/84/37 11/151/98 103/152/61 104/153/57 +f 105/99/54 106/154/58 107/155/60 7/156/99 +f 109/96/49 10/157/100 111/158/30 112/159/69 +f 113/82/33 8/160/101 115/161/59 116/162/70 +f 117/97/50 118/163/71 119/164/62 9/165/102 +f 33/121/79 25/32/103 28/34/63 34/107/65 +f 45/26/84 37/25/104 40/85/38 46/87/40 +f 39/11/105 41/10/82 44/127/39 40/166/38 +f 43/117/75 47/120/78 46/167/40 44/168/39 +f 57/83/36 49/70/35 52/108/66 58/110/68 +f 51/66/87 53/131/88 56/109/67 52/108/66 +f 55/93/46 59/92/45 58/169/68 56/170/67 +f 69/119/77 61/118/76 64/88/41 70/90/43 +f 63/95/48 65/98/51 68/89/42 64/88/41 +f 67/91/44 71/94/47 70/171/43 68/172/42 +f 93/81/32 85/80/31 88/147/72 94/148/74 +f 87/9/95 89/12/106 92/115/73 88/114/72 +f 91/20/107 95/23/96 94/173/74 92/174/73 +f 105/99/54 97/54/53 100/57/56 106/154/58 +f 99/71/34 101/84/37 104/101/57 100/100/56 +f 103/105/61 107/104/60 106/175/58 104/176/57 +f 117/97/50 109/96/49 112/111/69 118/113/71 +f 111/79/30 113/82/33 116/162/70 112/177/69 +f 115/103/59 119/106/62 118/178/71 116/179/70 +f 22/180/81 21/181/89 53/182/88 33/183/79 +f 18/184/85 22/180/81 35/185/80 45/186/84 +f 17/187/83 16/138/91 61/118/76 43/117/75 +f 15/188/93 18/184/85 47/189/78 69/190/77 +f 14/191/92 13/192/90 59/92/45 67/91/44 +f 21/181/89 15/188/93 71/94/47 55/93/46 +f 13/192/90 11/193/98 101/194/37 57/195/36 +f 16/138/91 10/196/100 109/96/49 63/95/48 +f 9/197/102 14/191/92 65/198/51 117/199/50 +f 8/200/101 7/201/99 107/104/60 115/103/59 +f 11/193/98 9/197/102 119/106/62 103/105/61 +f 7/201/99 5/202/108 77/44/55 105/99/54 +f 10/196/100 4/203/94 85/80/31 111/79/30 +f 3/204/97 8/200/101 113/82/33 93/81/32 +f 5/202/109 3/204/97 95/23/96 79/22/109 +f 4/203/94 17/187/83 41/10/82 87/9/95 +f 51/66/87 25/32/103 33/121/79 53/131/88 +s 6 +f 110/205/110 62/206/110 42/207/110 86/208/110 +s 7 +f 60/209/111 66/210/111 120/211/111 102/212/111 +s 10 +f 108/213/112 114/214/112 96/215/112 78/216/112 diff --git a/public/solver/SomaSolution.js b/public/solver/SomaSolution.js new file mode 100644 index 0000000..ede6460 --- /dev/null +++ b/public/solver/SomaSolution.js @@ -0,0 +1,88 @@ +export default class SomaSolution { + constructor(dim) { + if (dim < 0 || dim % 1 !== 0) { + throw new Error("Dimension must be a whole positive integer!"); + } + this.dim = dim; + this.solutionSpaces = []; + } + static filterUnique(solutions) { + if (solutions.length === 0) { + return []; + } + const uniqueSolns = [solutions[0]]; + for (const solution of solutions) { + let foundMatch = false; + for (const rotation of solution.getUniqueRotations()) { + let end = uniqueSolns.length; + for (let i = 0; i < end; i++) { + if (rotation.matches(uniqueSolns[i])) { + foundMatch = true; + } + } + } + if (!foundMatch) { + uniqueSolns.push(solution); + } + } + return uniqueSolns; + } + getUniqueRotations() { + if (this.solutionSpaces.length === 0) { + return []; + } + const result = []; + const allRots = this.solutionSpaces.map(space => space.getAllRotations()); + for (let i = 0; i < allRots[0].length; i++) { + const solnRot = new SomaSolution(this.dim); + allRots.forEach(rotGroup => solnRot.addSpace(rotGroup[i])); + result.push(solnRot); + } + return result; + } + matches(solution) { + for (let i = 0; i < this.solutionSpaces.length; i++) { + if (!this.solutionSpaces[i].matches(solution.solutionSpaces[i])) { + return false; + } + } + return true; + } + addSpace(space) { + this.solutionSpaces.push(space); + } + print() { + let accum = ""; + console.log("---"); + for (let x = 0; x < this.dim; x++) { + for (let y = 0; y < this.dim; y++) { + for (let z = 0; z < this.dim; z++) { + for (const space of this.solutionSpaces) { + if (space.at(x, y, z)) { + accum += space.getId(); + } + } + } + console.log(accum); + accum = ""; + } + if (x !== this.dim - 1) { + console.log("-"); + } + } + console.log("---"); + } + at(x, y, z) { + for (const space of this.solutionSpaces) { + if (space.at(x, y, z)) { + return space.getId(); + } + } + return 0; + } + clone() { + const clone = new SomaSolution(this.dim); + clone.solutionSpaces = this.solutionSpaces.slice(); + return clone; + } +} diff --git a/public/solver/SomaSolver.js b/public/solver/SomaSolver.js new file mode 100644 index 0000000..c69072b --- /dev/null +++ b/public/solver/SomaSolver.js @@ -0,0 +1,48 @@ +import VoxelSpace from "./VoxelSpace.js"; +import SomaSolution from "./SomaSolution.js"; +export default class SomaSolver { + constructor(dimension) { + this.solutions = []; + this.iterations = 0; + if (dimension % 1 !== 0 || dimension < 0) { + throw new Error("The argument 'dimension' must be a positive whole number"); + } + this.dim = dimension; + this.solutionCube = new VoxelSpace(0, [dimension, dimension, dimension], Array(dimension ** 3).fill(0)); + } + async solve(polycubes) { + if (polycubes.length === 0) { + throw new Error("You must pass at least one polycube to solve the puzzle."); + } + let cumulativeSize = polycubes.reduce((prev, curr) => prev + curr.size(), 0); + if (cumulativeSize !== this.dim ** 3) { + throw new Error(`The polycubes passed do not add up to exactly enough units to form a cube of dimension ${this.dim}! Got: ${cumulativeSize}, need: ${this.dim ** 3}`); + } + this.solutions = []; + const combosWithRots = polycubes.slice(1).map(polycube => polycube.getUniqueRotations().map((rot) => rot.getAllPositionsInCube(this.dim)).flat()); + const combos = [polycubes[0].getAllPositionsInCube(this.dim), ...combosWithRots]; + this.backtrackSolve(this.solutionCube, combos, new SomaSolution(this.dim)); + this.solutions = SomaSolution.filterUnique(this.solutions); + } + getSolutions() { + return this.solutions.slice(); + } + backtrackSolve(workingSolution, polycubes, currentSoln) { + const nextCubeGroup = polycubes[0]; + for (let i = 0; i < nextCubeGroup.length; i++) { + const fusionAttempt = workingSolution.plus(nextCubeGroup[i]); + if (fusionAttempt) { + const nextSoln = currentSoln.clone(); + nextSoln.addSpace(nextCubeGroup[i]); + if (polycubes.length === 1) { + this.solutions.push(nextSoln); + currentSoln = new SomaSolution(this.dim); + return; + } + else { + this.backtrackSolve(fusionAttempt, polycubes.slice(1), nextSoln); + } + } + } + } +} diff --git a/public/solver/VoxelSpace.js b/public/solver/VoxelSpace.js new file mode 100644 index 0000000..b480eee --- /dev/null +++ b/public/solver/VoxelSpace.js @@ -0,0 +1,275 @@ +export default class VoxelSpace { + constructor(id, dims, space, cullEmpty) { + if (!space) { + space = 0n; + } + else if (Array.isArray(space)) { + if (space.length !== dims[0] * dims[1] * dims[2]) { + throw new Error("Vals don't fit in given dimensions."); + } + space = VoxelSpace.boolArrayToBigInt(space); + } + this.id = id; + this.length = dims[0] * dims[1] * dims[2]; + this.dims = dims; + this.space = space; + if (cullEmpty) { + this.cullEmptySpace(); + } + } + static boolArrayToBigInt(boolArray) { + let result = 0n; + for (let i = 0; i < boolArray.length; i++) { + if (boolArray[i]) { + result |= BigInt(1 << i); + } + } + return result; + } + binaryRep() { + return this.space.toString(2); + } + getExtrema() { + const extrema = { + xMax: -Infinity, + xMin: Infinity, + yMax: -Infinity, + yMin: Infinity, + zMax: -Infinity, + zMin: Infinity, + }; + this.forEachCell((val, x, y, z) => { + if (val) { + extrema.xMax = Math.max(extrema.xMax, x); + extrema.xMin = Math.min(extrema.xMin, x); + extrema.yMax = Math.max(extrema.yMax, y); + extrema.yMin = Math.min(extrema.yMin, y); + extrema.zMax = Math.max(extrema.zMax, z); + extrema.zMin = Math.min(extrema.zMin, z); + } + }); + return extrema; + } + cullEmptySpace() { + const extrema = this.getExtrema(); + let index = 0n; + let newSpace = 0n; + for (let x = extrema.xMin; x <= extrema.xMax; x++) { + for (let y = extrema.yMin; y <= extrema.yMax; y++) { + for (let z = extrema.zMin; z <= extrema.zMax; z++) { + if (this.at(x, y, z)) { + newSpace |= 1n << index; + } + index++; + } + } + } + this.dims[0] = extrema.xMax - extrema.xMin + 1; + this.dims[1] = extrema.yMax - extrema.yMin + 1; + this.dims[2] = extrema.zMax - extrema.zMin + 1; + this.space = newSpace; + } + forEachCell(cb) { + loopStart: for (let x = 0; x < this.dims[0]; x++) { + for (let y = 0; y < this.dims[1]; y++) { + for (let z = 0; z < this.dims[2]; z++) { + if (cb(this.at(x, y, z), x, y, z) === 0) { + break loopStart; + } + } + } + } + } + getId() { + return this.id; + } + print() { + let accum = ""; + console.log("---"); + for (let i = 0; i < this.dims[0]; i++) { + for (let j = 0; j < this.dims[1]; j++) { + for (let k = 0; k < this.dims[2]; k++) { + accum += this.at(i, j, k) ? '#' : 'O'; + } + console.log(accum); + accum = ""; + } + if (i !== this.dims[0] - 1) { + console.log("-"); + } + } + console.log("---"); + } + getUniqueRotations() { + const rotations = []; + const refSpace = this.clone(); + VoxelSpace.pushNewUniqueSpaces(rotations, refSpace.getAxisSpins('x')); + refSpace.rot90('y'); + VoxelSpace.pushNewUniqueSpaces(rotations, refSpace.getAxisSpins('x')); + refSpace.rot90('y'); + VoxelSpace.pushNewUniqueSpaces(rotations, refSpace.getAxisSpins('x')); + refSpace.rot90('y'); + VoxelSpace.pushNewUniqueSpaces(rotations, refSpace.getAxisSpins('x')); + refSpace.rot90('z'); + VoxelSpace.pushNewUniqueSpaces(rotations, refSpace.getAxisSpins('x')); + refSpace.rot90('z'); + refSpace.rot90('z'); + VoxelSpace.pushNewUniqueSpaces(rotations, refSpace.getAxisSpins('x')); + return rotations; + } + getAllRotations() { + const rotations = []; + const refSpace = this.clone(); + rotations.push(...refSpace.getAxisSpins('x')); + refSpace.rot90('y'); + rotations.push(...refSpace.getAxisSpins('x')); + refSpace.rot90('y'); + rotations.push(...refSpace.getAxisSpins('x')); + refSpace.rot90('y'); + rotations.push(...refSpace.getAxisSpins('x')); + refSpace.rot90('z'); + rotations.push(...refSpace.getAxisSpins('x')); + refSpace.rot90('z'); + refSpace.rot90('z'); + rotations.push(...refSpace.getAxisSpins('x')); + return rotations; + } + static pushNewUniqueSpaces(existingSpaces, newSpaces) { + for (const newSpace of newSpaces) { + let matchFound = false; + for (const existingSpace of existingSpaces) { + if (newSpace.matches(existingSpace)) { + matchFound = true; + break; + } + } + if (!matchFound) { + existingSpaces.push(newSpace); + } + } + } + getAllPositionsInCube(cubeDim) { + if ((cubeDim > 0) && (cubeDim % 1 === 0)) { + const cubePositions = []; + for (let x = 0; x < cubeDim - this.dims[0] + 1; x++) { + for (let y = 0; y < cubeDim - this.dims[1] + 1; y++) { + for (let z = 0; z < cubeDim - this.dims[2] + 1; z++) { + const cubePos = new VoxelSpace(this.id, [cubeDim, cubeDim, cubeDim]); + this.forEachCell((val, rotX, rotY, rotZ) => { + cubePos.set(x + rotX, y + rotY, z + rotZ, val); + }); + cubePositions.push(cubePos); + } + } + } + return cubePositions; + } + else { + throw new Error("cubeDim must be a positive integer."); + } + } + matches(space) { + const otherDims = space.getDims(); + for (let i = 0; i < this.dims.length; i++) { + if (otherDims[i] !== this.dims[i]) { + return false; + } + } + return this.space === space.getRaw(); + } + clone() { + return new VoxelSpace(this.id, this.getDims(), this.getRaw()); + } + getAxisSpins(axis) { + const rotations = [this.clone()]; + for (let i = 0; i < 3; i++) { + rotations.push(rotations[i].rotated90(axis)); + } + return rotations; + } + getDims() { + return this.dims.slice(); + } + getRaw() { + return this.space; + } + // [1, 0, 0] [x] [ x] + // [0, 0, -1] * [y] = [-z] + // [0, 1, 0] [z] [ y] + newIndexRotX(x, y, z) { + return this.dims[2] * this.dims[1] * x + this.dims[1] * (this.dims[2] - 1 - z) + y; + } + // [ 0, 0, 1] [x] [ z] + // [ 0, 1, 0] * [y] = [ y] + // [-1, 0, 0] [z] [-x] + newIndexRotY(x, y, z) { + return this.dims[1] * this.dims[0] * z + this.dims[0] * y + (this.dims[0] - 1 - x); + } + // [0, -1, 0] [x] [-y] + // [1, 0, 0] * [y] = [ x] + // [0, 0, 1] [z] [ z] + newIndexRotZ(x, y, z) { + return this.dims[0] * this.dims[2] * (this.dims[1] - 1 - y) + this.dims[2] * x + z; + } + at(x, y, z) { + const mask = 1n << BigInt(this.dims[1] * this.dims[2] * x + this.dims[2] * y + z); + return (this.space & mask) !== 0n; + } + toggle(x, y, z) { + const mask = BigInt(1 << this.dims[1] * this.dims[2] * x + this.dims[2] * y + z); + this.space ^= mask; + } + set(x, y, z, val) { + const mask = BigInt(1 << this.dims[1] * this.dims[2] * x + this.dims[2] * y + z); + if (val) { + this.space |= mask; + } + else { + this.space &= ~mask; + } + } + rotated90(dim) { + let newSpace = 0n; + let newDims; + let rotIndex; + if (dim === 'x') { + newDims = [this.dims[0], this.dims[2], this.dims[1]]; + rotIndex = this.newIndexRotX.bind(this); + } + else if (dim === 'y') { + newDims = [this.dims[2], this.dims[1], this.dims[0]]; + rotIndex = this.newIndexRotY.bind(this); + } + else { + newDims = [this.dims[1], this.dims[0], this.dims[2]]; + rotIndex = this.newIndexRotZ.bind(this); + } + this.forEachCell((val, i, j, k) => { + if (val) { + newSpace |= BigInt(1 << rotIndex(i, j, k)); + } + }); + return new VoxelSpace(this.id, newDims, newSpace); + } + rot90(dim) { + const rot = this.rotated90(dim); + this.space = rot.getRaw(); + this.dims = rot.getDims(); + } + plus(space) { + const otherSpace = space.getRaw(); + if ((this.space | otherSpace) === (this.space ^ otherSpace)) { + return new VoxelSpace(this.id, this.dims, otherSpace | this.space); + } + return null; + } + size() { + let size = 0; + this.forEachCell((val) => { + if (val) { + size++; + } + }); + return size; + } +} diff --git a/public/solver/main.js b/public/solver/main.js new file mode 100644 index 0000000..b0bfe64 --- /dev/null +++ b/public/solver/main.js @@ -0,0 +1,8 @@ +import SomaSolver from "./SomaSolver.js"; +import VoxelSpace from "./VoxelSpace.js"; +self.addEventListener('message', (event) => { + const { polycubes, dims } = event.data; + const solver = new SomaSolver(event.data.dims); + solver.solve(polycubes.map((cubeRep, i) => new VoxelSpace(i, [dims, dims, dims], cubeRep, true))); + self.postMessage(solver.getSolutions()); +}); diff --git a/report.20210524.173340.100206.0.001.json b/report.20210524.173340.100206.0.001.json deleted file mode 100644 index 54a64d6..0000000 --- a/report.20210524.173340.100206.0.001.json +++ /dev/null @@ -1,571 +0,0 @@ - -{ - "header": { - "reportVersion": 1, - "event": "Allocation failed - JavaScript heap out of memory", - "trigger": "FatalError", - "filename": "report.20210524.173340.100206.0.001.json", - "dumpEventTime": "2021-05-24T17:33:40Z", - "dumpEventTimeStamp": "1621870420290", - "processId": 100206, - "cwd": "/home/ledda/Documents/Projects/soma", - "commandLine": [ - "node", - "/home/ledda/Documents/Projects/soma/node_modules/.bin/rollup", - "-c", - "-w" - ], - "nodejsVersion": "v12.16.1", - "glibcVersionRuntime": "2.31", - "glibcVersionCompiler": "2.17", - "wordSize": 64, - "arch": "x64", - "platform": "linux", - "componentVersions": { - "node": "12.16.1", - "v8": "7.8.279.23-node.31", - "uv": "1.34.0", - "zlib": "1.2.11", - "brotli": "1.0.7", - "ares": "1.15.0", - "modules": "72", - "nghttp2": "1.40.0", - "napi": "5", - "llhttp": "2.0.4", - "http_parser": "2.9.3", - "openssl": "1.1.1d", - "cldr": "35.1", - "icu": "64.2", - "tz": "2019c", - "unicode": "12.1" - }, - "release": { - "name": "node", - "lts": "Erbium", - "headersUrl": "https://nodejs.org/download/release/v12.16.1/node-v12.16.1-headers.tar.gz", - "sourceUrl": "https://nodejs.org/download/release/v12.16.1/node-v12.16.1.tar.gz" - }, - "osName": "Linux", - "osRelease": "5.4.0-58-generic", - "osVersion": "#64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020", - "osMachine": "x86_64", - "cpus": [ - { - "model": "Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz", - "speed": 2078, - "user": 31121700, - "nice": 170300, - "sys": 6123700, - "idle": 260424700, - "irq": 0 - }, - { - "model": "Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz", - "speed": 2259, - "user": 30777600, - "nice": 83200, - "sys": 6365600, - "idle": 259562600, - "irq": 0 - }, - { - "model": "Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz", - "speed": 1990, - "user": 30976500, - "nice": 135000, - "sys": 6095200, - "idle": 260493900, - "irq": 0 - }, - { - "model": "Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz", - "speed": 2104, - "user": 30991200, - "nice": 209800, - "sys": 6189800, - "idle": 260145300, - "irq": 0 - } - ], - "networkInterfaces": [ - { - "name": "lo", - "internal": true, - "mac": "00:00:00:00:00:00", - "address": "127.0.0.1", - "netmask": "255.0.0.0", - "family": "IPv4" - }, - { - "name": "usb0", - "internal": false, - "mac": "6a:e0:73:63:43:6d", - "address": "192.168.42.208", - "netmask": "255.255.255.0", - "family": "IPv4" - }, - { - "name": "lo", - "internal": true, - "mac": "00:00:00:00:00:00", - "address": "::1", - "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", - "family": "IPv6", - "scopeid": 0 - }, - { - "name": "usb0", - "internal": false, - "mac": "6a:e0:73:63:43:6d", - "address": "fe80::e4ee:20d6:a77d:7424", - "netmask": "ffff:ffff:ffff:ffff::", - "family": "IPv6", - "scopeid": 3 - }, - { - "name": "is0", - "internal": false, - "mac": "c0:a8:2a:d0:00:00", - "address": "fe80::5efe:c0a8:2ad0", - "netmask": "ffff:ffff:ffff:ffff::", - "family": "IPv6", - "scopeid": 5 - } - ], - "host": "ledda-desktop" - }, - "javascriptStack": { - "message": "No stack.", - "stack": [ - "Unavailable." - ] - }, - "nativeStack": [ - { - "pc": "0x0000000000b278f5", - "symbol": "report::TriggerNodeReport(v8::Isolate*, node::Environment*, char const*, char const*, std::string const&, v8::Local) [node]" - }, - { - "pc": "0x00000000009f13ec", - "symbol": "node::OnFatalError(char const*, char const*) [node]" - }, - { - "pc": "0x0000000000b5da9e", - "symbol": "v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]" - }, - { - "pc": "0x0000000000b5de19", - "symbol": "v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]" - }, - { - "pc": "0x0000000000d0a765", - "symbol": " [node]" - }, - { - "pc": "0x0000000000d0adf6", - "symbol": "v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]" - }, - { - "pc": "0x0000000000d1760a", - "symbol": "v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]" - }, - { - "pc": "0x0000000000d18515", - "symbol": "v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]" - }, - { - "pc": "0x0000000000d1afcc", - "symbol": "v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]" - }, - { - "pc": "0x0000000000ce19bb", - "symbol": "v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]" - }, - { - "pc": "0x000000000102482c", - "symbol": "v8::internal::Runtime_AllocateInOldGeneration(int, unsigned long*, v8::internal::Isolate*) [node]" - }, - { - "pc": "0x00000000013a71b9", - "symbol": " [node]" - } - ], - "javascriptHeap": { - "totalMemory": 2157666304, - "totalCommittedMemory": 2151878616, - "usedMemory": 2143893656, - "availableMemory": 47815288, - "memoryLimit": 2197815296, - "heapSpaces": { - "read_only_space": { - "memorySize": 262144, - "committedMemory": 33088, - "capacity": 32808, - "used": 32808, - "available": 0 - }, - "new_space": { - "memorySize": 6291456, - "committedMemory": 947440, - "capacity": 3142368, - "used": 90128, - "available": 3052240 - }, - "old_space": { - "memorySize": 2078425088, - "committedMemory": 2078270944, - "capacity": 2074173168, - "used": 2072701480, - "available": 1471688 - }, - "code_space": { - "memorySize": 2789376, - "committedMemory": 2732704, - "capacity": 2164608, - "used": 2164608, - "available": 0 - }, - "map_space": { - "memorySize": 1576960, - "committedMemory": 1573160, - "capacity": 1012000, - "used": 1012000, - "available": 0 - }, - "large_object_space": { - "memorySize": 68001792, - "committedMemory": 68001792, - "capacity": 67632216, - "used": 67632216, - "available": 0 - }, - "code_large_object_space": { - "memorySize": 319488, - "committedMemory": 319488, - "capacity": 260416, - "used": 260416, - "available": 0 - }, - "new_large_object_space": { - "memorySize": 0, - "committedMemory": 0, - "capacity": 3142368, - "used": 0, - "available": 3142368 - } - } - }, - "resourceUsage": { - "userCpuSeconds": 528.903, - "kernelCpuSeconds": 24.0468, - "cpuConsumptionPercent": 21.9512, - "maxRss": 2266980352, - "pageFaults": { - "IORequired": 22, - "IONotRequired": 2423406 - }, - "fsActivity": { - "reads": 3008, - "writes": 255304 - } - }, - "uvthreadResourceUsage": { - "userCpuSeconds": 213.2, - "kernelCpuSeconds": 7.85018, - "cpuConsumptionPercent": 8.7753, - "fsActivity": { - "reads": 3008, - "writes": 0 - } - }, - "libuv": [ - ], - "environmentVariables": { - "GJS_DEBUG_TOPICS": "JS ERROR;JS LOG", - "LESSOPEN": "| /usr/bin/lesspipe %s", - "npm_package_devDependencies_rollup": "^2.3.4", - "npm_config_cache_lock_stale": "60000", - "npm_config_ham_it_up": "", - "npm_config_legacy_bundling": "", - "npm_config_sign_git_tag": "", - "LANGUAGE": "en", - "USER": "ledda", - "LC_TIME": "de_DE.UTF-8", - "npm_package_devDependencies__rollup_plugin_node_resolve": "^11.0.0", - "npm_config_user_agent": "npm/6.14.5 node/v12.16.1 linux x64", - "npm_config_always_auth": "", - "npm_package_devDependencies_rollup_plugin_css_only": "^3.1.0", - "npm_config_bin_links": "true", - "npm_config_key": "", - "SSH_AGENT_PID": "3025", - "XDG_SESSION_TYPE": "x11", - "GIT_ASKPASS": "/usr/share/code/resources/app/extensions/git/dist/askpass.sh", - "npm_config_allow_same_version": "", - "npm_config_description": "true", - "npm_config_fetch_retries": "2", - "npm_config_heading": "npm", - "npm_config_if_present": "", - "npm_config_init_version": "1.0.0", - "npm_config_user": "1000", - "npm_node_execpath": "/home/ledda/.nvm/versions/node/v12.16.1/bin/node", - "SHLVL": "1", - "npm_config_prefer_online": "", - "npm_config_noproxy": "", - "HOME": "/home/ledda", - "CHROME_DESKTOP": "code-url-handler.desktop", - "npm_config_force": "", - "TERM_PROGRAM_VERSION": "1.52.0", - "DESKTOP_SESSION": "ubuntu", - "NVM_BIN": "/home/ledda/.nvm/versions/node/v12.16.1/bin", - "npm_config_only": "", - "npm_config_read_only": "", - "NVM_INC": "/home/ledda/.nvm/versions/node/v12.16.1/include/node", - "GIO_LAUNCHED_DESKTOP_FILE": "/usr/share/applications/code.desktop", - "npm_package_devDependencies_svelte_preprocess": "^4.0.0", - "npm_package_dependencies_three": "^0.128.0", - "npm_config_cache_min": "10", - "npm_config_init_license": "ISC", - "GNOME_SHELL_SESSION_MODE": "ubuntu", - "GTK_MODULES": "gail:atk-bridge", - "VSCODE_GIT_ASKPASS_MAIN": "/usr/share/code/resources/app/extensions/git/dist/askpass-main.js", - "npm_package_devDependencies_svelte_check": "^1.0.0", - "npm_config_editor": "vi", - "npm_config_rollback": "true", - "npm_config_tag_version_prefix": "v", - "LC_MONETARY": "de_DE.UTF-8", - "VSCODE_GIT_ASKPASS_NODE": "/usr/share/code/code", - "MANAGERPID": "2840", - "npm_config_cache_max": "Infinity", - "npm_config_timing": "", - "npm_config_userconfig": "/home/ledda/.npmrc", - "DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/1000/bus", - "npm_config_engine_strict": "", - "npm_config_init_author_name": "", - "npm_config_init_author_url": "", - "npm_config_preid": "", - "npm_config_tmp": "/tmp", - "COLORTERM": "truecolor", - "GIO_LAUNCHED_DESKTOP_FILE_PID": "77123", - "npm_package_description": "Custom Somaesque cube solver webapp", - "npm_package_devDependencies_typescript": "^4.0.0", - "npm_config_depth": "Infinity", - "npm_config_package_lock_only": "", - "npm_config_save_dev": "", - "npm_config_usage": "", - "NVM_DIR": "/home/ledda/.nvm", - "npm_config_metrics_registry": "https://registry.npmjs.org/", - "npm_config_cafile": "", - "npm_config_otp": "", - "npm_config_package_lock": "true", - "npm_config_progress": "true", - "npm_config_https_proxy": "", - "npm_config_save_prod": "", - "MANDATORY_PATH": "/usr/share/gconf/ubuntu.mandatory.path", - "IM_CONFIG_PHASE": "1", - "npm_package_scripts_dev": "rollup -c -w", - "npm_config_audit": "true", - "npm_config_cidr": "", - "npm_config_onload_script": "", - "npm_config_sso_type": "oauth", - "LOGNAME": "ledda", - "npm_config_rebuild_bundle": "true", - "npm_config_save_bundle": "", - "npm_config_shell": "/bin/bash", - "JOURNAL_STREAM": "9:51482", - "_": "/home/ledda/.nvm/versions/node/v12.16.1/bin/npm", - "npm_package_devDependencies__rollup_plugin_commonjs": "^17.0.0", - "npm_config_dry_run": "", - "npm_config_format_package_lock": "true", - "npm_config_prefix": "/home/ledda/.nvm/versions/node/v12.16.1", - "XDG_SESSION_CLASS": "user", - "DEFAULTS_PATH": "/usr/share/gconf/ubuntu.default.path", - "npm_config_scope": "", - "npm_config_browser": "", - "npm_config_cache_lock_wait": "10000", - "npm_config_ignore_prepublish": "", - "npm_config_registry": "https://registry.npmjs.org/", - "npm_config_save_optional": "", - "npm_config_searchopts": "", - "npm_config_versions": "", - "USERNAME": "ledda", - "TERM": "xterm-256color", - "npm_config_cache": "/home/ledda/.npm", - "npm_config_proxy": "", - "npm_config_send_metrics": "", - "GNOME_DESKTOP_SESSION_ID": "this-is-deprecated", - "npm_package_scripts_start": "sirv public --no-clear", - "npm_package_dependencies_sirv_cli": "^1.0.0", - "npm_config_global_style": "", - "npm_config_ignore_scripts": "", - "npm_config_version": "", - "WINDOWPATH": "2", - "npm_config_local_address": "", - "npm_config_viewer": "man", - "npm_config_node_gyp": "/home/ledda/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js", - "PATH": "/home/ledda/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ledda/Documents/Projects/soma/node_modules/.bin:/home/ledda/.local/bin:/home/ledda/.nvm/versions/node/v12.16.1/bin:/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin:/home/ledda/.local/bin:/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/texlive/2020/bin/x86_64-linux:/home/ledda/.local/bin:/usr/local/texlive/2020/bin/x86_64-linux:/home/ledda/.local/bin:/usr/local/texlive/2020/bin/i386-linux:/home/ledda/.local/bin:/home/ledda/.local/bin:/usr/local/texlive/2020/bin/i386-linux", - "SESSION_MANAGER": "local/ledda-desktop:@/tmp/.ICE-unix/3074,unix/ledda-desktop:/tmp/.ICE-unix/3074", - "INVOCATION_ID": "930ec6cef1e44490b3814c04c1c8d766", - "PAPERSIZE": "a4", - "npm_package_name": "soma", - "npm_config_audit_level": "low", - "npm_config_prefer_offline": "", - "NODE": "/home/ledda/.nvm/versions/node/v12.16.1/bin/node", - "XDG_MENU_PREFIX": "gnome-", - "LC_ADDRESS": "de_DE.UTF-8", - "XDG_RUNTIME_DIR": "/run/user/1000", - "npm_package_devDependencies_rollup_plugin_svelte": "^7.0.0", - "npm_config_color": "true", - "npm_config_sign_git_commit": "", - "DISPLAY": ":0", - "npm_package_devDependencies__rollup_plugin_typescript": "^8.0.0", - "npm_config_fetch_retry_mintimeout": "10000", - "npm_config_maxsockets": "50", - "npm_config_offline": "", - "npm_config_sso_poll_frequency": "500", - "LANG": "en_US.UTF-8", - "XDG_CURRENT_DESKTOP": "Unity", - "LC_TELEPHONE": "de_DE.UTF-8", - "npm_package_devDependencies_rollup_plugin_terser": "^7.0.0", - "npm_config_umask": "0002", - "XMODIFIERS": "@im=ibus", - "XDG_SESSION_DESKTOP": "ubuntu", - "XAUTHORITY": "/run/user/1000/gdm/Xauthority", - "LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:", - "VSCODE_GIT_IPC_HANDLE": "/run/user/1000/vscode-git-06d741d5d2.sock", - "TERM_PROGRAM": "vscode", - "npm_package_gitHead": "1c60c4f0d48d9df6f9ba4cf9014dd437e2eb2ec5", - "npm_config_fund": "true", - "npm_config_fetch_retry_maxtimeout": "60000", - "npm_config_loglevel": "notice", - "npm_config_logs_max": "10", - "npm_config_message": "%s", - "npm_lifecycle_script": "rollup -c -w", - "SSH_AUTH_SOCK": "/run/user/1000/keyring/ssh", - "ORIGINAL_XDG_CURRENT_DESKTOP": "ubuntu:GNOME", - "npm_package_devDependencies__tsconfig_svelte": "^1.0.0", - "npm_config_ca": "", - "npm_config_cert": "", - "npm_config_global": "", - "npm_config_link": "", - "SHELL": "/bin/bash", - "LC_NAME": "de_DE.UTF-8", - "npm_package_version": "1.0.0", - "npm_config_access": "", - "npm_config_also": "", - "npm_config_save": "true", - "npm_config_unicode": "true", - "npm_lifecycle_event": "dev", - "QT_ACCESSIBILITY": "1", - "GDMSESSION": "ubuntu", - "npm_package_scripts_build": "rollup -c", - "npm_package_devDependencies_svelte": "^3.0.0", - "npm_package_devDependencies_tslib": "^2.0.0", - "npm_config_argv": "{\"remain\":[],\"cooked\":[\"run\",\"dev\"],\"original\":[\"run\",\"dev\"]}", - "npm_config_before": "", - "npm_config_long": "", - "npm_config_production": "", - "npm_config_searchlimit": "20", - "npm_config_unsafe_perm": "true", - "npm_config_update_notifier": "true", - "LESSCLOSE": "/usr/bin/lesspipe %s %s", - "npm_config_auth_type": "legacy", - "npm_config_node_version": "12.16.1", - "npm_config_tag": "latest", - "LC_MEASUREMENT": "de_DE.UTF-8", - "npm_package_scripts_validate": "svelte-check", - "npm_config_git_tag_version": "true", - "npm_config_commit_hooks": "true", - "npm_config_script_shell": "", - "npm_config_shrinkwrap": "true", - "GPG_AGENT_INFO": "/run/user/1000/gnupg/S.gpg-agent:0:1", - "GJS_DEBUG_OUTPUT": "stderr", - "LC_IDENTIFICATION": "de_DE.UTF-8", - "npm_package_license": "ISC", - "npm_config_fetch_retry_factor": "10", - "npm_config_save_exact": "", - "npm_config_strict_ssl": "true", - "QT_IM_MODULE": "ibus", - "npm_config_dev": "", - "npm_config_globalconfig": "/home/ledda/.nvm/versions/node/v12.16.1/etc/npmrc", - "npm_config_init_module": "/home/ledda/.npm-init.js", - "npm_config_parseable": "", - "JAVA_HOME": "/usr/lib/jvm/java-1.11.0-openjdk-amd64", - "PWD": "/home/ledda/Documents/Projects/soma", - "npm_config_globalignorefile": "/home/ledda/.nvm/versions/node/v12.16.1/etc/npmignore", - "npm_execpath": "/home/ledda/.nvm/versions/node/v12.16.1/lib/node_modules/npm/bin/npm-cli.js", - "XDG_CONFIG_DIRS": "/etc/xdg/xdg-ubuntu:/etc/xdg", - "NVM_CD_FLAGS": "", - "XDG_DATA_DIRS": "/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop", - "npm_package_author_name": "Daniel Ledda", - "npm_config_cache_lock_retries": "10", - "npm_config_searchstaleness": "900", - "LC_NUMERIC": "de_DE.UTF-8", - "npm_config_node_options": "", - "npm_config_save_prefix": "^", - "npm_config_scripts_prepend_node_path": "warn-only", - "BOOST_LIBRARYDIR": "/usr/lib", - "LC_PAPER": "de_DE.UTF-8", - "npm_package_devDependencies__types_three": "^0.128.0", - "npm_package_devDependencies_rollup_plugin_livereload": "^2.0.0", - "npm_config_group": "1000", - "npm_config_init_author_email": "", - "npm_config_searchexclude": "", - "npm_config_git": "git", - "npm_config_optional": "true", - "npm_config_json": "", - "INIT_CWD": "/home/ledda/Documents/Projects/soma", - "ROLLUP_WATCH": "true" - }, - "userLimits": { - "core_file_size_blocks": { - "soft": 0, - "hard": "unlimited" - }, - "data_seg_size_kbytes": { - "soft": "unlimited", - "hard": "unlimited" - }, - "file_size_blocks": { - "soft": "unlimited", - "hard": "unlimited" - }, - "max_locked_memory_bytes": { - "soft": 67108864, - "hard": 67108864 - }, - "max_memory_size_kbytes": { - "soft": "unlimited", - "hard": "unlimited" - }, - "open_files": { - "soft": 1048576, - "hard": 1048576 - }, - "stack_size_bytes": { - "soft": 8388608, - "hard": "unlimited" - }, - "cpu_time_seconds": { - "soft": "unlimited", - "hard": "unlimited" - }, - "max_user_processes": { - "soft": 47649, - "hard": 47649 - }, - "virtual_memory_kbytes": { - "soft": "unlimited", - "hard": "unlimited" - } - }, - "sharedObjects": [ - "linux-vdso.so.1", - "/lib/x86_64-linux-gnu/libdl.so.2", - "/usr/lib/x86_64-linux-gnu/libstdc++.so.6", - "/lib/x86_64-linux-gnu/libm.so.6", - "/lib/x86_64-linux-gnu/libgcc_s.so.1", - "/lib/x86_64-linux-gnu/libpthread.so.0", - "/lib/x86_64-linux-gnu/libc.so.6", - "/lib64/ld-linux-x86-64.so.2" - ] -} \ No newline at end of file diff --git a/report.20210524.182447.107803.0.001.json b/report.20210524.182447.107803.0.001.json deleted file mode 100644 index 8a872b0..0000000 --- a/report.20210524.182447.107803.0.001.json +++ /dev/null @@ -1,571 +0,0 @@ - -{ - "header": { - "reportVersion": 1, - "event": "Allocation failed - JavaScript heap out of memory", - "trigger": "FatalError", - "filename": "report.20210524.182447.107803.0.001.json", - "dumpEventTime": "2021-05-24T18:24:47Z", - "dumpEventTimeStamp": "1621873487421", - "processId": 107803, - "cwd": "/home/ledda/Documents/Projects/soma", - "commandLine": [ - "node", - "/home/ledda/Documents/Projects/soma/node_modules/.bin/rollup", - "-c", - "-w" - ], - "nodejsVersion": "v12.16.1", - "glibcVersionRuntime": "2.31", - "glibcVersionCompiler": "2.17", - "wordSize": 64, - "arch": "x64", - "platform": "linux", - "componentVersions": { - "node": "12.16.1", - "v8": "7.8.279.23-node.31", - "uv": "1.34.0", - "zlib": "1.2.11", - "brotli": "1.0.7", - "ares": "1.15.0", - "modules": "72", - "nghttp2": "1.40.0", - "napi": "5", - "llhttp": "2.0.4", - "http_parser": "2.9.3", - "openssl": "1.1.1d", - "cldr": "35.1", - "icu": "64.2", - "tz": "2019c", - "unicode": "12.1" - }, - "release": { - "name": "node", - "lts": "Erbium", - "headersUrl": "https://nodejs.org/download/release/v12.16.1/node-v12.16.1-headers.tar.gz", - "sourceUrl": "https://nodejs.org/download/release/v12.16.1/node-v12.16.1.tar.gz" - }, - "osName": "Linux", - "osRelease": "5.4.0-58-generic", - "osVersion": "#64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020", - "osMachine": "x86_64", - "cpus": [ - { - "model": "Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz", - "speed": 798, - "user": 38624500, - "nice": 170400, - "sys": 7120900, - "idle": 282258500, - "irq": 0 - }, - { - "model": "Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz", - "speed": 799, - "user": 37865900, - "nice": 83200, - "sys": 7606700, - "idle": 281427700, - "irq": 0 - }, - { - "model": "Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz", - "speed": 799, - "user": 38413400, - "nice": 135100, - "sys": 7095900, - "idle": 282373500, - "irq": 0 - }, - { - "model": "Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz", - "speed": 799, - "user": 38396500, - "nice": 209800, - "sys": 7252000, - "idle": 281929200, - "irq": 0 - } - ], - "networkInterfaces": [ - { - "name": "lo", - "internal": true, - "mac": "00:00:00:00:00:00", - "address": "127.0.0.1", - "netmask": "255.0.0.0", - "family": "IPv4" - }, - { - "name": "usb0", - "internal": false, - "mac": "6a:e0:73:63:43:6d", - "address": "192.168.42.208", - "netmask": "255.255.255.0", - "family": "IPv4" - }, - { - "name": "lo", - "internal": true, - "mac": "00:00:00:00:00:00", - "address": "::1", - "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", - "family": "IPv6", - "scopeid": 0 - }, - { - "name": "usb0", - "internal": false, - "mac": "6a:e0:73:63:43:6d", - "address": "fe80::e4ee:20d6:a77d:7424", - "netmask": "ffff:ffff:ffff:ffff::", - "family": "IPv6", - "scopeid": 3 - }, - { - "name": "is0", - "internal": false, - "mac": "c0:a8:2a:d0:00:00", - "address": "fe80::5efe:c0a8:2ad0", - "netmask": "ffff:ffff:ffff:ffff::", - "family": "IPv6", - "scopeid": 5 - } - ], - "host": "ledda-desktop" - }, - "javascriptStack": { - "message": "No stack.", - "stack": [ - "Unavailable." - ] - }, - "nativeStack": [ - { - "pc": "0x0000000000b278f5", - "symbol": "report::TriggerNodeReport(v8::Isolate*, node::Environment*, char const*, char const*, std::string const&, v8::Local) [node]" - }, - { - "pc": "0x00000000009f13ec", - "symbol": "node::OnFatalError(char const*, char const*) [node]" - }, - { - "pc": "0x0000000000b5da9e", - "symbol": "v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]" - }, - { - "pc": "0x0000000000b5de19", - "symbol": "v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]" - }, - { - "pc": "0x0000000000d0a765", - "symbol": " [node]" - }, - { - "pc": "0x0000000000d0adf6", - "symbol": "v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]" - }, - { - "pc": "0x0000000000d1760a", - "symbol": "v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]" - }, - { - "pc": "0x0000000000d18515", - "symbol": "v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]" - }, - { - "pc": "0x0000000000d1afcc", - "symbol": "v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]" - }, - { - "pc": "0x0000000000ce19bb", - "symbol": "v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]" - }, - { - "pc": "0x00000000010246ce", - "symbol": "v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]" - }, - { - "pc": "0x00000000013a71b9", - "symbol": " [node]" - } - ], - "javascriptHeap": { - "totalMemory": 2157629440, - "totalCommittedMemory": 2151008656, - "usedMemory": 2141505488, - "availableMemory": 50475080, - "memoryLimit": 2197815296, - "heapSpaces": { - "read_only_space": { - "memorySize": 262144, - "committedMemory": 33088, - "capacity": 32808, - "used": 32808, - "available": 0 - }, - "new_space": { - "memorySize": 8388608, - "committedMemory": 2822400, - "capacity": 4189824, - "used": 946176, - "available": 3243648 - }, - "old_space": { - "memorySize": 2078949376, - "committedMemory": 2078195528, - "capacity": 2074693408, - "used": 2071837656, - "available": 2855752 - }, - "code_space": { - "memorySize": 2527232, - "committedMemory": 2459360, - "capacity": 2163968, - "used": 2163968, - "available": 0 - }, - "map_space": { - "memorySize": 1576960, - "committedMemory": 1573160, - "capacity": 1019840, - "used": 1019840, - "available": 0 - }, - "large_object_space": { - "memorySize": 65605632, - "committedMemory": 65605632, - "capacity": 65244624, - "used": 65244624, - "available": 0 - }, - "code_large_object_space": { - "memorySize": 319488, - "committedMemory": 319488, - "capacity": 260416, - "used": 260416, - "available": 0 - }, - "new_large_object_space": { - "memorySize": 0, - "committedMemory": 0, - "capacity": 4189824, - "used": 0, - "available": 4189824 - } - } - }, - "resourceUsage": { - "userCpuSeconds": 697.026, - "kernelCpuSeconds": 30.8195, - "cpuConsumptionPercent": 24.053, - "maxRss": 2264485888, - "pageFaults": { - "IORequired": 0, - "IONotRequired": 2769524 - }, - "fsActivity": { - "reads": 0, - "writes": 251088 - } - }, - "uvthreadResourceUsage": { - "userCpuSeconds": 279.526, - "kernelCpuSeconds": 11.6456, - "cpuConsumptionPercent": 9.62231, - "fsActivity": { - "reads": 0, - "writes": 0 - } - }, - "libuv": [ - ], - "environmentVariables": { - "GJS_DEBUG_TOPICS": "JS ERROR;JS LOG", - "LESSOPEN": "| /usr/bin/lesspipe %s", - "npm_package_devDependencies_rollup": "^2.3.4", - "npm_config_cache_lock_stale": "60000", - "npm_config_ham_it_up": "", - "npm_config_legacy_bundling": "", - "npm_config_sign_git_tag": "", - "LANGUAGE": "en", - "USER": "ledda", - "LC_TIME": "de_DE.UTF-8", - "npm_package_devDependencies__rollup_plugin_node_resolve": "^11.0.0", - "npm_config_user_agent": "npm/6.14.5 node/v12.16.1 linux x64", - "npm_config_always_auth": "", - "npm_package_devDependencies_rollup_plugin_css_only": "^3.1.0", - "npm_config_bin_links": "true", - "npm_config_key": "", - "SSH_AGENT_PID": "3025", - "XDG_SESSION_TYPE": "x11", - "GIT_ASKPASS": "/usr/share/code/resources/app/extensions/git/dist/askpass.sh", - "npm_config_allow_same_version": "", - "npm_config_description": "true", - "npm_config_fetch_retries": "2", - "npm_config_heading": "npm", - "npm_config_if_present": "", - "npm_config_init_version": "1.0.0", - "npm_config_user": "1000", - "npm_node_execpath": "/home/ledda/.nvm/versions/node/v12.16.1/bin/node", - "SHLVL": "1", - "npm_config_prefer_online": "", - "npm_config_noproxy": "", - "HOME": "/home/ledda", - "CHROME_DESKTOP": "code-url-handler.desktop", - "npm_config_force": "", - "TERM_PROGRAM_VERSION": "1.52.0", - "DESKTOP_SESSION": "ubuntu", - "NVM_BIN": "/home/ledda/.nvm/versions/node/v12.16.1/bin", - "npm_config_only": "", - "npm_config_read_only": "", - "NVM_INC": "/home/ledda/.nvm/versions/node/v12.16.1/include/node", - "GIO_LAUNCHED_DESKTOP_FILE": "/usr/share/applications/code.desktop", - "npm_package_devDependencies_svelte_preprocess": "^4.0.0", - "npm_package_dependencies_three": "^0.128.0", - "npm_config_cache_min": "10", - "npm_config_init_license": "ISC", - "GNOME_SHELL_SESSION_MODE": "ubuntu", - "GTK_MODULES": "gail:atk-bridge", - "VSCODE_GIT_ASKPASS_MAIN": "/usr/share/code/resources/app/extensions/git/dist/askpass-main.js", - "npm_package_devDependencies_svelte_check": "^1.0.0", - "npm_config_editor": "vi", - "npm_config_rollback": "true", - "npm_config_tag_version_prefix": "v", - "LC_MONETARY": "de_DE.UTF-8", - "VSCODE_GIT_ASKPASS_NODE": "/usr/share/code/code", - "MANAGERPID": "2840", - "npm_config_cache_max": "Infinity", - "npm_config_timing": "", - "npm_config_userconfig": "/home/ledda/.npmrc", - "DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/1000/bus", - "npm_config_engine_strict": "", - "npm_config_init_author_name": "", - "npm_config_init_author_url": "", - "npm_config_preid": "", - "npm_config_tmp": "/tmp", - "COLORTERM": "truecolor", - "GIO_LAUNCHED_DESKTOP_FILE_PID": "77123", - "npm_package_description": "Custom Somaesque cube solver webapp", - "npm_package_devDependencies_typescript": "^4.0.0", - "npm_config_depth": "Infinity", - "npm_config_package_lock_only": "", - "npm_config_save_dev": "", - "npm_config_usage": "", - "NVM_DIR": "/home/ledda/.nvm", - "npm_config_metrics_registry": "https://registry.npmjs.org/", - "npm_config_cafile": "", - "npm_config_otp": "", - "npm_config_package_lock": "true", - "npm_config_progress": "true", - "npm_config_https_proxy": "", - "npm_config_save_prod": "", - "MANDATORY_PATH": "/usr/share/gconf/ubuntu.mandatory.path", - "IM_CONFIG_PHASE": "1", - "npm_package_scripts_dev": "rollup -c -w", - "npm_config_audit": "true", - "npm_config_cidr": "", - "npm_config_onload_script": "", - "npm_config_sso_type": "oauth", - "LOGNAME": "ledda", - "npm_config_rebuild_bundle": "true", - "npm_config_save_bundle": "", - "npm_config_shell": "/bin/bash", - "JOURNAL_STREAM": "9:51482", - "_": "/home/ledda/.nvm/versions/node/v12.16.1/bin/npm", - "npm_package_devDependencies__rollup_plugin_commonjs": "^17.0.0", - "npm_config_dry_run": "", - "npm_config_format_package_lock": "true", - "npm_config_prefix": "/home/ledda/.nvm/versions/node/v12.16.1", - "XDG_SESSION_CLASS": "user", - "DEFAULTS_PATH": "/usr/share/gconf/ubuntu.default.path", - "npm_config_scope": "", - "npm_config_browser": "", - "npm_config_cache_lock_wait": "10000", - "npm_config_ignore_prepublish": "", - "npm_config_registry": "https://registry.npmjs.org/", - "npm_config_save_optional": "", - "npm_config_searchopts": "", - "npm_config_versions": "", - "USERNAME": "ledda", - "TERM": "xterm-256color", - "npm_config_cache": "/home/ledda/.npm", - "npm_config_proxy": "", - "npm_config_send_metrics": "", - "GNOME_DESKTOP_SESSION_ID": "this-is-deprecated", - "npm_package_scripts_start": "sirv public --no-clear", - "npm_package_dependencies_sirv_cli": "^1.0.0", - "npm_config_global_style": "", - "npm_config_ignore_scripts": "", - "npm_config_version": "", - "WINDOWPATH": "2", - "npm_config_local_address": "", - "npm_config_viewer": "man", - "npm_config_node_gyp": "/home/ledda/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js", - "PATH": "/home/ledda/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ledda/Documents/Projects/soma/node_modules/.bin:/home/ledda/.local/bin:/home/ledda/.nvm/versions/node/v12.16.1/bin:/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin:/home/ledda/.local/bin:/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/texlive/2020/bin/x86_64-linux:/home/ledda/.local/bin:/usr/local/texlive/2020/bin/x86_64-linux:/home/ledda/.local/bin:/usr/local/texlive/2020/bin/i386-linux:/home/ledda/.local/bin:/home/ledda/.local/bin:/usr/local/texlive/2020/bin/i386-linux", - "SESSION_MANAGER": "local/ledda-desktop:@/tmp/.ICE-unix/3074,unix/ledda-desktop:/tmp/.ICE-unix/3074", - "INVOCATION_ID": "930ec6cef1e44490b3814c04c1c8d766", - "PAPERSIZE": "a4", - "npm_package_name": "soma", - "npm_config_audit_level": "low", - "npm_config_prefer_offline": "", - "NODE": "/home/ledda/.nvm/versions/node/v12.16.1/bin/node", - "XDG_MENU_PREFIX": "gnome-", - "LC_ADDRESS": "de_DE.UTF-8", - "XDG_RUNTIME_DIR": "/run/user/1000", - "npm_package_devDependencies_rollup_plugin_svelte": "^7.0.0", - "npm_config_color": "true", - "npm_config_sign_git_commit": "", - "DISPLAY": ":0", - "npm_package_devDependencies__rollup_plugin_typescript": "^8.0.0", - "npm_config_fetch_retry_mintimeout": "10000", - "npm_config_maxsockets": "50", - "npm_config_offline": "", - "npm_config_sso_poll_frequency": "500", - "LANG": "en_US.UTF-8", - "XDG_CURRENT_DESKTOP": "Unity", - "LC_TELEPHONE": "de_DE.UTF-8", - "npm_package_devDependencies_rollup_plugin_terser": "^7.0.0", - "npm_config_umask": "0002", - "XMODIFIERS": "@im=ibus", - "XDG_SESSION_DESKTOP": "ubuntu", - "XAUTHORITY": "/run/user/1000/gdm/Xauthority", - "LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:", - "VSCODE_GIT_IPC_HANDLE": "/run/user/1000/vscode-git-06d741d5d2.sock", - "TERM_PROGRAM": "vscode", - "npm_package_gitHead": "1c60c4f0d48d9df6f9ba4cf9014dd437e2eb2ec5", - "npm_config_fund": "true", - "npm_config_fetch_retry_maxtimeout": "60000", - "npm_config_loglevel": "notice", - "npm_config_logs_max": "10", - "npm_config_message": "%s", - "npm_lifecycle_script": "rollup -c -w", - "SSH_AUTH_SOCK": "/run/user/1000/keyring/ssh", - "ORIGINAL_XDG_CURRENT_DESKTOP": "ubuntu:GNOME", - "npm_package_devDependencies__tsconfig_svelte": "^1.0.0", - "npm_config_ca": "", - "npm_config_cert": "", - "npm_config_global": "", - "npm_config_link": "", - "SHELL": "/bin/bash", - "LC_NAME": "de_DE.UTF-8", - "npm_package_version": "1.0.0", - "npm_config_access": "", - "npm_config_also": "", - "npm_config_save": "true", - "npm_config_unicode": "true", - "npm_lifecycle_event": "dev", - "QT_ACCESSIBILITY": "1", - "GDMSESSION": "ubuntu", - "npm_package_scripts_build": "rollup -c", - "npm_package_devDependencies_svelte": "^3.0.0", - "npm_package_devDependencies_tslib": "^2.0.0", - "npm_config_argv": "{\"remain\":[],\"cooked\":[\"run\",\"dev\"],\"original\":[\"run\",\"dev\"]}", - "npm_config_before": "", - "npm_config_long": "", - "npm_config_production": "", - "npm_config_searchlimit": "20", - "npm_config_unsafe_perm": "true", - "npm_config_update_notifier": "true", - "LESSCLOSE": "/usr/bin/lesspipe %s %s", - "npm_config_auth_type": "legacy", - "npm_config_node_version": "12.16.1", - "npm_config_tag": "latest", - "LC_MEASUREMENT": "de_DE.UTF-8", - "npm_package_scripts_validate": "svelte-check", - "npm_config_git_tag_version": "true", - "npm_config_commit_hooks": "true", - "npm_config_script_shell": "", - "npm_config_shrinkwrap": "true", - "GPG_AGENT_INFO": "/run/user/1000/gnupg/S.gpg-agent:0:1", - "GJS_DEBUG_OUTPUT": "stderr", - "LC_IDENTIFICATION": "de_DE.UTF-8", - "npm_package_license": "ISC", - "npm_config_fetch_retry_factor": "10", - "npm_config_save_exact": "", - "npm_config_strict_ssl": "true", - "QT_IM_MODULE": "ibus", - "npm_config_dev": "", - "npm_config_globalconfig": "/home/ledda/.nvm/versions/node/v12.16.1/etc/npmrc", - "npm_config_init_module": "/home/ledda/.npm-init.js", - "npm_config_parseable": "", - "JAVA_HOME": "/usr/lib/jvm/java-1.11.0-openjdk-amd64", - "PWD": "/home/ledda/Documents/Projects/soma", - "npm_config_globalignorefile": "/home/ledda/.nvm/versions/node/v12.16.1/etc/npmignore", - "npm_execpath": "/home/ledda/.nvm/versions/node/v12.16.1/lib/node_modules/npm/bin/npm-cli.js", - "XDG_CONFIG_DIRS": "/etc/xdg/xdg-ubuntu:/etc/xdg", - "NVM_CD_FLAGS": "", - "XDG_DATA_DIRS": "/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop", - "npm_package_author_name": "Daniel Ledda", - "npm_config_cache_lock_retries": "10", - "npm_config_searchstaleness": "900", - "LC_NUMERIC": "de_DE.UTF-8", - "npm_config_node_options": "", - "npm_config_save_prefix": "^", - "npm_config_scripts_prepend_node_path": "warn-only", - "BOOST_LIBRARYDIR": "/usr/lib", - "LC_PAPER": "de_DE.UTF-8", - "npm_package_devDependencies__types_three": "^0.128.0", - "npm_package_devDependencies_rollup_plugin_livereload": "^2.0.0", - "npm_config_group": "1000", - "npm_config_init_author_email": "", - "npm_config_searchexclude": "", - "npm_config_git": "git", - "npm_config_optional": "true", - "npm_config_json": "", - "INIT_CWD": "/home/ledda/Documents/Projects/soma", - "ROLLUP_WATCH": "true" - }, - "userLimits": { - "core_file_size_blocks": { - "soft": 0, - "hard": "unlimited" - }, - "data_seg_size_kbytes": { - "soft": "unlimited", - "hard": "unlimited" - }, - "file_size_blocks": { - "soft": "unlimited", - "hard": "unlimited" - }, - "max_locked_memory_bytes": { - "soft": 67108864, - "hard": 67108864 - }, - "max_memory_size_kbytes": { - "soft": "unlimited", - "hard": "unlimited" - }, - "open_files": { - "soft": 1048576, - "hard": 1048576 - }, - "stack_size_bytes": { - "soft": 8388608, - "hard": "unlimited" - }, - "cpu_time_seconds": { - "soft": "unlimited", - "hard": "unlimited" - }, - "max_user_processes": { - "soft": 47649, - "hard": 47649 - }, - "virtual_memory_kbytes": { - "soft": "unlimited", - "hard": "unlimited" - } - }, - "sharedObjects": [ - "linux-vdso.so.1", - "/lib/x86_64-linux-gnu/libdl.so.2", - "/usr/lib/x86_64-linux-gnu/libstdc++.so.6", - "/lib/x86_64-linux-gnu/libm.so.6", - "/lib/x86_64-linux-gnu/libgcc_s.so.1", - "/lib/x86_64-linux-gnu/libpthread.so.0", - "/lib/x86_64-linux-gnu/libc.so.6", - "/lib64/ld-linux-x86-64.so.2" - ] -} \ No newline at end of file diff --git a/src/App.svelte b/src/App.svelte index 4b85a7a..1852a6e 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -3,6 +3,15 @@ import SolutionInteractor from "./SolutionInteractor.svelte"; +
+
+ +
+
+ +
+
+ - -
-
- -
-
- -
-
diff --git a/src/CubeInput.svelte b/src/CubeInput.svelte index 43e8dd1..5f9e004 100644 --- a/src/CubeInput.svelte +++ b/src/CubeInput.svelte @@ -1,5 +1,5 @@
selectedCube.set(cubeNo)} + on:mousedown={onClickCube} >

Cube: {cubeNo + 1}

{#each {length: dimension} as _, x} @@ -92,8 +97,16 @@ font-size: 1em; text-align: center; } + .cube:hover:not(.active) { + transform: scale(1.03); + filter: brightness(1.1); + } .cube { - padding: 1em; + border-radius: 1em; + background-color: #666666; + cursor: pointer; + transition: transform 200ms; + padding: 1em 2em 1em 2em; user-select: none; } .cell { diff --git a/src/OBJLoader.js b/src/OBJLoader.js new file mode 100644 index 0000000..768a1ff --- /dev/null +++ b/src/OBJLoader.js @@ -0,0 +1,911 @@ +import { + BufferGeometry, + FileLoader, + Float32BufferAttribute, + Group, + LineBasicMaterial, + LineSegments, + Loader, + Material, + Mesh, + MeshPhongMaterial, + Points, + PointsMaterial, + Vector3 +} from 'three'; + +// o object_name | g group_name +const _object_pattern = /^[og]\s*(.+)?/; +// mtllib file_reference +const _material_library_pattern = /^mtllib /; +// usemtl material_name +const _material_use_pattern = /^usemtl /; +// usemap map_name +const _map_use_pattern = /^usemap /; + +const _vA = new Vector3(); +const _vB = new Vector3(); +const _vC = new Vector3(); + +const _ab = new Vector3(); +const _cb = new Vector3(); + +function ParserState() { + + const state = { + objects: [], + object: {}, + + vertices: [], + normals: [], + colors: [], + uvs: [], + + materials: {}, + materialLibraries: [], + + startObject: function ( name, fromDeclaration ) { + + // If the current object (initial from reset) is not from a g/o declaration in the parsed + // file. We need to use it for the first parsed g/o to keep things in sync. + if ( this.object && this.object.fromDeclaration === false ) { + + this.object.name = name; + this.object.fromDeclaration = ( fromDeclaration !== false ); + return; + + } + + const previousMaterial = ( this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined ); + + if ( this.object && typeof this.object._finalize === 'function' ) { + + this.object._finalize( true ); + + } + + this.object = { + name: name || '', + fromDeclaration: ( fromDeclaration !== false ), + + geometry: { + vertices: [], + normals: [], + colors: [], + uvs: [], + hasUVIndices: false + }, + materials: [], + smooth: true, + + startMaterial: function ( name, libraries ) { + + const previous = this._finalize( false ); + + // New usemtl declaration overwrites an inherited material, except if faces were declared + // after the material, then it must be preserved for proper MultiMaterial continuation. + if ( previous && ( previous.inherited || previous.groupCount <= 0 ) ) { + + this.materials.splice( previous.index, 1 ); + + } + + const material = { + index: this.materials.length, + name: name || '', + mtllib: ( Array.isArray( libraries ) && libraries.length > 0 ? libraries[ libraries.length - 1 ] : '' ), + smooth: ( previous !== undefined ? previous.smooth : this.smooth ), + groupStart: ( previous !== undefined ? previous.groupEnd : 0 ), + groupEnd: - 1, + groupCount: - 1, + inherited: false, + + clone: function ( index ) { + + const cloned = { + index: ( typeof index === 'number' ? index : this.index ), + name: this.name, + mtllib: this.mtllib, + smooth: this.smooth, + groupStart: 0, + groupEnd: - 1, + groupCount: - 1, + inherited: false + }; + cloned.clone = this.clone.bind( cloned ); + return cloned; + + } + }; + + this.materials.push( material ); + + return material; + + }, + + currentMaterial: function () { + + if ( this.materials.length > 0 ) { + + return this.materials[ this.materials.length - 1 ]; + + } + + return undefined; + + }, + + _finalize: function ( end ) { + + const lastMultiMaterial = this.currentMaterial(); + if ( lastMultiMaterial && lastMultiMaterial.groupEnd === - 1 ) { + + lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3; + lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart; + lastMultiMaterial.inherited = false; + + } + + // Ignore objects tail materials if no face declarations followed them before a new o/g started. + if ( end && this.materials.length > 1 ) { + + for ( let mi = this.materials.length - 1; mi >= 0; mi -- ) { + + if ( this.materials[ mi ].groupCount <= 0 ) { + + this.materials.splice( mi, 1 ); + + } + + } + + } + + // Guarantee at least one empty material, this makes the creation later more straight forward. + if ( end && this.materials.length === 0 ) { + + this.materials.push( { + name: '', + smooth: this.smooth + } ); + + } + + return lastMultiMaterial; + + } + }; + + // Inherit previous objects material. + // Spec tells us that a declared material must be set to all objects until a new material is declared. + // If a usemtl declaration is encountered while this new object is being parsed, it will + // overwrite the inherited material. Exception being that there was already face declarations + // to the inherited material, then it will be preserved for proper MultiMaterial continuation. + + if ( previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function' ) { + + const declared = previousMaterial.clone( 0 ); + declared.inherited = true; + this.object.materials.push( declared ); + + } + + this.objects.push( this.object ); + + }, + + finalize: function () { + + if ( this.object && typeof this.object._finalize === 'function' ) { + + this.object._finalize( true ); + + } + + }, + + parseVertexIndex: function ( value, len ) { + + const index = parseInt( value, 10 ); + return ( index >= 0 ? index - 1 : index + len / 3 ) * 3; + + }, + + parseNormalIndex: function ( value, len ) { + + const index = parseInt( value, 10 ); + return ( index >= 0 ? index - 1 : index + len / 3 ) * 3; + + }, + + parseUVIndex: function ( value, len ) { + + const index = parseInt( value, 10 ); + return ( index >= 0 ? index - 1 : index + len / 2 ) * 2; + + }, + + addVertex: function ( a, b, c ) { + + const src = this.vertices; + const dst = this.object.geometry.vertices; + + dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); + dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] ); + dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] ); + + }, + + addVertexPoint: function ( a ) { + + const src = this.vertices; + const dst = this.object.geometry.vertices; + + dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); + + }, + + addVertexLine: function ( a ) { + + const src = this.vertices; + const dst = this.object.geometry.vertices; + + dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); + + }, + + addNormal: function ( a, b, c ) { + + const src = this.normals; + const dst = this.object.geometry.normals; + + dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); + dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] ); + dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] ); + + }, + + addFaceNormal: function ( a, b, c ) { + + const src = this.vertices; + const dst = this.object.geometry.normals; + + _vA.fromArray( src, a ); + _vB.fromArray( src, b ); + _vC.fromArray( src, c ); + + _cb.subVectors( _vC, _vB ); + _ab.subVectors( _vA, _vB ); + _cb.cross( _ab ); + + _cb.normalize(); + + dst.push( _cb.x, _cb.y, _cb.z ); + dst.push( _cb.x, _cb.y, _cb.z ); + dst.push( _cb.x, _cb.y, _cb.z ); + + }, + + addColor: function ( a, b, c ) { + + const src = this.colors; + const dst = this.object.geometry.colors; + + if ( src[ a ] !== undefined ) dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); + if ( src[ b ] !== undefined ) dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] ); + if ( src[ c ] !== undefined ) dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] ); + + }, + + addUV: function ( a, b, c ) { + + const src = this.uvs; + const dst = this.object.geometry.uvs; + + dst.push( src[ a + 0 ], src[ a + 1 ] ); + dst.push( src[ b + 0 ], src[ b + 1 ] ); + dst.push( src[ c + 0 ], src[ c + 1 ] ); + + }, + + addDefaultUV: function () { + + const dst = this.object.geometry.uvs; + + dst.push( 0, 0 ); + dst.push( 0, 0 ); + dst.push( 0, 0 ); + + }, + + addUVLine: function ( a ) { + + const src = this.uvs; + const dst = this.object.geometry.uvs; + + dst.push( src[ a + 0 ], src[ a + 1 ] ); + + }, + + addFace: function ( a, b, c, ua, ub, uc, na, nb, nc ) { + + const vLen = this.vertices.length; + + let ia = this.parseVertexIndex( a, vLen ); + let ib = this.parseVertexIndex( b, vLen ); + let ic = this.parseVertexIndex( c, vLen ); + + this.addVertex( ia, ib, ic ); + this.addColor( ia, ib, ic ); + + // normals + + if ( na !== undefined && na !== '' ) { + + const nLen = this.normals.length; + + ia = this.parseNormalIndex( na, nLen ); + ib = this.parseNormalIndex( nb, nLen ); + ic = this.parseNormalIndex( nc, nLen ); + + this.addNormal( ia, ib, ic ); + + } else { + + this.addFaceNormal( ia, ib, ic ); + + } + + // uvs + + if ( ua !== undefined && ua !== '' ) { + + const uvLen = this.uvs.length; + + ia = this.parseUVIndex( ua, uvLen ); + ib = this.parseUVIndex( ub, uvLen ); + ic = this.parseUVIndex( uc, uvLen ); + + this.addUV( ia, ib, ic ); + + this.object.geometry.hasUVIndices = true; + + } else { + + // add placeholder values (for inconsistent face definitions) + + this.addDefaultUV(); + + } + + }, + + addPointGeometry: function ( vertices ) { + + this.object.geometry.type = 'Points'; + + const vLen = this.vertices.length; + + for ( let vi = 0, l = vertices.length; vi < l; vi ++ ) { + + const index = this.parseVertexIndex( vertices[ vi ], vLen ); + + this.addVertexPoint( index ); + this.addColor( index ); + + } + + }, + + addLineGeometry: function ( vertices, uvs ) { + + this.object.geometry.type = 'Line'; + + const vLen = this.vertices.length; + const uvLen = this.uvs.length; + + for ( let vi = 0, l = vertices.length; vi < l; vi ++ ) { + + this.addVertexLine( this.parseVertexIndex( vertices[ vi ], vLen ) ); + + } + + for ( let uvi = 0, l = uvs.length; uvi < l; uvi ++ ) { + + this.addUVLine( this.parseUVIndex( uvs[ uvi ], uvLen ) ); + + } + + } + + }; + + state.startObject( '', false ); + + return state; + +} + +// + +class OBJLoader extends Loader { + + constructor( manager ) { + + super( manager ); + + this.materials = null; + + } + + load( url, onLoad, onProgress, onError ) { + + const scope = this; + + const loader = new FileLoader( this.manager ); + loader.setPath( this.path ); + loader.setRequestHeader( this.requestHeader ); + loader.setWithCredentials( this.withCredentials ); + loader.load( url, function ( text ) { + + try { + + onLoad( scope.parse( text ) ); + + } catch ( e ) { + + if ( onError ) { + + onError( e ); + + } else { + + console.error( e ); + + } + + scope.manager.itemError( url ); + + } + + }, onProgress, onError ); + + } + + setMaterials( materials ) { + + this.materials = materials; + + return this; + + } + + parse( text ) { + + const state = new ParserState(); + + if ( text.indexOf( '\r\n' ) !== - 1 ) { + + // This is faster than String.split with regex that splits on both + text = text.replace( /\r\n/g, '\n' ); + + } + + if ( text.indexOf( '\\\n' ) !== - 1 ) { + + // join lines separated by a line continuation character (\) + text = text.replace( /\\\n/g, '' ); + + } + + const lines = text.split( '\n' ); + let line = '', lineFirstChar = ''; + let lineLength = 0; + let result = []; + + // Faster to just trim left side of the line. Use if available. + const trimLeft = ( typeof ''.trimLeft === 'function' ); + + for ( let i = 0, l = lines.length; i < l; i ++ ) { + + line = lines[ i ]; + + line = trimLeft ? line.trimLeft() : line.trim(); + + lineLength = line.length; + + if ( lineLength === 0 ) continue; + + lineFirstChar = line.charAt( 0 ); + + // @todo invoke passed in handler if any + if ( lineFirstChar === '#' ) continue; + + if ( lineFirstChar === 'v' ) { + + const data = line.split( /\s+/ ); + + switch ( data[ 0 ] ) { + + case 'v': + state.vertices.push( + parseFloat( data[ 1 ] ), + parseFloat( data[ 2 ] ), + parseFloat( data[ 3 ] ) + ); + if ( data.length >= 7 ) { + + state.colors.push( + parseFloat( data[ 4 ] ), + parseFloat( data[ 5 ] ), + parseFloat( data[ 6 ] ) + + ); + + } else { + + // if no colors are defined, add placeholders so color and vertex indices match + + state.colors.push( undefined, undefined, undefined ); + + } + + break; + case 'vn': + state.normals.push( + parseFloat( data[ 1 ] ), + parseFloat( data[ 2 ] ), + parseFloat( data[ 3 ] ) + ); + break; + case 'vt': + state.uvs.push( + parseFloat( data[ 1 ] ), + parseFloat( data[ 2 ] ) + ); + break; + + } + + } else if ( lineFirstChar === 'f' ) { + + const lineData = line.substr( 1 ).trim(); + const vertexData = lineData.split( /\s+/ ); + const faceVertices = []; + + // Parse the face vertex data into an easy to work with format + + for ( let j = 0, jl = vertexData.length; j < jl; j ++ ) { + + const vertex = vertexData[ j ]; + + if ( vertex.length > 0 ) { + + const vertexParts = vertex.split( '/' ); + faceVertices.push( vertexParts ); + + } + + } + + // Draw an edge between the first vertex and all subsequent vertices to form an n-gon + + const v1 = faceVertices[ 0 ]; + + for ( let j = 1, jl = faceVertices.length - 1; j < jl; j ++ ) { + + const v2 = faceVertices[ j ]; + const v3 = faceVertices[ j + 1 ]; + + state.addFace( + v1[ 0 ], v2[ 0 ], v3[ 0 ], + v1[ 1 ], v2[ 1 ], v3[ 1 ], + v1[ 2 ], v2[ 2 ], v3[ 2 ] + ); + + } + + } else if ( lineFirstChar === 'l' ) { + + const lineParts = line.substring( 1 ).trim().split( ' ' ); + let lineVertices = []; + const lineUVs = []; + + if ( line.indexOf( '/' ) === - 1 ) { + + lineVertices = lineParts; + + } else { + + for ( let li = 0, llen = lineParts.length; li < llen; li ++ ) { + + const parts = lineParts[ li ].split( '/' ); + + if ( parts[ 0 ] !== '' ) lineVertices.push( parts[ 0 ] ); + if ( parts[ 1 ] !== '' ) lineUVs.push( parts[ 1 ] ); + + } + + } + + state.addLineGeometry( lineVertices, lineUVs ); + + } else if ( lineFirstChar === 'p' ) { + + const lineData = line.substr( 1 ).trim(); + const pointData = lineData.split( ' ' ); + + state.addPointGeometry( pointData ); + + } else if ( ( result = _object_pattern.exec( line ) ) !== null ) { + + // o object_name + // or + // g group_name + + // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869 + // let name = result[ 0 ].substr( 1 ).trim(); + const name = ( ' ' + result[ 0 ].substr( 1 ).trim() ).substr( 1 ); + + state.startObject( name ); + + } else if ( _material_use_pattern.test( line ) ) { + + // material + + state.object.startMaterial( line.substring( 7 ).trim(), state.materialLibraries ); + + } else if ( _material_library_pattern.test( line ) ) { + + // mtl file + + state.materialLibraries.push( line.substring( 7 ).trim() ); + + } else if ( _map_use_pattern.test( line ) ) { + + // the line is parsed but ignored since the loader assumes textures are defined MTL files + // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method) + + console.warn( 'THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.' ); + + } else if ( lineFirstChar === 's' ) { + + result = line.split( ' ' ); + + // smooth shading + + // @todo Handle files that have varying smooth values for a set of faces inside one geometry, + // but does not define a usemtl for each face set. + // This should be detected and a dummy material created (later MultiMaterial and geometry groups). + // This requires some care to not create extra material on each smooth value for "normal" obj files. + // where explicit usemtl defines geometry groups. + // Example asset: examples/models/obj/cerberus/Cerberus.obj + + /* + * http://paulbourke.net/dataformats/obj/ + * or + * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf + * + * From chapter "Grouping" Syntax explanation "s group_number": + * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off. + * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form + * surfaces, smoothing groups are either turned on or off; there is no difference between values greater + * than 0." + */ + if ( result.length > 1 ) { + + const value = result[ 1 ].trim().toLowerCase(); + state.object.smooth = ( value !== '0' && value !== 'off' ); + + } else { + + // ZBrush can produce "s" lines #11707 + state.object.smooth = true; + + } + + const material = state.object.currentMaterial(); + if ( material ) material.smooth = state.object.smooth; + + } else { + + // Handle null terminated files without exception + if ( line === '\0' ) continue; + + console.warn( 'THREE.OBJLoader: Unexpected line: "' + line + '"' ); + + } + + } + + state.finalize(); + + const container = new Group(); + container.materialLibraries = [].concat( state.materialLibraries ); + + const hasPrimitives = ! ( state.objects.length === 1 && state.objects[ 0 ].geometry.vertices.length === 0 ); + + if ( hasPrimitives === true ) { + + for ( let i = 0, l = state.objects.length; i < l; i ++ ) { + + const object = state.objects[ i ]; + const geometry = object.geometry; + const materials = object.materials; + const isLine = ( geometry.type === 'Line' ); + const isPoints = ( geometry.type === 'Points' ); + let hasVertexColors = false; + + // Skip o/g line declarations that did not follow with any faces + if ( geometry.vertices.length === 0 ) continue; + + const buffergeometry = new BufferGeometry(); + + buffergeometry.setAttribute( 'position', new Float32BufferAttribute( geometry.vertices, 3 ) ); + + if ( geometry.normals.length > 0 ) { + + buffergeometry.setAttribute( 'normal', new Float32BufferAttribute( geometry.normals, 3 ) ); + + } + + if ( geometry.colors.length > 0 ) { + + hasVertexColors = true; + buffergeometry.setAttribute( 'color', new Float32BufferAttribute( geometry.colors, 3 ) ); + + } + + if ( geometry.hasUVIndices === true ) { + + buffergeometry.setAttribute( 'uv', new Float32BufferAttribute( geometry.uvs, 2 ) ); + + } + + // Create materials + + const createdMaterials = []; + + for ( let mi = 0, miLen = materials.length; mi < miLen; mi ++ ) { + + const sourceMaterial = materials[ mi ]; + const materialHash = sourceMaterial.name + '_' + sourceMaterial.smooth + '_' + hasVertexColors; + let material = state.materials[ materialHash ]; + + if ( this.materials !== null ) { + + material = this.materials.create( sourceMaterial.name ); + + // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material. + if ( isLine && material && ! ( material instanceof LineBasicMaterial ) ) { + + const materialLine = new LineBasicMaterial(); + Material.prototype.copy.call( materialLine, material ); + materialLine.color.copy( material.color ); + material = materialLine; + + } else if ( isPoints && material && ! ( material instanceof PointsMaterial ) ) { + + const materialPoints = new PointsMaterial( { size: 10, sizeAttenuation: false } ); + Material.prototype.copy.call( materialPoints, material ); + materialPoints.color.copy( material.color ); + materialPoints.map = material.map; + material = materialPoints; + + } + + } + + if ( material === undefined ) { + + if ( isLine ) { + + material = new LineBasicMaterial(); + + } else if ( isPoints ) { + + material = new PointsMaterial( { size: 1, sizeAttenuation: false } ); + + } else { + + material = new MeshPhongMaterial(); + + } + + material.name = sourceMaterial.name; + material.flatShading = sourceMaterial.smooth ? false : true; + material.vertexColors = hasVertexColors; + + state.materials[ materialHash ] = material; + + } + + createdMaterials.push( material ); + + } + + // Create mesh + + let mesh; + + if ( createdMaterials.length > 1 ) { + + for ( let mi = 0, miLen = materials.length; mi < miLen; mi ++ ) { + + const sourceMaterial = materials[ mi ]; + buffergeometry.addGroup( sourceMaterial.groupStart, sourceMaterial.groupCount, mi ); + + } + + if ( isLine ) { + + mesh = new LineSegments( buffergeometry, createdMaterials ); + + } else if ( isPoints ) { + + mesh = new Points( buffergeometry, createdMaterials ); + + } else { + + mesh = new Mesh( buffergeometry, createdMaterials ); + + } + + } else { + + if ( isLine ) { + + mesh = new LineSegments( buffergeometry, createdMaterials[ 0 ] ); + + } else if ( isPoints ) { + + mesh = new Points( buffergeometry, createdMaterials[ 0 ] ); + + } else { + + mesh = new Mesh( buffergeometry, createdMaterials[ 0 ] ); + + } + + } + + mesh.name = object.name; + + container.add( mesh ); + + } + + } else { + + // if there is only the default parser state object with no geometry data, interpret data as point cloud + + if ( state.vertices.length > 0 ) { + + const material = new PointsMaterial( { size: 1, sizeAttenuation: false } ); + + const buffergeometry = new BufferGeometry(); + + buffergeometry.setAttribute( 'position', new Float32BufferAttribute( state.vertices, 3 ) ); + + if ( state.colors.length > 0 && state.colors[ 0 ] !== undefined ) { + + buffergeometry.setAttribute( 'color', new Float32BufferAttribute( state.colors, 3 ) ); + material.vertexColors = true; + + } + + const points = new Points( buffergeometry, material ); + container.add( points ); + + } + + } + + return container; + + } + +} + +export { OBJLoader }; diff --git a/src/OrbitControls.js b/src/OrbitControls.js deleted file mode 100644 index 5c4f668..0000000 --- a/src/OrbitControls.js +++ /dev/null @@ -1,795 +0,0 @@ -import { - EventDispatcher, - MOUSE, - Quaternion, - Spherical, - TOUCH, - Vector2, - Vector3 -} from 'three'; - -// This set of controls performs orbiting, dollying (zooming), and panning. -// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default). -// -// Orbit - left mouse / touch: one-finger move -// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish -// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move - -const _changeEvent = { type: 'change' }; -const _startEvent = { type: 'start' }; -const _endEvent = { type: 'end' }; - -class OrbitControls extends EventDispatcher { - constructor( object, domElement ) { - super(); - if ( domElement === undefined ) console.warn( 'THREE.OrbitControls: The second parameter "domElement" is now mandatory.' ); - if ( domElement === document ) console.error( 'THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.' ); - this.object = object; - this.domElement = domElement; - - // Set to false to disable this control - this.enabled = true; - - // "target" sets the location of focus, where the object orbits around - this.target = new Vector3(); - - // How far you can dolly in and out ( PerspectiveCamera only ) - this.minDistance = 0; - this.maxDistance = Infinity; - - // How far you can zoom in and out ( OrthographicCamera only ) - this.minZoom = 0; - this.maxZoom = Infinity; - - // How far you can orbit vertically, upper and lower limits. - // Range is 0 to Math.PI radians. - this.minPolarAngle = 0; // radians - this.maxPolarAngle = Math.PI; // radians - - // How far you can orbit horizontally, upper and lower limits. - // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ) - this.minAzimuthAngle = - Infinity; // radians - this.maxAzimuthAngle = Infinity; // radians - - // Set to true to enable damping (inertia) - // If damping is enabled, you must call controls.update() in your animation loop - this.enableDamping = false; - this.dampingFactor = 0.05; - - // This option actually enables dollying in and out; left as "zoom" for backwards compatibility. - // Set to false to disable zooming - this.enableZoom = true; - this.zoomSpeed = 1.0; - - // Set to false to disable rotating - this.enableRotate = true; - this.rotateSpeed = 1.0; - - // Set to false to disable panning - this.enablePan = true; - this.panSpeed = 1.0; - this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up - this.keyPanSpeed = 7.0; // pixels moved per arrow key push - - // Set to true to automatically rotate around the target - // If auto-rotate is enabled, you must call controls.update() in your animation loop - this.autoRotate = false; - this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60 - - // The four arrow keys - this.keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' }; - - // Mouse buttons - this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN }; - - // Touch fingers - this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }; - - // for reset - this.target0 = this.target.clone(); - this.position0 = this.object.position.clone(); - this.zoom0 = this.object.zoom; - - // the target DOM element for key events - this._domElementKeyEvents = null; - - // - // public methods - // - - this.getPolarAngle = function () { - return spherical.phi; - }; - - this.getAzimuthalAngle = function () { - return spherical.theta; - }; - - this.listenToKeyEvents = function ( domElement ) { - domElement.addEventListener( 'keydown', onKeyDown ); - this._domElementKeyEvents = domElement; - }; - - this.saveState = function () { - scope.target0.copy( scope.target ); - scope.position0.copy( scope.object.position ); - scope.zoom0 = scope.object.zoom; - }; - - this.reset = function () { - scope.target.copy( scope.target0 ); - scope.object.position.copy( scope.position0 ); - scope.object.zoom = scope.zoom0; - scope.object.updateProjectionMatrix(); - scope.dispatchEvent( _changeEvent ); - scope.update(); - state = STATE.NONE; - }; - - // this method is exposed, but perhaps it would be better if we can make it private... - this.update = function () { - const offset = new Vector3(); - // so camera.up is the orbit axis - const quat = new Quaternion().setFromUnitVectors( object.up, new Vector3( 0, 1, 0 ) ); - const quatInverse = quat.clone().invert(); - const lastPosition = new Vector3(); - const lastQuaternion = new Quaternion(); - const twoPI = 2 * Math.PI; - return function update() { - const position = scope.object.position; - offset.copy( position ).sub( scope.target ); - // rotate offset to "y-axis-is-up" space - offset.applyQuaternion( quat ); - // angle from z-axis around y-axis - spherical.setFromVector3( offset ); - if ( scope.autoRotate && state === STATE.NONE ) { - rotateLeft( getAutoRotationAngle() ); - } - if ( scope.enableDamping ) { - spherical.theta += sphericalDelta.theta * scope.dampingFactor; - spherical.phi += sphericalDelta.phi * scope.dampingFactor; - } else { - spherical.theta += sphericalDelta.theta; - spherical.phi += sphericalDelta.phi; - } - - // restrict theta to be between desired limits - let min = scope.minAzimuthAngle; - let max = scope.maxAzimuthAngle; - if ( isFinite( min ) && isFinite( max ) ) { - if ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI; - if ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI; - if ( min <= max ) { - spherical.theta = Math.max( min, Math.min( max, spherical.theta ) ); - } else { - spherical.theta = ( spherical.theta > ( min + max ) / 2 ) ? - Math.max( min, spherical.theta ) : - Math.min( max, spherical.theta ); - } - } - - // restrict phi to be between desired limits - spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) ); - spherical.makeSafe(); - spherical.radius *= scale; - - // restrict radius to be between desired limits - spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) ); - - // move target to panned location - if ( scope.enableDamping === true ) { - scope.target.addScaledVector( panOffset, scope.dampingFactor ); - } else { - scope.target.add( panOffset ); - } - offset.setFromSpherical( spherical ); - // rotate offset back to "camera-up-vector-is-up" space - offset.applyQuaternion( quatInverse ); - position.copy( scope.target ).add( offset ); - scope.object.lookAt( scope.target ); - if ( scope.enableDamping === true ) { - sphericalDelta.theta *= ( 1 - scope.dampingFactor ); - sphericalDelta.phi *= ( 1 - scope.dampingFactor ); - panOffset.multiplyScalar( 1 - scope.dampingFactor ); - } else { - sphericalDelta.set( 0, 0, 0 ); - panOffset.set( 0, 0, 0 ); - } - scale = 1; - - // update condition is: - // min(camera displacement, camera rotation in radians)^2 > EPS - // using small-angle approximation cos(x/2) = 1 - x^2 / 8 - - if ( zoomChanged || - lastPosition.distanceToSquared( scope.object.position ) > EPS || - 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) { - scope.dispatchEvent( _changeEvent ); - lastPosition.copy( scope.object.position ); - lastQuaternion.copy( scope.object.quaternion ); - zoomChanged = false; - return true; - } - return false; - }; - }(); - - this.dispose = function () { - scope.domElement.removeEventListener( 'contextmenu', onContextMenu ); - scope.domElement.removeEventListener( 'pointerdown', onPointerDown ); - scope.domElement.removeEventListener( 'wheel', onMouseWheel ); - scope.domElement.removeEventListener( 'touchstart', onTouchStart ); - scope.domElement.removeEventListener( 'touchend', onTouchEnd ); - scope.domElement.removeEventListener( 'touchmove', onTouchMove ); - scope.domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove ); - scope.domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp ); - if ( scope._domElementKeyEvents !== null ) { - scope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown ); - } - //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here? - }; - - // - // internals - // - - const scope = this; - - const STATE = { - NONE: - 1, - ROTATE: 0, - DOLLY: 1, - PAN: 2, - TOUCH_ROTATE: 3, - TOUCH_PAN: 4, - TOUCH_DOLLY_PAN: 5, - TOUCH_DOLLY_ROTATE: 6 - }; - - let state = STATE.NONE; - - const EPS = 0.000001; - - // current position in spherical coordinates - const spherical = new Spherical(); - const sphericalDelta = new Spherical(); - - let scale = 1; - const panOffset = new Vector3(); - let zoomChanged = false; - - const rotateStart = new Vector2(); - const rotateEnd = new Vector2(); - const rotateDelta = new Vector2(); - - const panStart = new Vector2(); - const panEnd = new Vector2(); - const panDelta = new Vector2(); - - const dollyStart = new Vector2(); - const dollyEnd = new Vector2(); - const dollyDelta = new Vector2(); - - function getAutoRotationAngle() { - return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed; - } - - function getZoomScale() { - return Math.pow( 0.95, scope.zoomSpeed ); - } - - function rotateLeft( angle ) { - sphericalDelta.theta -= angle; - } - - function rotateUp( angle ) { - sphericalDelta.phi -= angle; - } - - const panLeft = function () { - const v = new Vector3(); - return function panLeft( distance, objectMatrix ) { - v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix - v.multiplyScalar( - distance ); - panOffset.add( v ); - }; - }(); - - const panUp = function () { - const v = new Vector3(); - return function panUp( distance, objectMatrix ) { - if ( scope.screenSpacePanning === true ) { - v.setFromMatrixColumn( objectMatrix, 1 ); - } else { - v.setFromMatrixColumn( objectMatrix, 0 ); - v.crossVectors( scope.object.up, v ); - } - v.multiplyScalar( distance ); - panOffset.add( v ); - }; - }(); - - // deltaX and deltaY are in pixels; right and down are positive - const pan = function () { - const offset = new Vector3(); - return function pan( deltaX, deltaY ) { - const element = scope.domElement; - if ( scope.object.isPerspectiveCamera ) { - // perspective - const position = scope.object.position; - offset.copy( position ).sub( scope.target ); - let targetDistance = offset.length(); - // half of the fov is center to top of screen - targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 ); - // we use only clientHeight here so aspect ratio does not distort speed - panLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix ); - panUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix ); - } else if ( scope.object.isOrthographicCamera ) { - // orthographic - panLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix ); - panUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix ); - } else { - // camera neither orthographic nor perspective - console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' ); - scope.enablePan = false; - } - }; - }(); - - function dollyOut( dollyScale ) { - if ( scope.object.isPerspectiveCamera ) { - scale /= dollyScale; - } else if ( scope.object.isOrthographicCamera ) { - scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) ); - scope.object.updateProjectionMatrix(); - zoomChanged = true; - } else { - console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); - scope.enableZoom = false; - } - - } - - function dollyIn( dollyScale ) { - if ( scope.object.isPerspectiveCamera ) { - scale *= dollyScale; - } else if ( scope.object.isOrthographicCamera ) { - scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) ); - scope.object.updateProjectionMatrix(); - zoomChanged = true; - } else { - console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); - scope.enableZoom = false; - } - - } - - // - // event callbacks - update the object state - // - function handleMouseDownRotate( event ) { - rotateStart.set( event.clientX, event.clientY ); - } - - function handleMouseDownDolly( event ) { - dollyStart.set( event.clientX, event.clientY ); - } - - function handleMouseDownPan( event ) { - panStart.set( event.clientX, event.clientY ); - } - - function handleMouseMoveRotate( event ) { - rotateEnd.set( event.clientX, event.clientY ); - rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed ); - const element = scope.domElement; - rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height - rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight ); - rotateStart.copy( rotateEnd ); - scope.update(); - } - - function handleMouseMoveDolly( event ) { - dollyEnd.set( event.clientX, event.clientY ); - dollyDelta.subVectors( dollyEnd, dollyStart ); - if ( dollyDelta.y > 0 ) { - dollyOut( getZoomScale() ); - } else if ( dollyDelta.y < 0 ) { - dollyIn( getZoomScale() ); - } - dollyStart.copy( dollyEnd ); - scope.update(); - } - - function handleMouseMovePan( event ) { - panEnd.set( event.clientX, event.clientY ); - panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed ); - pan( panDelta.x, panDelta.y ); - panStart.copy( panEnd ); - scope.update(); - } - - function handleMouseUp( /*event*/ ) { - // no-op - } - - function handleMouseWheel( event ) { - if ( event.deltaY < 0 ) { - dollyIn( getZoomScale() ); - } else if ( event.deltaY > 0 ) { - dollyOut( getZoomScale() ); - } - scope.update(); - } - - function handleKeyDown( event ) { - let needsUpdate = false; - switch ( event.code ) { - case scope.keys.UP: - pan( 0, scope.keyPanSpeed ); - needsUpdate = true; - break; - case scope.keys.BOTTOM: - pan( 0, - scope.keyPanSpeed ); - needsUpdate = true; - break; - case scope.keys.LEFT: - pan( scope.keyPanSpeed, 0 ); - needsUpdate = true; - break; - case scope.keys.RIGHT: - pan( - scope.keyPanSpeed, 0 ); - needsUpdate = true; - break; - } - if ( needsUpdate ) { - // prevent the browser from scrolling on cursor keys - event.preventDefault(); - scope.update(); - } - } - - function handleTouchStartRotate( event ) { - if ( event.touches.length == 1 ) { - rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); - } else { - const x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ); - const y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ); - rotateStart.set( x, y ); - } - - } - - function handleTouchStartPan( event ) { - if ( event.touches.length == 1 ) { - panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); - } else { - const x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ); - const y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ); - panStart.set( x, y ); - } - - } - - function handleTouchStartDolly( event ) { - const dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; - const dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; - const distance = Math.sqrt( dx * dx + dy * dy ); - dollyStart.set( 0, distance ); - } - - function handleTouchStartDollyPan( event ) { - if ( scope.enableZoom ) handleTouchStartDolly( event ); - if ( scope.enablePan ) handleTouchStartPan( event ); - } - - function handleTouchStartDollyRotate( event ) { - if ( scope.enableZoom ) handleTouchStartDolly( event ); - if ( scope.enableRotate ) handleTouchStartRotate( event ); - } - - function handleTouchMoveRotate( event ) { - if ( event.touches.length == 1 ) { - rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); - } else { - const x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ); - const y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ); - rotateEnd.set( x, y ); - } - rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed ); - const element = scope.domElement; - rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height - rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight ); - rotateStart.copy( rotateEnd ); - } - - function handleTouchMovePan( event ) { - if ( event.touches.length == 1 ) { - panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY ); - } else { - const x = 0.5 * ( event.touches[ 0 ].pageX + event.touches[ 1 ].pageX ); - const y = 0.5 * ( event.touches[ 0 ].pageY + event.touches[ 1 ].pageY ); - panEnd.set( x, y ); - } - panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed ); - pan( panDelta.x, panDelta.y ); - panStart.copy( panEnd ); - } - - function handleTouchMoveDolly( event ) { - const dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX; - const dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY; - const distance = Math.sqrt( dx * dx + dy * dy ); - dollyEnd.set( 0, distance ); - dollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) ); - dollyOut( dollyDelta.y ); - dollyStart.copy( dollyEnd ); - } - - function handleTouchMoveDollyPan( event ) { - if ( scope.enableZoom ) handleTouchMoveDolly( event ); - if ( scope.enablePan ) handleTouchMovePan( event ); - } - - function handleTouchMoveDollyRotate( event ) { - if ( scope.enableZoom ) handleTouchMoveDolly( event ); - if ( scope.enableRotate ) handleTouchMoveRotate( event ); - } - - function handleTouchEnd( /*event*/ ) { - // no-op - } - - // - // event handlers - FSM: listen for events and reset state - // - - function onPointerDown( event ) { - if ( scope.enabled === false ) return; - switch ( event.pointerType ) { - case 'mouse': - case 'pen': - onMouseDown( event ); - break; - // TODO touch - } - } - - function onPointerMove( event ) { - if ( scope.enabled === false ) return; - switch ( event.pointerType ) { - case 'mouse': - case 'pen': - onMouseMove( event ); - break; - // TODO touch - } - - } - - function onPointerUp( event ) { - switch ( event.pointerType ) { - case 'mouse': - case 'pen': - onMouseUp( event ); - break; - // TODO touch - } - } - - function onMouseDown( event ) { - // Prevent the browser from scrolling. - event.preventDefault(); - // Manually set the focus since calling preventDefault above - // prevents the browser from setting it automatically. - scope.domElement.focus ? scope.domElement.focus() : window.focus(); - let mouseAction; - switch ( event.button ) { - case 0: - mouseAction = scope.mouseButtons.LEFT; - break; - case 1: - mouseAction = scope.mouseButtons.MIDDLE; - break; - case 2: - mouseAction = scope.mouseButtons.RIGHT; - break; - default: - mouseAction = - 1; - } - - switch ( mouseAction ) { - case MOUSE.DOLLY: - if ( scope.enableZoom === false ) return; - handleMouseDownDolly( event ); - state = STATE.DOLLY; - break; - case MOUSE.ROTATE: - if ( event.ctrlKey || event.metaKey || event.shiftKey ) { - if ( scope.enablePan === false ) return; - handleMouseDownPan( event ); - state = STATE.PAN; - } else { - if ( scope.enableRotate === false ) return; - handleMouseDownRotate( event ); - state = STATE.ROTATE; - } - break; - case MOUSE.PAN: - if ( event.ctrlKey || event.metaKey || event.shiftKey ) { - if ( scope.enableRotate === false ) return; - handleMouseDownRotate( event ); - state = STATE.ROTATE; - } else { - if ( scope.enablePan === false ) return; - handleMouseDownPan( event ); - state = STATE.PAN; - } - break; - default: - state = STATE.NONE; - } - - if ( state !== STATE.NONE ) { - scope.domElement.ownerDocument.addEventListener( 'pointermove', onPointerMove ); - scope.domElement.ownerDocument.addEventListener( 'pointerup', onPointerUp ); - scope.dispatchEvent( _startEvent ); - } - } - - function onMouseMove( event ) { - if ( scope.enabled === false ) return; - event.preventDefault(); - switch ( state ) { - case STATE.ROTATE: - if ( scope.enableRotate === false ) return; - handleMouseMoveRotate( event ); - break; - case STATE.DOLLY: - if ( scope.enableZoom === false ) return; - handleMouseMoveDolly( event ); - break; - case STATE.PAN: - if ( scope.enablePan === false ) return; - handleMouseMovePan( event ); - break; - } - } - - function onMouseUp( event ) { - scope.domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove ); - scope.domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp ); - if ( scope.enabled === false ) return; - handleMouseUp( event ); - scope.dispatchEvent( _endEvent ); - state = STATE.NONE; - } - - function onMouseWheel( event ) { - if ( scope.enabled === false || scope.enableZoom === false || ( state !== STATE.NONE && state !== STATE.ROTATE ) ) return; - event.preventDefault(); - scope.dispatchEvent( _startEvent ); - handleMouseWheel( event ); - scope.dispatchEvent( _endEvent ); - } - - function onKeyDown( event ) { - if ( scope.enabled === false || scope.enablePan === false ) return; - handleKeyDown( event ); - } - - function onTouchStart( event ) { - if ( scope.enabled === false ) return; - event.preventDefault(); // prevent scrolling - switch ( event.touches.length ) { - case 1: - switch ( scope.touches.ONE ) { - case TOUCH.ROTATE: - if ( scope.enableRotate === false ) return; - handleTouchStartRotate( event ); - state = STATE.TOUCH_ROTATE; - break; - case TOUCH.PAN: - if ( scope.enablePan === false ) return; - handleTouchStartPan( event ); - state = STATE.TOUCH_PAN; - break; - default: - state = STATE.NONE; - } - break; - case 2: - switch ( scope.touches.TWO ) { - case TOUCH.DOLLY_PAN: - if ( scope.enableZoom === false && scope.enablePan === false ) return; - handleTouchStartDollyPan( event ); - state = STATE.TOUCH_DOLLY_PAN; - break; - case TOUCH.DOLLY_ROTATE: - if ( scope.enableZoom === false && scope.enableRotate === false ) return; - handleTouchStartDollyRotate( event ); - state = STATE.TOUCH_DOLLY_ROTATE; - break; - default: - state = STATE.NONE; - } - break; - default: - state = STATE.NONE; - } - if ( state !== STATE.NONE ) { - scope.dispatchEvent( _startEvent ); - } - } - - function onTouchMove( event ) { - if ( scope.enabled === false ) return; - event.preventDefault(); // prevent scrolling - switch ( state ) { - case STATE.TOUCH_ROTATE: - if ( scope.enableRotate === false ) return; - handleTouchMoveRotate( event ); - scope.update(); - break; - case STATE.TOUCH_PAN: - if ( scope.enablePan === false ) return; - handleTouchMovePan( event ); - scope.update(); - break; - case STATE.TOUCH_DOLLY_PAN: - if ( scope.enableZoom === false && scope.enablePan === false ) return; - handleTouchMoveDollyPan( event ); - scope.update(); - break; - case STATE.TOUCH_DOLLY_ROTATE: - if ( scope.enableZoom === false && scope.enableRotate === false ) return; - handleTouchMoveDollyRotate( event ); - scope.update(); - break; - default: - state = STATE.NONE; - } - } - - function onTouchEnd( event ) { - if ( scope.enabled === false ) return; - handleTouchEnd( event ); - scope.dispatchEvent( _endEvent ); - state = STATE.NONE; - } - - function onContextMenu( event ) { - if ( scope.enabled === false ) return; - event.preventDefault(); - } - - scope.domElement.addEventListener( 'contextmenu', onContextMenu ); - scope.domElement.addEventListener( 'pointerdown', onPointerDown ); - scope.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } ); - scope.domElement.addEventListener( 'touchstart', onTouchStart, { passive: false } ); - scope.domElement.addEventListener( 'touchend', onTouchEnd ); - scope.domElement.addEventListener( 'touchmove', onTouchMove, { passive: false } ); - // force an update at start - this.update(); - } -} - - -// This set of controls performs orbiting, dollying (zooming), and panning. -// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default). -// This is very similar to OrbitControls, another set of touch behavior -// -// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate -// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish -// Pan - left mouse, or arrow keys / touch: one-finger move - -class MapControls extends OrbitControls { - constructor( object, domElement ) { - super( object, domElement ); - this.mouseButtons.LEFT = MOUSE.ROTATE; - this.mouseButtons.RIGHT = null; - this.mouseButtons.MIDDLE = null; - } -} - -export { OrbitControls, MapControls }; \ No newline at end of file diff --git a/src/Polycube3D.svelte b/src/Polycube3D.svelte index 2eda31a..35848c6 100644 --- a/src/Polycube3D.svelte +++ b/src/Polycube3D.svelte @@ -1,22 +1,39 @@ \ No newline at end of file +> + + \ No newline at end of file diff --git a/src/PolycubeScene.ts b/src/PolycubeScene.ts new file mode 100644 index 0000000..dc279ea --- /dev/null +++ b/src/PolycubeScene.ts @@ -0,0 +1,165 @@ +import * as THREE from 'three'; +import { OBJLoader } from './OBJLoader.js'; +import VoxelSpace from './solver/VoxelSpace'; +import type SomaSolution from "./solver/SomaSolution"; +import RotationControl from "./RotationControl"; + +export default class PolycubeScene { + private renderer: THREE.WebGLRenderer; + private camera: THREE.Camera; + private mainScene: THREE.Scene; + private polycubeMeshes: THREE.Mesh[] = []; + private controls: RotationControl; + private light: THREE.Light; + private lastDims: number = 0; + private lastColor: string = "#FF0000"; + private lastPolycube: bigint = 0n; + private cubeMaterial: THREE.MeshPhongMaterial; + private materials: Record = {}; + private cubeGeometry: THREE.BufferGeometry; + private cubeScene: THREE.Scene; + + constructor(el: HTMLCanvasElement, onReady: () => any, onError: (err: Error) => any) { + this.init(el).then(onReady).catch(onError); + } + + private async init(el: HTMLCanvasElement) { + this.renderer = new THREE.WebGLRenderer({canvas: el}); + this.setupCamera(el.clientWidth / el.clientHeight); + this.setupLight(); + try { + await this.createCubeGeometry(); + } catch (err) { + throw new Error(err); + } + this.createCubeMaterial("red"); + this.mainScene = new THREE.Scene(); + this.cubeScene = new THREE.Scene(); + this.mainScene.add(this.cubeScene, this.camera); + this.camera.add(this.light); + this.cubeScene.rotateX(Math.PI/4); + this.cubeScene.rotateY(Math.PI/4); + this.controls = new RotationControl(this.cubeScene, this.camera, el); + requestAnimationFrame((timestamp) => this.render(timestamp)); + } + + private setupCamera(aspect: number) { + const fov = 60; + const near = 0.1; + const far = 15; + this.camera = new THREE.PerspectiveCamera(fov, aspect, near, far); + this.camera.position.z = 6; + this.camera.lookAt(0, 0, 0); + } + + private setPolycube(polycube: bigint, dims: number, color: string) { + if (dims !== this.lastDims) { + this.updateCubesFromDims(dims); + } + + if (polycube !== this.lastPolycube) { + let i = 0; + const voxelSpace = new VoxelSpace(0, [dims, dims, dims], polycube, true); + const newDims = voxelSpace.getDims(); + this.polycubeMeshes.forEach(mesh => { + mesh.position.set(1000, 1000, 1000); + mesh.material = this.cubeMaterial; + }); + voxelSpace.forEachCell((val: boolean, x: number, y: number, z: number) => { + if (val) { + this.polycubeMeshes[i].position.set( + -((newDims[2] - 1)/2) + z, + ((newDims[0] - 1)/2) - x, + -((newDims[1] - 1)/2) + y, + ); + } + i++; + }); + this.lastPolycube = polycube; + } + + if (color !== this.lastColor) { + this.cubeMaterial.color.set(color); + this.lastColor = color; + } + } + + private updateCubesFromDims(newDims: number) { + const requiredCubes = newDims**3; + if (this.polycubeMeshes.length < requiredCubes) { + for (let i = this.polycubeMeshes.length; i < requiredCubes; i++) { + const newCube = new THREE.Mesh(this.cubeGeometry, this.cubeMaterial); + this.cubeScene.add(newCube); + this.polycubeMeshes.push(newCube); + } + } + if (newDims < this.lastDims || this.lastDims === 0) { + this.polycubeMeshes.forEach(mesh => mesh.position.set(1000, 1000, 1000)); + } + this.lastDims = newDims; + } + + private setSolution(solution: SomaSolution, colorMap: Record) { + const dims = solution.getDims(); + if (dims[0] !== this.lastDims) { + this.updateCubesFromDims(dims[0]); + } + + let i = 0; + this.polycubeMeshes.forEach(mesh => mesh.position.set(1000, 1000, 1000)); + Object.keys(colorMap).forEach(key => { + if (!this.materials[key]) { + this.materials[key] = this.newCubeMaterial(colorMap[key]); + } + }) + solution.forEachCell((val: number, x: number, y: number, z: number) => { + this.polycubeMeshes[i].position.set( + -((dims[2] - 1)/2) + z, + ((dims[0] - 1)/2) - x, + -((dims[1] - 1)/2) + y, + ); + this.polycubeMeshes[i].material = this.materials[val]; + i++; + }); + } + + private setupLight() { + const color = 0xFFFFFF; + const intensity = 1; + this.light = new THREE.DirectionalLight(color, intensity); + this.light.position.set(-1, 2, 4); + } + + private render(time: number) { + this.renderer.render(this.mainScene, this.camera); + requestAnimationFrame((time: number) => this.render(time)); + } + + private async createCubeGeometry(): Promise { + const onLoaded = (obj: THREE.Mesh, resolve: () => any) => { + this.cubeGeometry = (obj.children[0] as THREE.Mesh).geometry; + this.cubeGeometry.computeVertexNormals(); + this.cubeGeometry.computeBoundingSphere(); + this.cubeGeometry.scale(1/this.cubeGeometry.boundingSphere.radius, 1/this.cubeGeometry.boundingSphere.radius, 1/this.cubeGeometry.boundingSphere.radius); + resolve(); + }; + const load = (resolve: () => any, reject: (err: string) => any) => { + const loader = new OBJLoader(); + loader.load( + '../resources/bevel_cube.obj', + obj => onLoaded(obj, resolve), + () => {}, + (err) => reject(`Error loading OBJ file: ${err}`), + ); + }; + return new Promise(load); + } + + private newCubeMaterial(color: string) { + return new THREE.MeshPhongMaterial({color}); + } + + private createCubeMaterial(color: string) { + this.cubeMaterial = this.newCubeMaterial(color); + } +} diff --git a/src/RotationControl.ts b/src/RotationControl.ts new file mode 100644 index 0000000..b2d9343 --- /dev/null +++ b/src/RotationControl.ts @@ -0,0 +1,45 @@ +import type * as THREE from 'three'; + +export default class RotationControls { + private static ROTATION_FACTOR = 1/200; + private object: THREE.Object3D; + private element: HTMLCanvasElement; + private respondToMovement: boolean = false; + private lastX: number = 0; + private lastY: number = 0; + private yAxis: THREE.Vector3; + private xAxis: THREE.Vector3; + private start: THREE.Euler; + + constructor(object: THREE.Object3D, camera: THREE.Camera, element: HTMLCanvasElement) { + this.object = object; + this.element = element; + this.yAxis = object.worldToLocal(camera.up); + this.xAxis = object.position.sub(camera.position); + this.xAxis.divideScalar(Math.sqrt(this.xAxis.getComponent(0)**2 + this.xAxis.getComponent(1)**2 + this.xAxis.getComponent(2)**2)); + this.xAxis = this.xAxis.clone().cross(this.yAxis.clone()); + this.start = this.object.rotation.clone(); + + this.element.addEventListener('mousedown', (event) => { + if (event.button === 1) { + this.object.setRotationFromEuler(this.start); + } + if (!this.respondToMovement) { + this.lastX = event.x; + this.lastY = event.y; + this.respondToMovement = true; + } + }); + window.addEventListener('mousemove', (ev) => this.handleMove(ev)); + window.addEventListener('mouseup', () => this.respondToMovement = false); + } + + private handleMove(event: MouseEvent) { + if (this.respondToMovement) { + const xDiff = event.movementX * RotationControls.ROTATION_FACTOR; + const yDiff = event.movementY * RotationControls.ROTATION_FACTOR; + this.object.rotateOnAxis(this.yAxis, xDiff); + this.object.rotateOnWorldAxis(this.xAxis, yDiff); + } + } +} \ No newline at end of file diff --git a/src/Sidebar.svelte b/src/Sidebar.svelte index 3d64697..4dca502 100644 --- a/src/Sidebar.svelte +++ b/src/Sidebar.svelte @@ -1,10 +1,28 @@ @@ -25,8 +43,10 @@
- +
+ + \ No newline at end of file diff --git a/src/solver/SomaSolution.ts b/src/solver/SomaSolution.ts index f53edac..71f38aa 100644 --- a/src/solver/SomaSolution.ts +++ b/src/solver/SomaSolution.ts @@ -96,4 +96,18 @@ export default class SomaSolution { clone.solutionSpaces = this.solutionSpaces.slice(); return clone; } + + getDims() { + return [this.dim, this.dim, this.dim]; + } + + forEachCell(cb: (val: number, x: number, y: number, z: number) => any) { + loopStart: for (let x = 0; x < this.dim; x++) { + for (let y = 0; y < this.dim; y++) { + for (let z = 0; z < this.dim; z++) { + cb(this.at(x, y, z), x, y, z); + } + } + } + } } \ No newline at end of file diff --git a/src/solver/SomaSolver.ts b/src/solver/SomaSolver.ts index 953926d..3aa0fc8 100644 --- a/src/solver/SomaSolver.ts +++ b/src/solver/SomaSolver.ts @@ -14,7 +14,7 @@ export default class SomaSolver { this.solutionCube = new VoxelSpace(0, [dimension, dimension, dimension], Array(dimension**3).fill(0)); } - solve(polycubes: VoxelSpace[]) { + async solve(polycubes: VoxelSpace[]) { if (polycubes.length === 0) { throw new Error("You must pass at least one polycube to solve the puzzle."); } @@ -22,11 +22,15 @@ export default class SomaSolver { if (cumulativeSize !== this.dim**3) { throw new Error(`The polycubes passed do not add up to exactly enough units to form a cube of dimension ${this.dim}! Got: ${cumulativeSize}, need: ${this.dim**3}`); } - const combosWithRots = polycubes.slice(1).map(polycube => polycube.getUniqueRotations().map(rot => rot.getAllPositionsInCube(this.dim)).flat()); + this.solutions = []; + const combosWithRots = polycubes.slice(1).map(polycube => polycube.getUniqueRotations().map((rot: VoxelSpace) => rot.getAllPositionsInCube(this.dim)).flat()); const combos = [polycubes[0].getAllPositionsInCube(this.dim), ...combosWithRots]; this.backtrackSolve(this.solutionCube, combos, new SomaSolution(this.dim)); this.solutions = SomaSolution.filterUnique(this.solutions); - this.solutions.forEach(sol => sol.print()); + } + + getSolutions() { + return this.solutions.slice(); } private backtrackSolve(workingSolution: VoxelSpace, polycubes: VoxelSpace[][], currentSoln: SomaSolution, depth = 0) { diff --git a/src/solver/VoxelSpace.ts b/src/solver/VoxelSpace.ts index 5bf241b..8f78c9e 100644 --- a/src/solver/VoxelSpace.ts +++ b/src/solver/VoxelSpace.ts @@ -37,7 +37,7 @@ export default class VoxelSpace { return this.space.toString(2); } - private cullEmptySpace() { + getExtrema() { const extrema = { xMax: -Infinity, xMin: Infinity, @@ -46,7 +46,6 @@ export default class VoxelSpace { zMax: -Infinity, zMin: Infinity, }; - let newSpace = 0n; this.forEachCell((val, x, y, z) => { if (val) { extrema.xMax = Math.max(extrema.xMax, x); @@ -57,7 +56,13 @@ export default class VoxelSpace { extrema.zMin = Math.min(extrema.zMin, z); } }); + return extrema; + } + + private cullEmptySpace() { + const extrema = this.getExtrema(); let index = 0n; + let newSpace = 0n; for (let x = extrema.xMin; x <= extrema.xMax; x++) { for (let y = extrema.yMin; y <= extrema.yMax; y++) { for (let z = extrema.zMin; z <= extrema.zMax; z++) { diff --git a/src/solver/main.js b/src/solver/main.js deleted file mode 100644 index d6cacbb..0000000 --- a/src/solver/main.js +++ /dev/null @@ -1,10 +0,0 @@ -import App from './App.svelte'; - -const app = new App({ - target: document.body, - props: { - name: 'world' - } -}); - -export default app; \ No newline at end of file diff --git a/src/solver/main.ts b/src/solver/main.ts index 7fbe282..d7f0d73 100644 --- a/src/solver/main.ts +++ b/src/solver/main.ts @@ -1,109 +1,12 @@ import SomaSolver from "./SomaSolver"; import VoxelSpace from "./VoxelSpace"; -const tetromino1 = new VoxelSpace(1, [3, 3, 3], [ - true, true, true, - false, true, false, - false, false, false, +type SolveStartMessageData = {polycubes: bigint[], dims: number}; - false, false, false, - false, false, false, - false, false, false, +self.addEventListener('message', (event) => { + const {polycubes, dims} = event.data as SolveStartMessageData; + const solver = new SomaSolver(event.data.dims); + solver.solve(polycubes.map((cubeRep, i) => new VoxelSpace(i, [dims, dims, dims], cubeRep))); + (self as unknown as Worker).postMessage(solver.getSolutions()); +}); - false, false, false, - false, false, false, - false, false, false, -], true); - -const tetromino2 = new VoxelSpace(2, [3, 3, 3], [ - false, false, false, - false, false, false, - false, true, false, - - false, true, false, - false, true, false, - false, true, false, - - false, false, false, - false, false, false, - false, false, false, -], true); - -const tetromino3 = new VoxelSpace(3, [3, 3, 3], [ - true, false, false, - true, true, false, - false, true, false, - - false, false, false, - false, false, false, - false, false, false, - - false, false, false, - false, false, false, - false, false, false, -], true); - -const tetromino4 = new VoxelSpace(4, [3, 3, 3], [ - true, true, false, - false, false, false, - false, false, false, - - true, false, false, - true, false, false, - false, false, false, - - false, false, false, - false, false, false, - false, false, false, -], true); - -const tetromino5 = new VoxelSpace(5, [3, 3, 3], [ - true, true, false, - false, false, false, - false, false, false, - - false, true, false, - false, true, false, - false, false, false, - - false, false, false, - false, false, false, - false, false, false, -], true); - -const tetromino6 = new VoxelSpace(6, [3, 3, 3], [ - false, false, false, - false, false, false, - false, true, false, - - false, false, false, - false, true, false, - false, true, true, - - false, false, false, - false, false, false, - false, false, false, -], true); - -const triomino1 = new VoxelSpace(7, [3, 3, 3], [ - false, false, false, - false, false, false, - false, true, false, - - false, false, false, - false, true, false, - false, true, false, - - false, false, false, - false, false, false, - false, false, false, -], true); - - - -// const cube = new VoxelSpace([3, 3, 3], Array(3**3).fill(0)); -// cube.plus(triomino1)?.plus(tetromino2, {x: 1, y: 0, z: 1})?.print(); - -const solver = new SomaSolver(3); -console.log("solving"); -solver.solve([triomino1, tetromino2, tetromino3, tetromino1, tetromino4, tetromino5, tetromino6]); diff --git a/src/store.ts b/src/store.ts index ed7255f..d26ec26 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,5 +1,6 @@ import { derived, writable } from 'svelte/store'; import { get } from 'svelte/store'; +import type SomaSolution from "./solver/SomaSolution"; type PolycubeInput = { color: string, @@ -15,16 +16,21 @@ const store = { }; export const selectedCube = writable(0); -export const isMaxDimension = derived(store.somaDimension, $somaDimension => $somaDimension >= MAX_DIMS); -export const isMinDimension = derived(store.somaDimension, $somaDimension => $somaDimension <= MIN_DIMS); -export const isMaxPolycubes = derived([store.polycubes, store.somaDimension], ([$polycubes, $somaDimension]) => $polycubes.length >= $somaDimension ** 3); -export const isMinPolycubes = derived(store.polycubes, ($polycubes) => $polycubes.length <= 1); +export const isMaxDimension = derived(store.somaDimension, ($somaDimension: number) => $somaDimension >= MAX_DIMS); +export const isMinDimension = derived(store.somaDimension, ($somaDimension: number) => $somaDimension <= MIN_DIMS); +export const isMaxPolycubes = derived( + [store.polycubes, store.somaDimension], + ([$polycubes, $somaDimension]: [PolycubeInput[], number]) => $polycubes.length >= $somaDimension ** 3); +export const isMinPolycubes = derived(store.polycubes, ($polycubes: PolycubeInput[]) => $polycubes.length <= 1); +export const solutions = writable([] as SomaSolution[]); +export const activeSolution = writable(0); +export const showingSolution = writable(false); export const somaDimension = { subscribe: store.somaDimension.subscribe, inc() { if (!get(isMaxDimension)) { - store.somaDimension.update(dims => { + store.somaDimension.update((dims: number) => { polycubes.reset(dims + 1); return dims + 1; }); @@ -32,7 +38,7 @@ export const somaDimension = { }, dec() { if (!get(isMinDimension)) { - store.somaDimension.update(dims => { + store.somaDimension.update((dims: number) => { polycubes.reset(dims - 1); return dims - 1; }); @@ -45,7 +51,7 @@ export const polycubes = { addCube() { const isMaxPolycubes = get(store.polycubes).length >= get(store.somaDimension) ** 3; if (!isMaxPolycubes) { - store.polycubes.update(polycubes => polycubes.concat({ + store.polycubes.update((polycubes: PolycubeInput[]) => polycubes.concat({ rep: BigInt(0), color: colorFromIndex(polycubes.length), })); @@ -54,7 +60,11 @@ export const polycubes = { removeCube() { const isMinPolycubes = get(store.polycubes).length <= 1; if (!isMinPolycubes) { - store.polycubes.update(polycubes => polycubes.splice(0, polycubes.length - 1)); + store.polycubes.update((polycubes: PolycubeInput[]) => polycubes.splice(0, polycubes.length - 1)); + } + const newLength = get(store.polycubes).length; + if (newLength <= get(selectedCube)) { + selectedCube.set(newLength - 1); } }, toggle(cubeIndex: number, x: number, y: number, z: number) { @@ -76,7 +86,7 @@ export const polycubes = { store.polycubes.set(cubes); }, reset(dims: number) { - store.polycubes.update(polycubes => { + store.polycubes.update((polycubes: PolycubeInput[]) => { const result: PolycubeInput[] = []; for (let i = 0; i < Math.min(polycubes.length, dims**3); i++) { result.push({ diff --git a/src/threeTest.ts b/src/threeTest.ts deleted file mode 100644 index 0383207..0000000 --- a/src/threeTest.ts +++ /dev/null @@ -1,134 +0,0 @@ -import * as THREE from 'three'; -import { MapControls } from './OrbitControls.js'; -import VoxelSpace from './solver/VoxelSpace.js'; -import {somaDimension, polycubes} from './store'; -import {get} from 'svelte/store'; -import type { MeshPhongMaterial } from 'three'; - -export default class PolycubeScene { - private renderer: THREE.WebGLRenderer; - private camera: THREE.Camera; - private mainScene: THREE.Scene; - private polycubeMeshes: THREE.Mesh[] = []; - private controls: typeof MapControls; - private light: THREE.Light; - private cameraLightScene: THREE.Group; - private lastDims: number = 0; - private currentPolycubeId: number = 0; - private lastColor: string = "#FF0000"; - private lastPolycube: bigint = 0n; - - constructor(el: HTMLCanvasElement) { - this.renderer = new THREE.WebGLRenderer({canvas: el}); - const fov = 75; - const aspect = el.clientWidth / el.clientHeight; - const near = 0.1; - const far = 10; - this.camera = new THREE.PerspectiveCamera(fov, aspect, near, far); - this.camera.position.z = 5; - this.camera.lookAt(0, 0, 0); - this.mainScene = new THREE.Scene(); - this.light = this.setupLight(); - this.mainScene.add(this.light); - this.mainScene.rotateX(Math.PI/4); - this.mainScene.rotateY(Math.PI/4); - this.cameraLightScene = new THREE.Group(); - this.controls = new MapControls(this.camera, el); - requestAnimationFrame((timestamp) => this.render(timestamp)); - } - - private setPolycube(polycube: bigint, dims: number, color: string) { - if (dims !== this.lastDims) { - this.mainScene.remove(...this.polycubeMeshes); - this.polycubeMeshes = []; - this.polycubeMeshes = Array.from(Array(dims ** 3).keys()).map(() => { - const cube = this.newRoundedCube(0.2, 3, color); - cube.position.set(1000, 1000, 1000); - this.mainScene.add(cube); - return cube; - }); - this.lastDims = dims; - } - - if (polycube !== this.lastPolycube) { - let i = 0; - const voxelSpace = new VoxelSpace(0, [dims, dims, dims], polycube); - voxelSpace.forEachCell((val, x, y, z) => { - if (val) { - this.polycubeMeshes[i].position.set( - -((dims - 1)/2) + z, - ((dims - 1)/2) - y, - -((dims - 1)/2) + x, - ); - } else { - this.polycubeMeshes[i].position.set(1000, 1000, 1000); - } - i++; - }); - this.lastPolycube = polycube; - } - - if (color !== this.lastColor) { - this.polycubeMeshes.forEach(mesh => (mesh.material as MeshPhongMaterial).color.set(color)); - this.lastColor = color; - } - } - - private updateFromCurrentPolycube() { - const {color: cubeColor, rep: cubeRep} = get(polycubes)[this.currentPolycubeId]; - const dims = get(somaDimension); - const voxelSpace = new VoxelSpace(this.currentPolycubeId, [dims, dims, dims], cubeRep); - this.mainScene.remove(...this.polycubeMeshes); - voxelSpace.forEachCell((val, x, y, z) => { - if (val) { - const cube = this.newRoundedCube(0.2, 3, cubeColor); - cube.position.set( - -((dims - 1)/2) + z, - ((dims - 1)/2) - y, - -((dims - 1)/2) + x, - ); - this.mainScene.add(cube); - this.polycubeMeshes.push(cube); - } - }); - } - - private setupLight() { - const color = 0xFFFFFF; - const intensity = 1; - const light = new THREE.DirectionalLight(color, intensity); - light.position.set(-1, 2, 4); - return light; - } - - private render(time: number) { - this.renderer.render(this.mainScene, this.camera); - requestAnimationFrame((timestamp) => this.render(timestamp)); - } - - private newRoundedCube(radius: number, smoothness: number, color: string) { - const width = 1; - const height = 1; - const depth = 1; - const shape = new THREE.Shape(); - const eps = 0.00001; - const radius0 = radius - eps; - shape.absarc(eps, eps, eps, -Math.PI / 2, -Math.PI, true); - shape.absarc(eps, height - radius0 * 2, eps, Math.PI, Math.PI / 2, true); - shape.absarc(width - radius0 * 2, height - radius0 * 2, eps, Math.PI / 2, 0, true); - shape.absarc(width - radius0 * 2, eps, eps, 0, -Math.PI / 2, true ); - const geometry = new THREE.ExtrudeBufferGeometry(shape, { - depth: depth - radius0 * 2, - bevelEnabled: true, - bevelSegments: smoothness * 2, - steps: 1, - bevelSize: radius0, - bevelThickness: radius0, - curveSegments: smoothness - }); - geometry.center(); - const material = new THREE.MeshPhongMaterial({color}); - const cube = new THREE.Mesh(geometry, material); - return cube; - } -} diff --git a/tsconfig.json b/tsconfig.json index 29f6d75..24ad1b3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,9 @@ { "extends": "@tsconfig/svelte/tsconfig.json", "compilerOptions": { - "lib": ["es2020", "dom"], - "target": "ES2020" + "lib": ["dom", "ESNext"], + "target": "ESNext", }, - "include": ["src/**/*"], - "exclude": ["node_modules/*", "__sapper__/*", "public/*"] + "include": ["./src/**/*"], + "exclude": ["./node_modules/*", "./__sapper__/*", "./public/*"] } \ No newline at end of file