Continue vector vs plane intersection
How to determine Ray (one point R(rx;ry) and alpha with OX) with line (two points A(ax;ay) and B(bx;by)) intersection?
|
Continue vector vs plane intersection How to determine Ray (one point R(rx;ry) and alpha with OX) with line (two points A(ax;ay) and B(bx;by)) intersection? |
|||
|
|
|
The line segment $AB = \{A + t(B-A) \in \mathbb R^2|t \in [0,1]\}$. The ray $L = \{R+s(\cos(\alpha),\sin(\alpha))\in \mathbb R^2|s \in \mathbb R^+\}$. Therefore the intersection $AB \cap L$ is the set of points $(x,y)$ that satisfy $$A + t(B-A) = R+s(\cos(\alpha),\sin(\alpha))$$ for some $t \in [0,1]$ and $s \in \mathbb R^+$. To solve this split it into components:
and solve both sides for $t$:
now we equate these to solve for $s$: $$s = \frac{\frac{R_x-A_x}{B_x-A_x}-\frac{R_y-A_y}{B_y-A_y}}{\frac{\sin(\alpha)}{B_y-A_y}-\frac{\cos(\alpha)}{B_x-A_x}}$$ You can back substitute this to get $t$ and check that $t \in [0,1]$ and $s \in \mathbb R^+$ before back substituting to find the intersection point. |
|||
|
|