# Math Help - Finding a line/ trapezoid intersection through system of equations

1. ## Finding a line/ trapezoid intersection through system of equations

Hello, I have a problem that I so far haven't been able to solve, I know it includes geometry but I need to find a way to solve it looking at it as functions, a system of linear equations or such that might be solved in a matrix. I want to find out if a line( finite) is either inside or intersecting a trapezoid. I know that the line can never be intersecting the trapezoid twice and the line is always parallel to the parallel lines of the trapezoid. I have tried to find an approach using a parametrized equation of the plane and line intersection but I dont think it covers all cases.
( something like this ( from wikipedia) : la+(lb+la)t=p0+(p1-p0)u+(p2-p0)v

thanks

2. Here's an idea.

1. Your test line is parallel to the parallel lines of the trapezoid. Hence, there's no need to test for intersection with the parallel lines.
2. Parametrize the non-parallel lines of the trapezoid as follows:

$y_{1}=m_{1}t+b_{1},\quad t\in[a_{1},b_{1}],$ and

$y_{2}=m_{2}t+b_{2},\quad t\in[a_{2},b_{2}].$

Parametrize your test line in the same way:

$z=m_{z}t+b_{z},\quad t\in[a_{z},b_{z}].$

3. Attempt to solve, one after the other, the equations $z=y_{1},$ and $z=y_{2}$ for $t.$ In both cases, there should be exactly one solution, since the lines are obviously not parallel. Test the value of $t$ and see if it is inside both allowable ranges. For example, if you're solving $z=y_{1},$ then make sure both that $t\in[a_{1},b_{1}]$ and $t\in[a_{z},b_{z}].$ If so, then you have an intersection. Otherwise, you don't.

Make sense?

3. Thanks! a question though, what is "a" in the interval?

4. $a_{1}$ is the left-hand boundary for the interval $[a_{1},b_{1}].$ For example, if

$[a_{1},b_{1}]=[2,5],$ then $a_{1}=2$ and $b_{1}=5.$

Does that make sense?

5. Just browsing by to say a thanks a lot . The solution is great, working with wind turbine wakes here.

6. Great! You're very welcome for any help I could give. Have a good one!