dongting7352 2019-01-31 03:48
浏览 106

用于检查给定区域/坐标内的点的算法

i need help here. I still don't know how to check whether a point is inside a location (location given by some coordinates) or not. For example, i have an area, with given latitude and longitude like this picture

(https://i.stack.imgur.com/zR9VX.png) (the one that covered by line)

and a point (flag) inside it. What is the fastest way to check if that point is inside or outside the area??

Please help me here

  • 写回答

1条回答 默认 最新

  • dongqindan4406 2019-01-31 05:46
    关注

    We start with the formula for the area of the earth between a line of latitude and the north pole.

    A = 2*pi*R*h
    

    where R is the radius of the earth and h is the perpendicular distance from the plane containing the line of latitude to the pole. We can calculate h using trigonometry as

    h = R*(1-sin(lat))
    

    Thus the area north of a line of latitude is

    A = 2*pi*R^2(1-sin(lat))
    

    The area between two lines of latitude is the difference between the area north of one latitude and the area north of the other latitude:

    A = |2*pi*R^2(1-sin(lat2)) - 2*pi*R^2(1-sin(lat1))|
    = 2*pi*R^2 |sin(lat1) - sin(lat2)|
    

    The area of a lat-long rectangle is proportional to the difference in the longitudes. The area I just calculated is the area between longitude lines differing by 360 degrees. Therefore the area we seek is

    A = 2*pi*R^2 |sin(lat1)-sin(lat2)| |lon1-lon2|/360
    = (pi/180)R^2 |sin(lat1)-sin(lat2)| |lon1-lon2|
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大