我在Bing地图中画了一个圆圈。 现在我需要编写一个点(纬度,经度)是在圆圈内部还是外部的代码?
c#.Net中是否有任何算法代码?
I have drawn a circle in Bing maps. Now I need to write code for whether a point (latitude, longitude) is inside or outside of the circle?
Is there any algorithmic code in c#.Net?
最满意答案
只需计算distance between the center of the circle and your current coordinate的distance between the center of the circle and your current coordinate ,并将此距离与圆半径进行比较(距离<=半径表示坐标位于圆内)。
要计算两点之间的距离,请使用Haversine公式 。
你会在这里找到一个C#实现。
Just compute the distance between the center of the circle and your current coordinate, and compare this distance to the circle radius (distance <= radius means the coordinate is inside the circle).
To compute the distance between two points, use the Haversine formula.
You'll find a C# implementation here.
更多推荐
发布评论