day24: adding python z3, example
This commit is contained in:
@@ -20,16 +20,86 @@ so, what do i do? to get the ends of the lines?
|
||||
i try to calcluate with both x & y in 2 min\max. 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
|
||||
** 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
|
||||
** 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
|
||||
** and i got wrong result
|
||||
day24 result: 8406
|
||||
* another formula gives
|
||||
** another formula gives
|
||||
day24 result: 8406
|
||||
* another formula
|
||||
** another formula
|
||||
12938
|
||||
*
|
||||
* ok, part 2.
|
||||
what if.
|
||||
i start checking t = 0, 1, etc.
|
||||
for each t, i need two points of the two hail lines.
|
||||
|
||||
it would constitute the trajectory.
|
||||
then condition for the solution that all other hail lines will intersect it at some t.
|
||||
so check for intersection (maybe not necessarily in the field?)
|
||||
|
||||
go though lines, if any fail to intersect - continue with t
|
||||
|
||||
if all intersect, find where the rock has to be in time 0
|
||||
|
||||
oh. no.
|
||||
it's not just intersect. it's that the movement of the rock with t would be there at correct time? yuck?
|
||||
|
||||
would there really be more than i line that intersects all of the hail lines?
|
||||
|
||||
i'll just need to also figure out t=0 from other coords.
|
||||
|
||||
i don't like this at all.
|
||||
|
||||
And intersections have to be over (X, Y, Z)
|
||||
** so 'hail mary' approach would be
|
||||
scan first 1k nanoseconds. so already 1M calculations
|
||||
( this is first part of desperation, that at least 2 hails will intercept in first 1k ticks )
|
||||
|
||||
for collision 1, assume HailA is on path.
|
||||
then iterate for all other assumint they are intercepted on t 2 etc ?
|
||||
|
||||
no. the intersections could be on non-integer times?
|
||||
( this would be second part of the 'hail mary' )
|
||||
|
||||
from that i should be able to construct the 'trajectory' line.
|
||||
and then check with all other points - do the intersect?
|
||||
( and check of intersection in future would be nice )
|
||||
|
||||
then if line confirmed, will need to calc for t = 0, t = 1, and get speeds
|
||||
*** not hoping for all integer intersections
|
||||
or what if i will hope for that?
|
||||
let's try?
|
||||
* ok, what if i could do system of equasions?
|
||||
#+begin_src
|
||||
yuck_test.go:12:
|
||||
x + Dx * t0 == 19 + -2 * t0
|
||||
y + Dy * t0 == 13 + 1 * t0
|
||||
z + Dz * t0 == 19 + -2 * t0
|
||||
x + Dx * t1 == 18 + -1 * t1
|
||||
y + Dy * t1 == 19 + -1 * t1
|
||||
z + Dz * t1 == 18 + -2 * t1
|
||||
x + Dx * t2 == 20 + -2 * t2
|
||||
y + Dy * t2 == 25 + -2 * t2
|
||||
z + Dz * t2 == 20 + -4 * t2
|
||||
solve for x, y, z, Dx, Dy, Dz, t1, t2, t3. ti > 0
|
||||
#+end_src
|
||||
|
||||
#+begin_src
|
||||
yuck_test.go:18:
|
||||
x + Dx * t0 == 147847636573416 + 185 * t0
|
||||
y + Dy * t0 == 190826994408605 + 49 * t0
|
||||
z + Dz * t0 == 147847636573416 + 219 * t0
|
||||
x + Dx * t1 == 287509258905812 + -26 * t1
|
||||
y + Dy * t1 == 207449079739538 + 31 * t1
|
||||
z + Dz * t1 == 287509258905812 + 8 * t1
|
||||
x + Dx * t2 == 390970075767404 + -147 * t2
|
||||
y + Dy * t2 == 535711685410735 + -453 * t2
|
||||
z + Dz * t2 == 390970075767404 + -149 * t2
|
||||
solve for x, y, z, Dx, Dy, Dz, t1, t2, t3. ti > 0
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user