Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

share|improve this question

put on hold as off-topic by Arthur Fischer Jan 24 at 8:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Arthur Fischer
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted

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:

  • $A_x + t(B_x-A_x) = R_x+s\cos(\alpha)$
  • $A_y + t(B_y-A_y) = R_y+s\sin(\alpha)$

and solve both sides for $t$:

  • $t = \frac{R_x-A_x}{B_x-A_x}+s\frac{\cos(\alpha)}{B_x-A_x}$
  • $t = \frac{R_y-A_y}{B_y-A_y}+s\frac{\sin(\alpha)}{B_y-A_y}$

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.