0

ユークリッド空間で同じツリーの 2 つの kdtree バウンディング ボックスの最小距離を見つける必要があります。各ボックスが 5 つの要素を保持しているとします。Javaを使用して最小ユークリッド距離が必要です。

double QHRect[][] = QNode.m_NodesRectBounds;
double RHRect[][] = RNode.m_NodesRectBounds;

    QHRect[][]:    5.74842E-4,7.76626E-5,6.72655E-4, 
                   0.5002329025,0.2499048942,0.25046735625
    RHRect[][]:
                   0.75006193275,0.7495593574,0.75005675875, 
                   0.999890963,0.999386589,0.99985146
4

1 に答える 1

0

There is nothing tricky about a Java implementation compared with any other language in this matter. You need to know the general algorithm to handle a problem like this. I believe it is this:

  1. Enumerate all 12 vertices of the two bounding boxes (cubes).
  2. Enumerate all 12 faces of the two bounding boxes.
  3. Find the Euclidean distance between each vertex of one and face of the other. This is similar to the shortest distance between a point and a plane.
  4. Of these 2*6*6=72 combinations, pick the smallest and you have your answer.

In the general version of the problem, you would also have to check for if the two bounding boxes intersect as well.

于 2011-07-07T17:30:21.930 に答える