Does a line intersect a polygon

In summary, to determine if a line intersects a polygon, we need to intersect the line with each of the bounding edges of the polygon. If the intersection is within the end points of an edge, then the line intersects the polygon. However, if the polygon is on the surface of a sphere, we need to intersect the planes of the great circles instead. There are various algorithms available for such intersection tests.
  • #1
sfopeano
1
0
Hello, I'm wondering if anyone has a formula for determining whether a line intersects a polygon. I would define the line with a starting latitude/longitude and ending latitude/longitude, and I would define the polygon with a series of latitude/longitude coordinates. Many thanks in advance.

-Stephan
 
Physics news on Phys.org
  • #2
sfopeano said:
Hello, I'm wondering if anyone has a formula for determining whether a line intersects a polygon. I would define the line with a starting latitude/longitude and ending latitude/longitude, and I would define the polygon with a series of latitude/longitude coordinates. Many thanks in advance.

-Stephan

Hi sfopeano, welcome to MHB!

To intersect a line with a polygon, we need to intersect that line with each of the bounding edges of the polygon.
If the intersection is within the end points of an edge, then that line intersects the polygon.
Otherwise it doesn't.

However, you mention latitude and longitude, which suggest that you are talking about a polygon on the surface of a sphere.
If that is the case, then the line and the edges correspond to segments of so called great circles.
And each such great circle lies in a plane through the center of the sphere.
Instead of intersecting lines, we now have to intersect these planes, and see if the intersecting line is within the associated segment.
 
  • #3
What you're talking about is intersection tests. Here's a web page talking about some common algorithms.
 

1. What is the definition of a line intersecting a polygon?

A line intersects a polygon if it passes through two or more of its sides or vertices.

2. How can you determine if a line intersects a polygon?

To determine if a line intersects a polygon, you can use the line-line intersection formula to find the point of intersection between the line and each side of the polygon. If at least one of these points lies within the polygon, then the line intersects it.

3. Can a line intersect a polygon at more than two points?

No, a line can only intersect a polygon at a maximum of two points. If a line intersects a polygon at more than two points, then it is considered to be a polygon itself.

4. What is the difference between a line intersecting a polygon and a line being contained within a polygon?

A line intersects a polygon if it passes through two or more of its sides or vertices. On the other hand, a line is contained within a polygon if all of its points lie within the polygon and it does not intersect any of its sides or vertices.

5. Can a line intersect a concave polygon?

Yes, a line can intersect a concave polygon. As long as the line passes through two or more sides or vertices of the polygon, it is considered to intersect it.

Similar threads

  • Calculus and Beyond Homework Help
Replies
4
Views
308
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
Replies
3
Views
1K
  • Linear and Abstract Algebra
Replies
9
Views
214
  • Linear and Abstract Algebra
Replies
2
Views
890
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
981
  • General Math
Replies
8
Views
1K
  • Other Physics Topics
Replies
6
Views
2K
  • Precalculus Mathematics Homework Help
Replies
2
Views
1K
Back
Top