# Thread:

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!
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 15, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.933253824710846, "perplexity_flag": "head"}