docs: public static void buildTree(RPTree tree,
                                   RPNode from,
                                   RPHyperPlanes planes,
                                   INDArray X,
                                   int maxSize,
                                   int depth,
                                   String similarityFunction) {
          if(from.getIndices().size() <= maxSize) {
              //slimNode
              slimNode(from);
              return;
          }
  
  
          List<Double> distances = new ArrayList<>();
          RPNode left = new RPNode(tree,depth + 1);
          RPNode right = new RPNode(tree,depth + 1);
  
          if(planes.getWholeHyperPlane() == null || depth >= planes.getWholeHyperPlane().rows()) {
              planes.addRandomHyperPlane();
          }
  
  
          INDArray hyperPlane = planes.getHyperPlaneAt(depth);
  
  
  
          for(int i = 0; i < from.getIndices().size(); i++) {
              double cosineSim = computeDistance(similarityFunction,hyperPlane,X.slice(from.getIndices().get(i)));
              distances.add(cosineSim);
          }
  
          Collections.sort(distances);
          from.setMedian(distances.get(distances.size() / 2));
  
  
          for(int i = 0; i < from.getIndices().size(); i++) {
              double cosineSim = computeDistance(similarityFunction,hyperPlane,X.slice(from.getIndices().get(i)));
              if(cosineSim <= from.getMedian()) {
                  left.getIndices().add(from.getIndices().get(i));
              }
              else {
                  right.getIndices().add(from.getIndices().get(i));
              }
          }
  
          //failed split
          if(left.getIndices().isEmpty() || right.getIndices().isEmpty()) {
              slimNode(from);
              return;
          }
  
  
          from.setLeft(left);
          from.setRight(right);
          slimNode(from);
  
  
          buildTree(tree,left,planes,X,maxSize,depth + 1,similarityFunction);
          buildTree(tree,right,planes,X,maxSize,depth + 1,similarityFunction);
  
      }