src/classify/kdtree.cpp
void KDStore(KDTREE *Tree, float *Key, void *Data) {
  auto PtrToNode = &(Tree->Root.Left);
  auto Node = *PtrToNode;
  auto Level = NextLevel(Tree, -1);
  while (Node != nullptr) {
    if (Key[Level] < Node->BranchPoint) {
      PtrToNode = &(Node->Left);
      if (Key[Level] > Node->LeftBranch) {
        Node->LeftBranch = Key[Level];
      }
    } else {
      PtrToNode = &(Node->Right);
      if (Key[Level] < Node->RightBranch) {
        Node->RightBranch = Key[Level];
      }
    }
    Level = NextLevel(Tree, Level);
    Node = *PtrToNode;
  }

  *PtrToNode = new KDNODE(Tree, Key, Data, Level);
}
/**
 * This routine stores Data in the K-D tree specified by Tree
 * using Key as an access key.
 *
 * @param Tree    K-D tree in which data is to be stored
 * @param Key    ptr to key by which data can be retrieved
 * @param Data    ptr to data to be stored in the tree
 */
This routine stores Data in the K-D tree specified by Tree
using Key as an access key.

@param Tree    K-D tree in which data is to be stored
@param Key    ptr to key by which data can be retrieved
@param Data    ptr to data to be stored in the tree
This routine stores Data in the K - D tree specified by Tree using Key as an access key . @param Tree K - D tree in which data is to be stored @param Key ptr to key by which data can be retrieved @param Data ptr to data to be stored in the tree
void KDStore(KDTREE *Tree, float *Key, void *Data) {
  auto PtrToNode = &(Tree->Root.Left);
  auto Node = *PtrToNode;
  auto Level = NextLevel(Tree, -1);
  while (Node != nullptr) {
    if (Key[Level] < Node->BranchPoint) {
      PtrToNode = &(Node->Left);
      if (Key[Level] > Node->LeftBranch) {
        Node->LeftBranch = Key[Level];
      }
    } else {
      PtrToNode = &(Node->Right);
      if (Key[Level] < Node->RightBranch) {
        Node->RightBranch = Key[Level];
      }
    }
    Level = NextLevel(Tree, Level);
    Node = *PtrToNode;
  }
  *PtrToNode = new KDNODE(Tree, Key, Data, Level);
}
void KDStore ( KDTREE * Tree , float * Key , void * Data ) { auto PtrToNode = & ( Tree -> Root . Left ) ; auto Node = * PtrToNode ; auto Level = NextLevel ( Tree , -1 ) ; while ( Node != nullptr ) { if ( Key [ Level ] < Node -> BranchPoint ) { PtrToNode = & ( Node -> Left ) ; if ( Key [ Level ] > Node -> LeftBranch ) { Node -> LeftBranch = Key [ Level ] ; } } else { PtrToNode = & ( Node -> Right ) ; if ( Key [ Level ] < Node -> RightBranch ) { Node -> RightBranch = Key [ Level ] ; } } Level = NextLevel ( Tree , Level ) ; Node = * PtrToNode ; } * PtrToNode = new KDNODE ( Tree , Key , Data , Level ) ; }
This routine stores Data in the K-D tree specified by Tree
 using Key as an access key.
This routine stores Data in the K - D tree specified by Tree using Key as an access key .