public static Point centre(Point[] pp){
        int n = pp.length;
        int m = pp[0].nDimensions;
        int l = 0;
        for(int i=1; i<n; i++){
            l = pp[i].nDimensions;
            if(l!=m)throw new IllegalArgumentException("All points must have the same number of dimensions");
        }
        double[] cc = new double[m];
        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                cc[j] += pp[i].point[j];
            }
        }
        for(int j=0; j<m; j++)cc[j] /= n;
           
        return new Point(cc);
    }