Advent-of-Code-2023/day24/notes.org

1.5 KiB

Notes

i want help from math

https://math.stackexchange.com/questions/28503/how-to-find-intersection-of-two-lines-in-3d

'vector parametric form' is exactly what we're getting in the input?

huh and only 'looking forward in time' so solutions with negative t are not important.

cooool

i see that speeds are integers, so updated points are integers.

maybe i do calculation of every line on every time point?

and if i do that is there a way to get intersections efficietly?

i'll also need the ends for lines? ends to the line segments.

with limits on the x & y by the task

for example both 7 <= <= 27 for input 200000000000000 <= <= 400000000000000

also. can't we move the coords? maybe not? maybe only for one so, what do i do? to get the ends of the lines? i try to calcluate with both x & y in 2 minmax. then if the other is ok, than that's the ends? wait, what happens when i do x = 7, and x = 27 and y is outside? it means no intesections, i guess or it could be outside from different sides, so not all x are ok, but there's still line there

Using homogeneous coordinates

https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection no, i don't understant that

https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line

with 2 points. i guess but also - check if the point in future of the hail, by comparing with speeds? should be easy

and i got wrong result

day24 result: 8406

another formula gives

day24 result: 8406

another formula

12938