News in English

Find intersection of two lines in MATLAB

One computational geometry question that we will want to address is how to determine the intersection of two line segments. This will allow for further solutions for more complex questions, including a general solution regarding whether a point is inside or outside of a convex or non-convex polygon. Previously, we’ve described how to define a line segment in MATLAB, and we will use this definition in our current method for solving for line intersections.Note: Much credit for this post and explanation should be given to Gareth Rees. While preparing this post, I ran across his response, and I can’t do it much more justice, so here is his general implementation in MATLAB.There are 5 possibilities if we have two line segments:1) The two line segments are collinear and overlapping (intersecting portion is a line segment)2) The two line segments are collinear and disjoint (not intersecting)3) The two line segments are parallel (not intersecting)4) Not parallel and intersect5) Not parallel an...

Читайте на 123ru.net