diff --git a/html/images/space.svg b/html/images/space.svg index 268b0b4..a17deb6 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -255,7 +255,7 @@ const Move = (() => { // const yba = subR(yb, ya); // // const det = subR(xba * yca, xca * yba); - console.log("dett", det, "edge", xa, ya, xb, yb, "position", xc, yc, "aaa"); + // console.log("dett", det, "edge", xa, ya, xb, yb, "position", xc, yc, "aaa"); // const detEx = (xb*expo - xa*expo) * (yc*expo - ya*expo) - (xc*expo - xa*expo) * (yb*expo - ya*expo); @@ -286,7 +286,7 @@ const Move = (() => { } function isAcute([xa, ya], [xb, yb], [xc, yc]) { - console.log("isAcute", xa, ya, xb, yb, xc, yc); + // console.log("isAcute", xa, ya, xb, yb, xc, yc); const da = distance(xa, ya, xc, yc); const db = distance(xb, yb, xc, yc); const dc = distance(xa, ya, xb, yb); @@ -318,13 +318,13 @@ const Move = (() => { // const alpha = Math.acos((db ** 2 + dc ** 2 - da ** 2) / (2 * db * dc)); // const beta = Math.acos((da ** 2 + dc ** 2 - db ** 2) / (2 * da * dc)); - console.log("2 * db * dc", denA, "dett"); - console.log("2 * da * dc", denB, "dett"); - console.log("db ** 2 + dc ** 2 - da ** 2", numAr, "dett"); - 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, "beta", beta, "da, db, dc", da, db, dc, "dett"); + // console.log("2 * db * dc", denA, "dett"); + // console.log("2 * da * dc", denB, "dett"); + // console.log("db ** 2 + dc ** 2 - da ** 2", numAr, "dett"); + // 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, "beta", beta, "da, db, dc", da, db, dc, "dett"); return alpha < halfPi && beta < halfPi; } @@ -420,8 +420,8 @@ const Move = (() => { const { xa: x3, ya: y3, xb: x4, yb: y4 } = edge; - console.log("x1", x1, "y1", y1, "x2", x2, "y2", y2); - console.log("x3", x3, "y3", y3, "x4", x4, "y4", y4); + // console.log("x1", x1, "y1", y1, "x2", x2, "y2", y2); + // console.log("x3", x3, "y3", y3, "x4", x4, "y4", y4); // https://en.wikipedia.org/wiki/Intersection_(geometry)#Two_line_segments // https://en.wikipedia.org/wiki/Cramer%27s_rule#Explicit_formulas_for_small_systems @@ -484,8 +484,8 @@ const Move = (() => { - console.log("s", s, "t", t); - console.log("sr", sr, "tr", tr); + // console.log("s", s, "t", t); + // console.log("sr", sr, "tr", tr); const x1r = Math.round(x1 * 100); const x2r = Math.round(x2 * 100); const y1r = Math.round(y1 * 100); @@ -513,11 +513,11 @@ const Move = (() => { const xs = x1 + s * (x2 - x1); const ys = y1 + s * (y2 - y1); - console.log("xs", xs, "ys", ys); + // 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("x1", x1, "x2", x2); - console.log("y1", y1, "y2", y2); + // console.log("x1", x1, "x2", x2); + // console.log("y1", y1, "y2", y2); const xsr = Math.round(x1r + sr * (x2r - x1r)) / 100; const ysr = Math.round(y1r + sr * (y2r - y1r)) / 100; @@ -526,7 +526,7 @@ const Move = (() => { const xtr = Math.round(x3r + tr * (x4r - x3r)) / 100; const ytr = Math.round(y3r + tr * (y4r - y3r)) / 100; - console.log("xsr", xsr, "ysr", ysr, " ::: xtr", xtr, "ytr", ytr); + // console.log("xsr", xsr, "ysr", ysr, " ::: xtr", xtr, "ytr", ytr); const lnD = distance(xtr, ytr, edge.xa, edge.ya); @@ -643,7 +643,7 @@ const Move = (() => { } function detectContacts(currentPos, intendedPos, velocity, radius, { edges, corners }, gearDown) { - console.log("current position passed to detectContacts", currentPos); + // console.log("current position passed to detectContacts", currentPos); const { x: xc, y: yc } = intendedPos; const [x, y] = currentPos; @@ -734,7 +734,7 @@ const Move = (() => { // y: vy > 0 && vy + ay <= 0 ? 0 : vy + ay // }; - console.log("v", v, "ax", ax, "ay", ay); + // console.log("v", v, "ax", ax, "ay", ay); // v.x = +v.x.toPrecision(13); // v.y = +v.y.toPrecision(13); @@ -752,7 +752,7 @@ const Move = (() => { // y: (py * exp + elapsed * 1000 * v.y / 1000) / exp }; - console.log("----------elapsed", elapsed) + // console.log("----------elapsed", elapsed) // 0.57 * 1000 * 20 / 1000 // p.x = +p.x.toPrecision(13); @@ -762,8 +762,8 @@ const Move = (() => { const contacts = detectContacts([px, py], p, v, s.radius, map, false); if (contacts.length !== 0) { - console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); - console.log("CONTACTS", contacts); + // console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + // console.log("CONTACTS", contacts); let posP; const contact = contacts[0]; @@ -807,9 +807,9 @@ const Move = (() => { }; // (-1.2*100 - -14.8*100)/100 - console.log("vDotn", vDotn); - console.log("denom", denom); - console.log("pVect", pVect); + // console.log("vDotn", vDotn); + // console.log("denom", denom); + // console.log("pVect", pVect); // const aVect = { // x: aDotn / denom * edgeNrmlVect.x, @@ -823,8 +823,8 @@ const Move = (() => { const prVonNx = Math.round(reverseP.x*100 + v.x*100)/100; const prVonNy = Math.round(reverseP.y*100 + v.y*100)/100; - console.log("intended velocity", v); - console.log("counter velocity", prVonNx, prVonNy); + // console.log("intended velocity", v); + // console.log("counter velocity", prVonNx, prVonNy); // drawLine(px, py, px + velocityVect.x, py + velocityVect.y, "blue"); // drawLine(px, py, px + edgeNrmlVect.x, py + edgeNrmlVect.y, "black"); @@ -832,16 +832,16 @@ const Move = (() => { // contact.velocity = { x: prVonNx, y: prVonNy }; Velocity[entity_id] = { x: prVonNx, y: prVonNy }; - console.log("v", v); - console.log("velocity", Velocity[entity_id]); + // console.log("v", v); + // console.log("velocity", Velocity[entity_id]); - console.log("current position", px, py); + // console.log("current position", px, py); drawCircle(px, py, "pink"); - console.log("contact.position", contact.position, "dett"); + // console.log("contact.position", contact.position, "dett"); drawCircle(contact.position.x, contact.position.y, "limegreen"); - console.log("intended next position", p); + // console.log("intended next position", p); drawCircle(p.x, p.y, "red"); // const newV = { @@ -855,13 +855,13 @@ const Move = (() => { x: Math.round((contact.position.x + elapsed * prVonNx * metersPerMillisecond) * 100) / 100, y: Math.round((contact.position.y + elapsed * prVonNy * metersPerMillisecond) * 100) / 100, }; - console.log("calculated next position", newP, "dett"); + // console.log("calculated next position", newP, "dett"); let isC = isClockwise([contact.edge.xa, contact.edge.ya], [contact.edge.xb, contact.edge.yb], [newP.x, newP.y]); - console.log("is calculated next position clockwise with current contact", isC, "aaa"); + // console.log("is calculated next position clockwise with current contact", isC, "aaa"); let isA = isAcute([contact.edge.xa, contact.edge.ya], [contact.edge.xb, contact.edge.yb], [newP.x, newP.y]); - console.log("is calculated next position acute with current contact", isA, "aaa"); + // console.log("is calculated next position acute with current contact", isA, "aaa"); - console.log("calculated next", newP, "aaa"); + // console.log("calculated next", newP, "aaa"); const edgeVect = { x: run, y: rise }; // const npVect = { x: newP.x - run, y: newP.y - rise }; @@ -894,7 +894,7 @@ const Move = (() => { x: 2*d - newP.x, y: 2*d*m - newP.y + 2*c }; - console.log("reflection before rounding", refP, "aaa"); + // console.log("reflection before rounding", refP, "aaa"); // refP.x = Math.round(refP.x * 100) / 100; // refP.y = Math.round(refP.y * 100) / 100; @@ -905,16 +905,16 @@ 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"); + // console.log("is reflected position clockwise with current contact", isC, "aaa"); isA = isAcute([contact.edge.xa, contact.edge.ya], [contact.edge.xb, contact.edge.yb], [refP.x, refP.y]); - console.log("is reflected position acute with current contact", isA, "aaa"); + // console.log("is reflected position acute with current contact", isA, "aaa"); // how close can you come to an edge without being on it? const inWall = contact.wall.node.isPointInFill(newP); - console.log("is our calculated next position inside current edge's wall?", inWall, "dett"); + // console.log("is our calculated next position inside current edge's wall?", inWall, "dett"); // if an edge passes through a point, is that point in the wall's fill? yes // so touching a wall is technically being in its fill @@ -1289,7 +1289,7 @@ function fireBullet(position, degrees) { } const endTime = performance.now() - console.log(`Took ${endTime - startTime} milliseconds`) + // console.log(`Took ${endTime - startTime} milliseconds`) // const screenCTM = svg.getScreenCTM(); // const startTime = performance.now() @@ -1731,7 +1731,7 @@ function firstFrame(timestamp) { } function animate(timestamp) { - console.log("----------animate timestamp", timestamp, "previous", previous); + // console.log("----------animate timestamp", timestamp, "previous", previous); // 2064.26 * 1000 - 2036.26 * 1000 // 28000.000000000233