diff --git a/html/images/space.svg b/html/images/space.svg index d90cba9..22767be 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -699,26 +699,13 @@ } function cornerContactPosition(xc, yc, x, y, corner, cLength) { - const diffx = xc - x; - const diffy = yc - y; - // console.log("xc", xc, "yc", yc, "x", x, "y", y); const positionSeg = { xa: xc, ya: yc, xb: x, yb: y }; const posNormIntxn = perpIntxn(slope(positionSeg), x, y, corner.x, corner.y); - const posSegLength = Math.sqrt(diffy ** 2 + diffx ** 2); - const detp = xc * y - yc * x; - // console.log("detp", detp, "posSegLength", posSegLength); - - // the length of the "corner segment" + // shortest distance between corner and path const aLength = distance(corner.x, corner.y, posNormIntxn.x, posNormIntxn.y); - // where did I get this calculation? it also works but how?? - // const aLengthAlso = Math.abs(diffy * corner.x - diffx * corner.y + detp) / posSegLength; - - // console.log("aLength", aLength, "aLengthAlso", aLengthAlso); - - // drawLine(posNormIntxn.x, posNormIntxn.y, corner.x, corner.y, "red"); + // distance from position/normal intersection const bLength = Math.sqrt(Math.abs(cLength ** 2 - aLength ** 2)); - // console.log("bLength", bLength); const intxnSeg = document.createElementNS(namespaceURIsvg, 'line'); intxnSeg.setAttribute('x1', posNormIntxn.x); @@ -897,10 +884,10 @@ started = false; const mult = 10000; - s.position = { x: 2, y: 7 }; - // s.velocity = { x: 4.5, y: 5 }; + s.position = { x: 0, y: 0 }; + s.velocity = { x: 0, y: 0 }; - s. velocity = { x: 2*mult, y: 7*mult }; + // s. velocity = { x: 2*mult, y: 7*mult }; s.acceleration = { x: 0, y: 0 }; s.rotate = 0;