Thanks for that! I don’t really need help with that at the moment, I’m planning on using this to find the intersection point of two lines and then just extending but there’s a bit more math I need help with near the end of this reply which I’ll add on in a bit.
So first thing is finding which of the pairs of parts are facing each other. Each wall part’s LookVector would be like so:
Obviously we aren’t working with rays but I don’t really know how else to describe it.
So if we test yellow and green’s position, treat the black line like a wall, which would behave similarly to a ray’s origin, the LookVector starts at the yellow part’s position and can never “move” in the -LookVector direction.
If we test green and pink part using this same method, they never intersect which means they might get an extension but we don’t know for sure.
Finally, if we test the blue and yellow parts, they do face each other because they intersect from the black line onwards which means they are not the pair of walls to be “extended”, so we know it’s the opposite of these two parts that we need to extend.
To expand on this, if we have an obtuse angle like so:
the blue and yellow parts still intersect at some point, so we don’t extend them; they’re still technically “facing” each other, it’s the opposite of these parts that need to be extended:
These points never intersect beyond the black line; they’re facing “away” from each other
And finally, parallel walls will never get an extension.
Other question
Okay, here’s the sort of off-topic part:
So say we have two walls that are acute angles and we manage to figure out that the pink and green ones get the extension, the issue is that the intersection point method will cause the two parts to be extended like so:
Is there a way to sort of “limit” the parts’ sizes when the innermost vertex of each the green and pink parts intersect each other, sort of like where the black and white lines are to act as the “end” of each part?