aboutsummaryrefslogtreecommitdiffstats
path: root/site
diff options
context:
space:
mode:
authorbrian cully <bjc@spork.org>2025-12-27 12:58:44 -0500
committerbrian cully <bjc@spork.org>2025-12-27 12:58:44 -0500
commit69591cc5483d36bc819c75dce9347b08b04e33bf (patch)
tree93d0f158621c6caea2f54e449a942f45ec829395 /site
parent0eaa19448a85473e85d4679faa4ab30108dbf4b5 (diff)
downloadpolyring-69591cc5483d36bc819c75dce9347b08b04e33bf.tar.gz
polyring-69591cc5483d36bc819c75dce9347b08b04e33bf.zip
add rust/wasm impl
Diffstat (limited to 'site')
-rw-r--r--site/index.html3
-rw-r--r--site/pure.mjs (renamed from site/main.mjs)3
-rw-r--r--site/wasm.mjs7
3 files changed, 11 insertions, 2 deletions
diff --git a/site/index.html b/site/index.html
index 012e301..bdb2f5d 100644
--- a/site/index.html
+++ b/site/index.html
@@ -16,7 +16,8 @@
<br>
<canvas width='500' height='500'></canvas>
- <script src='./main.mjs' type='module'></script>
+ <!-- <script src='./pure.mjs' type='module'></script> -->
+ <script src='./wasm.mjs' type='module'></script>
<footer>
<address><a href='https://git.spork.org/polyring.git'>src</a></address>
diff --git a/site/main.mjs b/site/pure.mjs
index dc67d73..43f7213 100644
--- a/site/main.mjs
+++ b/site/pure.mjs
@@ -112,7 +112,7 @@ function findPoly3(points) {
let res = [points[0]];
do {
// last result is always a point on the edge.
- const p1 = res[res.length-1];
+ // const p1 = res[res.length-1];
// console.debug(`-- checking lines from ${p1}`);
let last = res[res.length-1];
let minTheta = TAU;
@@ -233,6 +233,7 @@ async function loaded() {
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
+
renderPoints(ctx, points);
if (bouncePoints(points)) {
//goButton.onclick({ target: goButton });
diff --git a/site/wasm.mjs b/site/wasm.mjs
new file mode 100644
index 0000000..29a2741
--- /dev/null
+++ b/site/wasm.mjs
@@ -0,0 +1,7 @@
+import init from './wasm/polyring.js';
+
+async function loaded() {
+ await init();
+}
+
+document.addEventListener('DOMContentLoaded', loaded);