From 66a044cd2ab4c34c1e9c5d0bd5ec9e86e9da2b96 Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Wed, 4 Feb 2026 12:34:35 -0800 Subject: [PATCH] Remove commented-out console messages search and replace with Vim command `:%s/\n.*\/\/ console.log.*//` --- html/images/space.svg | 67 ------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/html/images/space.svg b/html/images/space.svg index 3ae1d77..268b0b4 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -242,7 +242,6 @@ const Move = (() => { // Triangle has a clockwise orientation function isClockwise([xa, ya], [xb, yb], [xc, yc]) { - // console.log("isClockwise", xa, ya, xb, yb, xc, yc); // https://en.wikipedia.org/wiki/Curve_orientation#Practical_considerations // Determinant for a convex polygon @@ -258,13 +257,7 @@ const Move = (() => { // const det = subR(xba * yca, xca * yba); console.log("dett", det, "edge", xa, ya, xb, yb, "position", xc, yc, "aaa"); - // console.log("xa, ya, xb, yb, xc, yc", xa, ya, xb, yb, xc, yc); // const detEx = (xb*expo - xa*expo) * (yc*expo - ya*expo) - (xc*expo - xa*expo) * (yb*expo - ya*expo); - // console.log("=----", xb*expo - xa*expo, yc*expo - ya*expo, xc*expo - xa*expo, yb*expo - ya*expo); - // console.log("=----", xb*expo, xa*expo, yc*expo, ya*expo, xc*expo, xa*expo, yb*expo, ya*expo); - // console.log("=----", xb*expo - xa*expo, yc*expo - ya*expo, xc*expo - xa*expo, yb*expo - ya*expo); - // console.log("=----", (xb*expo - xa*expo) * (yc*expo - ya*expo), (xc*expo - xa*expo) * (yb*expo - ya*expo)); - // console.log("detxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", detEx * 1e-16); // (8.0046e+33) / 1e30 // -> 8004.599999999999 @@ -288,8 +281,6 @@ const Move = (() => { // -57399999999.99999 - // console.log(xb, xa, yc, ya, xc, xa, yb, ya); - // console.log("dettttttttttttttttttttt", det); // if det == 0, that means we are in contact with that edge return det < 0; } @@ -333,7 +324,6 @@ const Move = (() => { console.log("da ** 2 + dc ** 2 - db ** 2", numBr, "dett"); console.log("(db ** 2 + dc ** 2 - da ** 2) / (2 * db * dc)", thetaA, "dett"); console.log("(da ** 2 + dc ** 2 - db ** 2) / (2 * da * dc)", thetaB, "dett"); - // console.log("alpha", +alpha.toFixed(15), "beta", +beta.toFixed(15), "da, db, dc", da, db, dc, "dett"); console.log("alpha", alpha, "beta", beta, "da, db, dc", da, db, dc, "dett"); return alpha < halfPi && beta < halfPi; @@ -417,7 +407,6 @@ const Move = (() => { } function detectEdgeCollision([xc, yc], [x, y], radius, gearDown) { - // console.log("*detectEdgeCollision", xc, yc, x, y, radius, gearDown); return (collision) => { if (xc === x && yc === y) return; @@ -438,9 +427,7 @@ const Move = (() => { // https://en.wikipedia.org/wiki/Cramer%27s_rule#Explicit_formulas_for_small_systems // const denom = (x2-x1)*(y4-y3)-(x4-x3)*(y2-y1); - // console.log("x2", x2, "x1", x1, "y4", y4, "y3", y3, "x4", x4, "x3", x3, "y2", y2, "y1", y1); - // console.log("denom", denom); // const x21 = +(x2-x1).toPrecision(13); // const y43 = +(y4-y3).toPrecision(13); // const x43 = +(x4-x3).toPrecision(13); @@ -467,8 +454,6 @@ const Move = (() => { const denom = x21*y43-x43*y21; const denomr = Math.round(x21r*100*y43r-x43r*y21r*100) / 100; - // console.log("denom", denom); - // console.log("denomr", denomr, x21r, y43r, x43r, y21r); const x31 = x3-x1; const x31r = subR(x3, x1); @@ -476,9 +461,7 @@ const Move = (() => { const y31 = y3-y1; const y31r = subR(y3, y1); - // console.log("x2", x2, " - ", "x1", x1, "=", x2-x1); - // console.log(x21, y43, x43, y21, denom, x31, y31); // if (denom) { @@ -499,15 +482,8 @@ const Move = (() => { // const tr = (-(x21r*y31r*100*100-x31r*y21r*100*100) / denomr)/10000; const tr = -Math.round((x21r*y31r-x31r*y21r) / denomr * 100) / 100; - // console.log(x21r, y31r, x31r, y21r, denomr); - // console.log("checking edge for collision", edge); - // console.log("position edge segs", positionSeg, edgeSeg); - // console.log("s", s, "t", t); - // console.log("testing edge", edge); - // console.log("position seg", positionSeg); - // console.log("s", s, "roundedS", roundedS, "t", t, "roundedT", roundedT); console.log("s", s, "t", t); console.log("sr", sr, "tr", tr); const x1r = Math.round(x1 * 100); @@ -540,7 +516,6 @@ const Move = (() => { console.log("xs", xs, "ys", ys); // Math.round(Math.round(-2.03 * 100) + 0.45000000000000445 * (Math.round(-1.95 * 100) - Math.round(-2.03 * 100))) / 100 - // console.log("xs", xs, "ys", ys); console.log("x1", x1, "x2", x2); console.log("y1", y1, "y2", y2); @@ -569,15 +544,11 @@ const Move = (() => { // collision.position = { x: xtr, y: ytr }; // collision.position = lnP; - // console.log("xs, yx", xs, ys); - // console.log("xc, yc", xc, yc); // collision.position = { x: xs, y: ys }; // collision.position = { x: +xs.toFixed(15), y: +ys.toFixed(15) }; - // console.log("BLSAEKJSDFGLSKDJF"); // collision.position = { x: xc, y: yc }; - // console.log("position calculate by detectEdgeCollision", xs, ys); return true; } @@ -678,9 +649,7 @@ const Move = (() => { // edges oriented clockwise with entity const fwdEdges = getForwardEdges(edges, { x, y }); - // console.log("forward edges", fwdEdges); const edgeColl = fwdEdges.filter(detectEdgeCollision([xc, yc], [x, y], radius, gearDown)); - // console.log("edgeColl", edgeColl); // corners ahead of ship const fwdCorners = getForwardCorners(corners, { x, y }, velocity); @@ -749,10 +718,6 @@ const Move = (() => { const { x: vx, y: vy } = Velocity[entity_id]; const { x: ax, y: ay } = Acceleration[entity_id]; - // console.log("elapsed", elapsed); - // console.log("px", px, "py", py); - // console.log("vx", vx, "vy", vy); - // console.log("ax", ax, "ay", ay); const vr = { x: Math.round(vx * 100 + ax * 100) / 100, @@ -774,7 +739,6 @@ const Move = (() => { // v.x = +v.x.toPrecision(13); // v.y = +v.y.toPrecision(13); - // console.log("future v", v); const exp = 1e4 @@ -789,16 +753,11 @@ const Move = (() => { }; console.log("----------elapsed", elapsed) - // console.log("velocity", v); - // console.log("current position", px, py); - // console.log("future position", p); - // console.log("px + elapsed * 1000 * v.x / 1000", px + elapsed * 1000 * v.x / 1000 / 1000); // 0.57 * 1000 * 20 / 1000 // p.x = +p.x.toPrecision(13); // p.y = +p.y.toPrecision(13); - // console.log("future p", p); const contacts = detectContacts([px, py], p, v, s.radius, map, false); @@ -813,20 +772,16 @@ const Move = (() => { contact.position.x = +contact.position.x.toPrecision(13); contact.position.y = +contact.position.y.toPrecision(13); - // console.log("contact position", contact.position); // drawLine(contact.position.x, contact.position.y, contact.position.x + vx, contact.position.y + vy, "blue"); const contactV = { x: contact.position.y - contact.corner.y, y: contact.position.x - contact.corner.x }; - // console.log("contactV", contactV); const normalVect = { x: contact.position.x - contact.corner.x, y: contact.position.y - contact.corner.y }; - // console.log("normal vector", normalVect); // drawLine(contact.corner.x, contact.corner.y, contact.corner.x + normalVect.x, contact.corner.y + normalVect.y, "black"); const tangentVect = { x: normalVect.y, y: -normalVect.x }; // drawLine(contact.position.x, contact.position.y, contact.position.x + tangentVect.x, contact.position.y + tangentVect.y, "green"); contact.velocity = bounceVector(v, tangentVect.x, tangentVect.y); - // console.log("tangent vector", tangentVect); // drawLine(contact.position.x, contact.position.y, contact.position.x + contact.velocity.x, contact.position.y + contact.velocity.y, "blue"); @@ -871,10 +826,6 @@ const Move = (() => { console.log("intended velocity", v); console.log("counter velocity", prVonNx, prVonNy); - // console.log("velocity vector", velocityVect); - // console.log("normal vector", edgeNrmlVect); - // console.log("V dot N", vDotn); - // console.log("prVonNx, prVonNy", prVonNx, prVonNy) // drawLine(px, py, px + velocityVect.x, py + velocityVect.y, "blue"); // drawLine(px, py, px + edgeNrmlVect.x, py + edgeNrmlVect.y, "black"); // drawLine(contact.position.x, contact.position.y, contact.position.x + prVonNx, contact.position.y + prVonNy, "teal"); @@ -954,7 +905,6 @@ const Move = (() => { // if (!isC && isA) newP = refP; if (!isC && isA) newP = projNpOntoEdge; - // console.log("reflection", refP, projNpOntoEdge, "aaa"); console.log("reflection", refP, projNpOntoEdge, "aaa"); isC = isClockwise([contact.edge.xa, contact.edge.ya], [contact.edge.xb, contact.edge.yb], [refP.x, refP.y]); console.log("is reflected position clockwise with current contact", isC, "aaa"); @@ -985,9 +935,7 @@ const Move = (() => { // const p_new = lnIntxnFromTwoPts(contact.edge, { xa: newP.x, ya: newP.y, xb: newP.x + rise, yb: newP.y - run }); // newP = lnIntxnFromTwoPts(contact.edge, { xa: newP.x, ya: newP.y, xb: newP.x + rise, yb: newP.y - run }); - // console.log("intersection point with edge", newP, "dett"); // const isCw = isClockwise([contact.edge.xa, contact.edge.ya], [contact.edge.xb, contact.edge.yb], [newP.x, newP.y]); - // console.log("is intersection point clockwise?", isCw, "dett"); // const lnD = distance(contact.position.x, contact.position.y, newP.x, newP.y); const lnD = distance(contact.edge.xa, contact.edge.ya, newP.x, newP.y); @@ -1001,9 +949,7 @@ const Move = (() => { // newP = ln.getPointAtLength(lnD); // container.appendChild(el); - // console.log("POINT ON EDGE LINE LENGTH", lnD); - // console.log("calculated next position along edge line", newP); drawCircle(newP.x, newP.y, "black"); Position[entity_id] = newP; @@ -1309,13 +1255,9 @@ function fireBullet(position, degrees) { const callback = (mutationList, observer) => { for (const mutation of mutationList) { if (mutation.type === "childList") { - // console.log("A child node has been added or removed."); - // console.log('added nodes', mutation.addedNodes); - // console.log('children', bulletsContainer.children.length); // [...mutation.addedNodes].forEach(b => b.classList.add('fade')); // mutation.addedNodes.forEach(bullet => bullet.classList.add('fade')); } else if (mutation.type === "attributes") { - // console.log(`The ${mutation.attributeName} attribute was modified.`); } } }; @@ -1363,7 +1305,6 @@ function fireBullet(position, degrees) { // } // // const endTime = performance.now() - // console.log(`Took ${endTime - startTime} milliseconds`) if (hit) { lineEl.setAttribute('x2', pt.x); @@ -1428,7 +1369,6 @@ function slope({ xa, ya, xb, yb }) { } function isLandable(edge) { - // console.log("edge", edge, "slope", slope(edge)); return edge.xa < edge.xb && edge.ya === edge.yb; // return Object.is(slope(edge), +0); } @@ -1445,7 +1385,6 @@ function getEdgeCollisionBoundary(edge, dist) { } function detectEdgeCollision([xc, yc], [x, y], radius, gearDown) { - // console.log("detectEdgeCollision", xc, yc, x, y, radius, gearDown); return (collision) => { if (xc === x && yc === y) return; @@ -1690,7 +1629,6 @@ function updateShip(s, elapsed) { legs.style.display = s.gearDown ? "initial" : "none"; if (s.collision) { - // console.log("111111111111111111111111111"); let posP; if (s.collision.corner) { posP = cornerContactPosition(p.x, p.y, px, py, s.collision.corner, s.radius); @@ -1706,7 +1644,6 @@ function updateShip(s, elapsed) { // s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`; // } else if (current && s.collision) { - // console.log("2222222222222222222222222222222"); // if (s.isLanded && s.velocity.y < 0) { // s.gearDown = false; @@ -1718,7 +1655,6 @@ function updateShip(s, elapsed) { // s.velocity = { x: 0, y: 0 }; // } } else { - // console.log("33333333333333333333333333333"); s.position = { x: p.x, y: p.y }; // s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`; } @@ -1763,13 +1699,11 @@ function updateLines(elapsed, walls, position, velocity) { const el = g.querySelector('line') || document.createElementNS(namespaceURIsvg, 'line'); const star = g.querySelector('circle') || document.createElementNS(namespaceURIsvg, 'circle'); star.setAttribute('r', 1); - // console.log(position, velocity, xa, ya, xb, yb); const baseSlope = slope({ xa, ya, xb, yb }); let isx, isy; - // console.log("BASESLOPE", baseSlope); if (baseSlope === -Infinity || baseSlope === Infinity) { isx = xa; @@ -1779,7 +1713,6 @@ function updateLines(elapsed, walls, position, velocity) { isy = ya; } else { // const clPt = collisionPosition({ xa, ya, xb, yb }, position, velocity); - // console.log(clPt); // isx = clPt.x; // isy = clPt.y; star.setAttribute('cx', 0);