There is a point A and quadrilateral with Longitude and latitude, I calculate the center of quadrilateral C, then I want to draw a line pass through A to C and extend that line to -20 latitude B, how can I calculate the coordinate of point B?
CodePudding user response:
- Define quadrilateral for a sphere.
- Find C, the center. Or at least approximate it. For example avg lat and avg lng might be "close enough".
- Convert A and C to [x,y,z] assuming center of earth is [0,0,0].
- You now have 3 3D points. This defines a circle on the plane that goes through all 3.
- Find the plane where B is. Note that this latter plane does not go through [0,0,0]; instead [0,0,z] where z is some simple trig based on -20 deg latitude.
- Find the line that intersects those two planes.
- Find, on the line, the x,y for the above z.
- Convert [x,y,z] to polar to get longitude.
(Sorry, I don't have the energy or incentive to fill in the details.)
(There could be a simpler algorithm, but I doubt if it would have many fewer steps.)