I'm trying to produce a boolean method that will return true if a point (lonc,latc) lies on a great circle arc starting at (lona,lata) and ending at (lonb,latb)
the point of the method returning true is so if you are in a location where you should be able to see this great circel the section you can see will be shown.
the jist is that you are at (lond,latd) with a small circle at 10degrees radius and I want to work out if the great circle and small circle will intersect. There will be multiple great circles but only one small circle.
I feel the simplest approach is to check any of the longitude and latitudes on the circumference of the small circle lie on a great circle line
any help will be most appreciated
You have three latitude-longitude pairs (θa, φa), (θb, φb) and (θc, φc) and you want to determine whether point (θc, φc) lies on the great circle determined by (θa, φa) and (θb, φb). You can accomplish this for example using the following calculations:
Convert all latitude-longitude pairs to (x, y, z) triples using the following formulae: x = sin(θ)*cos(φ), y = sin(θ)*sin(φ), z = cos(θ). This will give you three triples (xa, ya, za), (xb, yb, zb), (xc, yc, zc).
Determine the formula in cartesian coordinates of the plane going through points (xa, ya, za), (xb, yb, zb) and the origin (0, 0, 0). The formula is x+b*y+c*z=0 and we seek b and c which can be determined from two simultaneous equations obtained by substituting coordinates of points A and B for x, y and z in the plane formula x+b*y+c*z=0.
Calculate the distance between point (xc, yc, zc) and the plane determined in point 2 using the following formula: d=abs(xc+b*yc+c*zc)/sqrt(1+b*b+c*c).
From the distance in cartesian coordinates you can find the angular distance between the point (xc, yc, zc) and the great circle determined by (θa, φa) and (θb, φb) using the following formula: α = asin(d).
Since you should not compare floating point numbers exactly you should have an angular threshold which determines how far a point can be from the great circle for you to still consider the point to lie on the circle. You then compare α determined in point 4 with the threshold to come up with the boolean value you seek.