我编程的一个算法在哪里我已经打破了表面的一个领域网点(为简单起见我们的网格线平行和垂直的经络).给出一点,我想要能够有效地采取的任何网"方"和确定点B的平与少球协调距离AB。在退化的情况下"广场"实际上"三角形".

我实际上只有用它来限的广场我在搜索,因此我也可以接受一个 下限 如果这只是一小点关闭。出于这个原因,我需要的算法是非常快,否则它将更好地把精确度的损失和搜索的一些更广场。

有帮助吗?

解决方案 4

其他提示

点上的一个领域,点接近在全3D空间也将是最接近当测量沿面的领域。实际的距离会有所不同,但是如果你只是在最近点它可能是最简单的到最小的3D距离,而不用担心伟大的圆弧线等。

找到实际的大圆之间的距离两个(latitidude、经度)点领域,可以使用的第一个公式 这个链接.

几点,为了清楚起见。

除非你特别希望这些广场的要方(因此不完全符合在这个平行和垂直布局关于络),这些都是不完全的平方。这尤其可见尺度的方都大。

这个问题讲一个[完美的]领域。事情会有所不同,如果我们考虑到地球(或其他行星)与其扁平的极。

以下是一个"算法",将适合的,比尔,我怀疑它是最佳的,但是可以提供一个良好的基础。 编辑:见Tom10的建议的工作与普通的3D点之间的距离而不是相应大张扬的距离(即这绳,而不是电弧),因为这将大大减少复杂的公式。

Problem layout:  (A, B and Sq as defined in the OP's question)
 A  : a given point the the surface of the sphere
 Sq : a given "square" from the grid 
 B  : solution to problem : point located within Sq which has the shortest 
      distance to A.
 C  : point at the center of Sq

Tentative algorithm:
Using the formulas associated with [Great Circle][1], we can:
 - find the equation of the  circle that includes A and C
 - find the distance between A and C. See the [formula here][2] (kindly lifted
    from Tom10's reply).
 - find the intersect of the Great Circle arc between these points, with the
   arcs  of parallel or meridian defining the Sq.
   There should be only one such point, unless this finds a "corner" of Sq, 
   or -a rarer case- if the two points are on the same diameter (see 
   'antipodes' below).
Then comes the more algorithmic part of this procedure (so far formulas...):
 - find, by dichotomy, the point on Sq's arc/seqment which is the closest from
   point A.  We're at B! QED.

Optimization:  
 It is probably possible make a good "guess" as to the location
 of B, based on the relative position of A and C, hence cutting the number of
 iterations for the binary search.
 Also, if the distance A and C is past a certain threshold the intersection
 of the cicles' arcs is probably a good enough estimate of B.  Only when A
 and C are relatively close will B be found a bit further on the median or
 parallel arc in these cases, projection errors between A and C (or B) are
 smaller and it may be ok to work with orthogonal coordinates and their 
 simpler formulas.

Another approach is to calculate the distance between A and each of the 4 
corners of the square and to work the dichotomic search from two of these
points (not quite sure which; could be on the meridian or parallel...)

( * ) *Antipodes case*:  When points A and C happen to be diametrically 
opposite to one another, all great circle lines between A and C have the same
 length, that of 1/2 the circonference of the sphere, which is the maximum any
 two points on the surface of a sphere may be.  In this case, the point B will
 be the "square"'s corner that is the furthest from C. 

我希望这可以帮助...

懒惰的下限的方法是要找到该中心的距离方,然后减去一半,对角线距离和限使用三角形的不平等。鉴于这些不是真正的正方形,没有将实际上是两个对角线的距离-我们将使用更大。我想,这将是相当准确的。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top