質問

私はグアルゴリズムがって、球面へのグリッドポイント(簡単のためにグリッド線を並列に対して垂直にmeridians).た点、すればよいのでしょうか効率的に受けグリッドスクエア"を決定することB点の角に少なくとも球面座標の距離です。の縮退の場合、"マス"を実際に"三角形".

私は実際に使用で行きる広場昼間のお仕事をお持ちでもでもできる受け入れ 下限 だけだと少します。このためさんありがとうございます。アルゴリズムを非常に迅速な行したほうが良いと思われますので、正確な精度-検索少し訳です。

他のヒント

ポイント範囲のポイント最寄りのフル3Dスペースも近いものが測定の面にそっております。実際の距離が異なるだけのもっとも近い点はあるんじゃないでしょうか簡単めに3次元距離がより安心に大きな円弧、等。

の実際の大円の距離(latitidude緯度-経度)ポイントの分野で利用できます初式 このリンク.

いくつかのポイントを、明確にするためます。

あなたは、特に正方形であるこれらの正方形をしたい(ひいては経絡に関してこの平行および垂直レイアウトに正確に適合しないために)場合を除き、これらは正確に正方形ではありません。正方形の寸法が大である場合、これは特に表示されます。

質問は[完璧]球のことを話します。私たちはその平坦化極と地球(または他の惑星)を考慮した場合の事項は多少異なるだろう。

続き法案に合う「アルゴリズム」で、私はそれが最適である疑いが、良い基礎を提供することができます。 編集:これは非常の複雑さを低減するように、点ではなく(コードではなく円弧のIE)対応大きなcirle距離と、プレーン3次元距離で動作するTom10の提案を参照して式ます。

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