From 790c2679576874183fa40a35fe97ffd20426beff Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Sun, 28 Dec 2025 11:38:14 -0800 Subject: [PATCH] WIP: found collision position --- html/images/space.svg | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/html/images/space.svg b/html/images/space.svg index 4e7c6c5..fdf2297 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -88,6 +88,8 @@ #lines circle { fill: purple; + opacity: 0.2; + r: 5px; } @@ -758,7 +760,7 @@ const baseVelIntxn = lineIntxnPt(baseLine, velocityLine); const baseSegLength = distance(baseNrmlIntxn.x, baseNrmlIntxn.y , baseVelIntxn.x, baseVelIntxn.y); const normalSegLength = distance(baseNrmlIntxn.x, baseNrmlIntxn.y, s.position.x, s.position.y); - console.log("distance", distance(baseNrmlIntxn.x, baseNrmlIntxn.y , baseVelIntxn.x, baseVelIntxn.y)); + console.log("distance", baseSegLength); const theta = Math.atan(normalSegLength / baseSegLength); console.log("theta", theta); // const contactPos = { x: Math.acos() } @@ -786,6 +788,19 @@ g.appendChild(el); g.appendChild(star); linesContainer.appendChild(g); + + const cl = document.createElementNS(namespaceURIsvg, 'line'); + cl.setAttribute('x1', baseVelIntxn.x); + cl.setAttribute('y1', baseVelIntxn.y); + cl.setAttribute('x2', s.position.x); + cl.setAttribute('y2', s.position.y); + const clPt = cl.getPointAtLength(h); + console.log(clPt); + + star.setAttribute('cx', clPt.x); + star.setAttribute('cy', clPt.y); + + return g; }); }