66 EnclosingBox.
pfLow =
new float[nDimension];
67 EnclosingBox.
pfHigh =
new float[nDimension];
70 for (
int d = 0; d < nDimension; d++)
73 float fLow = ppValues[0][d];
74 float fHigh = ppValues[0][d];
77 for (
int i = 0; i < nSize; i++)
79 if (ppValues[i][d] < fLow)
81 fLow = ppValues[i][d];
83 else if (ppValues[i][d] > fHigh)
85 fHigh = ppValues[i][d];
90 EnclosingBox.
pfLow[d] = fLow;
91 EnclosingBox.
pfHigh[d] = fHigh;
102 register float fDistance = 0.0f;
104 for (
register int d = 0; d < nDimension; d++)
106 if (pValues[d] < BoundingBox.
pfLow[d])
109 const float fTemp = BoundingBox.
pfLow[d] - pValues[d];
110 fDistance += powf(fTemp, 2);
112 else if (pValues[d] > BoundingBox.
pfHigh[d])
115 const float fTemp = pValues[d] - BoundingBox.
pfHigh[d];
116 fDistance += powf(fTemp, 2);
KdBoundingBox CalculateEnclosingBoundingBox(float **ppValues, int nDimension, int nSize)
float GetDistanceFromBox(KdBoundingBox BoundingBox, const float *pValues, int nDimension)