Question

It is known that the intersection points between a line and a polyline can be found using Polyxpoly command in MATLAB.
However, the examples given here involve the polylines that are composed of points, but not real lines. Here, a polyline object is created with the interpolation of space between the points.
What I want to do is to obtain the intersection points between the polyline and line that are defined by line equations, but not from a point to another. Image below is to illustrate what I'm looking for

I want to obtain the coordinates of the intersection points in MATLAB (Denoted with blue circles).

Was it helpful?

Solution

If you create a line segment by choosing two points on your infinite line which are outside the polyline, then you'll have what you need for polyxpoly. Choose, for example,

x0=min(black_polyline_x) - 100;
x1=max(black_polyline_x) + 100;

Then compute y0 and y1 to be on the line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top