I want to check a circle intercepts with a line or not. Lets say i have two points with knowing their longitutudes and latitudes. And i also know the circle's longitude, latitude and radius as meter. For example:
- point1 lat1,lon1
- point2 lat2,lon2
- circle lat3,lon3,rad
How can i find the intercept point(s) between the line and the circle? It is easy when they are all in the same unit but i am confused and stucked between coordinates as degrees and radius as meter.
Thanks for your answers from now.
$\endgroup$ 01 Answer
$\begingroup$You first try to convert your (latitude,longitude,altitude) to (X , Y , Z) then solve your problem using ordinary approaches.(X,Y,Z) coordinate is named ECEF Coordinates .In this coordinate unit of X , Y , Z is meters and form a Cartesian coordinate.
There exists formula for converting (latitude , longitude , altitude) to (X,Y,Z) . In Matlab you can use command lla2ecef.You can google for covert lla to ecef and you can find plenty of useful fourmula.
If your points is near to each other in earth , you can assume altitude of all is same and is zero for example.So steps are
- convert (lat1 , lon1 , 0) => (X1,Y1,Z1)
- convert (lat2 , lon2 , 0) => (X2,Y2,Z2)
- convert (lat3 , lon3 , 0) => (X3,Y3,Z3)
create a sphere with center (X3,Y3,Z3) and radius rad and intersect it with line that passes two point (X1,Y1,Z1) and (X2,Y2,Z2) then find potentially intersection point(s)
(x1 , y1 , z1)
(x2 , y2 , z2)Finally convert them back to LLA (Longitude , Latitude and Altitude) system.In Matlab you can use ecef2lla command.