docs: void unionTreeCoreset(int k,int n_1,int n_2,int d, Point[] setA,Point[] setB, Point[] centres, MTRandom clustererRandom) {
  		//printf("Computing coreset...\n");
  		//total number of points
  		int n = n_1+n_2;
  
  		//choose the first centre (each point has the same probability of being choosen)
  		
  		//stores, how many centres have been choosen yet
  		int choosenPoints = 0; 
  		
  		//only choose from the n-i points not already choosen
  		int j = clustererRandom.nextInt(n-choosenPoints); 
  
  		//copy the choosen point
  		if(j < n_1){
  			//copyPointWithoutInit(&setA[j],&centres[choosenPoints]);
  			centres[choosenPoints] = setA[j].clone();
  		} else {
  			j = j - n_1;
  			//copyPointWithoutInit(&setB[j],&centres[choosenPoints]);
  			centres[choosenPoints] = setB[j].clone();
  		}
  		treeNode root = new treeNode(setA,setB,n_1,n_2, centres[choosenPoints],choosenPoints); //??
  		choosenPoints = 1;
  		
  		//choose the remaining points
  		while(choosenPoints < k){
  			if(root.cost > 0.0){
  				treeNode leaf = selectNode(root, clustererRandom);
  				Point centre = chooseCentre(leaf, clustererRandom);
  				split(leaf,centre,choosenPoints);
  				//copyPointWithoutInit(centre,&centres[choosenPoints]);
  				centres[choosenPoints] = centre;
  			} else {
  				//create a dummy point
  				//copyPointWithoutInit(root.centre,&centres[choosenPoints]);
  				centres[choosenPoints] = root.centre;
  				int l;
  				for(l=0;l<root.centre.dimension;l++){
  					centres[choosenPoints].coordinates[l] = -1 * 1000000;
  				}
  				centres[choosenPoints].id = -1;
  				centres[choosenPoints].weight = 0.0;
  				centres[choosenPoints].squareSum = 0.0;
  			}
  			
  			choosenPoints++;
  		}
  
  		//free the tree
  		freeTree(root);
  
  		//recalculate clustering features
  		int i;
  		for(i=0;i<n;i++){
  				
  			if(i < n_1) {
  				
  				int index = setA[i].centreIndex;
  				if(centres[index].id != setA[i].id){
  					centres[index].weight += setA[i].weight;
  					centres[index].squareSum += setA[i].squareSum;
  					int l;
  					for(l=0;l<centres[index].dimension;l++){
  						if(setA[i].weight != 0.0){
  							centres[index].coordinates[l] += setA[i].coordinates[l];
  						}
  					}
  				}
  			} else {
  				
  				int index = setB[i-n_1].centreIndex;
  				if(centres[index].id != setB[i-n_1].id){
  					centres[index].weight += setB[i-n_1].weight;
  					centres[index].squareSum += setB[i-n_1].squareSum;
  					int l;
  					for(l=0;l<centres[index].dimension;l++){
  						if(setB[i-n_1].weight != 0.0){
  							centres[index].coordinates[l] += setB[i-n_1].coordinates[l];
  						}
  					}
  				}
  			}
  		}
  	}