79833715

Date: 2025-11-30 06:12:51
Score: 2
Natty:
Report link

@ReX357 Thank you for the information, and that's perfectly okay about the linear algebra - it's quick to pick up. For my approach to work, you will need to know basic row reduction, and what a vector equation of a line is.

Essentially, to find the intersection of two line segments L1:{(a,b),(c,d)}, and L2:{(e,f),(g,h)}, you first turn them into their corresponding vectors: V1:{(a,b),(c-a,d-a)}, V2:{(e,f),(g-e,h-f)}. Then you set V1=V2, and use Gauss-Jordan elimination (row reduction) to find the coordinates of their intersection (IN THE AFFINE BASIS!). By affine basis, I mean that the second component is added to the first to obtain the new point - it's a bit technical.

If all these coordinates are between zero and one, then you can apply one of them to the equation of one line, and (bam!) you've got your intersection.

Repeat this process for every pair for a working solution. Of course, this is probably speed-up-able too.

Would you like a basic version in Python or Lua? (I'm rusty with Python, so Lua is easier, but I can swing both ways.)

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @ReX357
  • Low reputation (0.5):
Posted by: Jasper