void subsample(int numberOfPoints) {
		double xx[] = new double[numberOfPoints];
		int count[] = new int[numberOfPoints];
		double yy[] = new double[numberOfPoints];

		for( int i = 0; i < x.length; i++ ) {
			int j = i * numberOfPoints / x.length;
			xx[j] += x[i];
			yy[j] += y[i];
			count[j]++;
		}

		for( int j = 0; j < xx.length; j++ ) {
			if( count[j] > 1 ) {
				xx[j] /= count[j];
				yy[j] /= count[j];
			}
		}

		x = xx;
		y = yy;
	}