public double heightAt(double x, double z) {
		if (x < 0) {
			x = 0;
		}
		if (x > this.getWidth() - 1) {
			x = this.getWidth() - 1;
		}
		if (z < 0) {
			z = 0;
		}
		if (z > this.getLength() - 1) {
			z = this.getLength() - 1;
		}

		int leftX = (int) x;
		if (leftX == this.getWidth() - 1) {
			leftX--;
		}
		double fracX = x - leftX;

		int outZ = (int) z;
		if (outZ == this.getWidth() - 1) {
			outZ--;
		}
		double fracZ = z - outZ;

		float h11 = this.getHeight(leftX, outZ);
		float h12 = this.getHeight(leftX, outZ + 1);
		float h21 = this.getHeight(leftX + 1, outZ);
		float h22 = this.getHeight(leftX + 1, outZ + 1);

		return (1 - fracX) * ((1 - fracZ) * h11 + fracZ * h12) + fracX
				* ((1 - fracZ) * h21 + fracZ * h22);
	}