From c3bd622841c58b774fb08181c487b195d3de722b Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Thu, 18 Dec 2025 14:45:45 -0800 Subject: [PATCH] Find determinant --- html/images/space.svg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/html/images/space.svg b/html/images/space.svg index 8bfe212..8777ad1 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -149,9 +149,14 @@ triangles.forEach(triangle => { const attr = triangle.getAttribute('points').split(delim) + const [[xa, ya], [xb, yb], [xc, yc]] = attr.map(t => t.split(',').map(n => +n)); + const det = (xb - xa) * (yc - ya) - (xc - xa) * (yb - ya); attr.pop(); attr.push(`${positionX},${positionY}`); triangle.setAttribute('points', attr.join(delim)); + triangle.style.fill = det < 0 ? "white" : "none"; + triangle.style.stroke = det < 0 ? "red" : "none"; + // i think i can also discard obtuse triangles? }); }