0

I have two GPS coordinates (p, q) that are endpoints of a segment. I have a third point c which is the center of a circle with radius r. My objective is to find the set of intersection points X between these two geometries.

There can be at least 0 and at most 2 intersections. I didn't find any ellipse or circle like geometry in boost-geometry. Is there any intersection strategy that yields intersection point x which is r distance away from c ?

Neel Basu
  • 12,638
  • 12
  • 82
  • 146
  • Not a Boost solution, but there's an answer here:https://stackoverflow.com/questions/1073336/circle-line-segment-collision-detection-algorithm – GuyRT Dec 18 '18 at 14:33
  • But that looks like normal eucladian geometry. In my case the points are on a sphere – Neel Basu Dec 18 '18 at 14:46
  • Sorry, I missed that. Would intersecting the segment with a cone, then projecting the intersection points onto the sphere work? – GuyRT Dec 18 '18 at 15:14
  • Cone will probably work if r few kilometers. But the line is not a straight line, it is also on the sphere. – Neel Basu Dec 18 '18 at 15:15
  • I think it will work at all scales. The straight line joining the two points is in the same plane as the great circle on which the points lie. This plane goes through the tip of the cone (center of sphere), so a point projected from the intersection of the straight line with the cone, will also lie on both the circle and the spherical line segment. – GuyRT Dec 18 '18 at 15:27

1 Answers1

1

Boost Geometry doesn't have the concept of a circle.

The common way to approximate a circle is by generating a regular n-gon where n is high.

You could use a k-nearest search for the endpoints of the line segment instead: boost::geometry: nearest neighbors using a circle - this would answer a subset of the questions answerable with your question description.

sehe
  • 374,641
  • 47
  • 450
  • 633