visualization of path between two points given as (vector bearing) coordinates.

447 Views Asked by At

I'm having problem in understanding a question. I tried tracing graphs but had no luck to understand this.

If anyone can help me to understand and visualize this problem, how it's happening.

the problem is given below and i'll try to write it as simple as possible.

i have a laser gun and i have to fire it toward the enemy to kill him.

points to consider (given assumptions)

  1. laser beam reflects of the walls and if hit me first then i'll dead, so have to avoid bouncing a shot toward me.

  2. laser can only travel certain maximum distance, after that distance it will gone, and also if laser hit anyone then it will gone.

  3. If laser hits a corner it will bounce back in exactly same direction.

  4. The room has integer dimensions $[1 < x_{dim} \leq 1250,~ 1 < y_{dim} \leq 1250]$. me and the enemy are both positioned on the integer lattice at different distinct positions $(x, y)$ inside the room such that $[0 < x < x_{dim}, 0 < y < y_{dim}]$.

And it's the example that i'm not getting, i need to understand this example.

Me and the enemy were positioned in a room with dimensions $[3, 2]$, my position $[1, 1]$, enemy position $[2, 1]$, and a maximum shot distance of $4$,

i could shoot in seven different directions to hit the enemy (given as vector bearings from your location): $[1, 0], [1, 2], [1, -2], [3, 2], [3, -2], [-3, 2],$ and $[-3, -2]$.

As specific examples, the shot at bearing $[1, 0]$ is the straight line horizontal shot of distance $1$, the shot at bearing $[-3, -2]$ bounces off the left wall and then the bottom wall before hitting the enemy with a total shot distance of $\sqrt{13}$, and the shot at bearing $[1, 2]$ bounces off just the top wall before hitting the enemy with a total shot distance of $\sqrt{5}$.

now i'm not getting how this laser hitting $(-3,-2)$ on left and bottom. and i'm not able to visualize this whole scenario.

sorry for longer questions but have to write all of these assumptions for better understanding. edits are welcome if i not asked properly.

1

There are 1 best solutions below

6
On BEST ANSWER

https://www.desmos.com/calculator/bwwuh7nhvw

First Plot your location (1,1) since you are firing in direction (-3,-2) from your location, the new coordinates will be (1-3,1-2) = (-2,-1)
But since that it out of our bounds, the lasers stops at $(0,{1\over3})$ Reflecting the line $3y-2x=1$ with respect to line $x=0$ gives us new line $3x+2y=1$.

Repeating the process with new line and y=0 gives us $3y-2x=-1$ which passes through enemy's position