MHB Does a Line Intersect a Polygon?

  • Thread starter Thread starter sfopeano
  • Start date Start date
  • Tags Tags
    Line Polygon
sfopeano
Messages
1
Reaction score
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
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.
 
What you're talking about is intersection tests. Here's a web page talking about some common algorithms.
 
Thread 'Determine whether ##125## is a unit in ##\mathbb{Z_471}##'
This is the question, I understand the concept, in ##\mathbb{Z_n}## an element is a is a unit if and only if gcd( a,n) =1. My understanding of backwards substitution, ... i have using Euclidean algorithm, ##471 = 3⋅121 + 108## ##121 = 1⋅108 + 13## ##108 =8⋅13+4## ##13=3⋅4+1## ##4=4⋅1+0## using back-substitution, ##1=13-3⋅4## ##=(121-1⋅108)-3(108-8⋅13)## ... ##= 121-(471-3⋅121)-3⋅471+9⋅121+24⋅121-24(471-3⋅121## ##=121-471+3⋅121-3⋅471+9⋅121+24⋅121-24⋅471+72⋅121##...
Back
Top