private void shootPhotons() {
		float angle = 0;
		int direct = lightSource.getDirection();
		switch (direct) {
		case LightSource.EAST:
			angle = (float) Math.PI;
			break;
		case LightSource.NORTH:
			angle = (float) Math.PI * 0.5f;
			break;
		case LightSource.SOUTH:
			angle = (float) Math.PI * 1.5f;
			break;
		case LightSource.OTHER:
			angle = lightSource.getAngleOfIncidence();
			break;
		}
		int nBeam = lightSource.getNumberOfBeams();
		if (lightSource.isSingleBeam() || nBeam == 1) {
			shootSingleBeam(direct, angle);
			return;
		}
		float x = (float) boundary.x;
		float y = (float) boundary.y;
		float w = (float) boundary.width;
		float h = (float) boundary.height;
		if (nBeam > 0) {
			float spacing;
			switch (direct) {
			case LightSource.WEST:
				spacing = h / (nBeam + 1);
				for (int i = 1; i <= nBeam; i++)
					addPhotonAtAngle(x, y + spacing * i, angle);
				break;
			case LightSource.EAST:
				spacing = h / (nBeam + 1);
				for (int i = 1; i <= nBeam; i++)
					addPhotonAtAngle(x + w, y + spacing * i, angle);
				break;
			case LightSource.NORTH:
				spacing = w / (nBeam + 1);
				for (int i = 1; i <= nBeam; i++)
					addPhotonAtAngle(x + spacing * i, y, angle);
				break;
			case LightSource.SOUTH:
				spacing = w / (nBeam + 1);
				for (int i = 1; i <= nBeam; i++)
					addPhotonAtAngle(x + spacing * i, y + h, angle);
				break;
			case LightSource.OTHER:
				float s = (float) Math.abs(Math.sin(angle));
				float c = (float) Math.abs(Math.cos(angle));
				float length = s * h < c * w ? h / c : w / s;
				spacing = length / nBeam;
				float dx = spacing / s;
				float dy = spacing / c;
				int m = (int) (w / dx);
				int n = (int) (h / dy);
				shootAtAngle(m, n, dx, dy, angle);
				break;
			}
		} else {
			// backward compatible
			if (!lightSource.isSingleBeam()) {
				float spacing = 40;
				switch (direct) {
				case LightSource.WEST:
					int n = (int) (h / spacing);
					for (int i = 0; i <= n; i++)
						addPhotonAtAngle(0, spacing * i, angle);
					break;
				case LightSource.EAST:
					n = (int) (h / spacing);
					for (int i = 0; i <= n; i++)
						addPhotonAtAngle(w, spacing * i, angle);
					break;
				case LightSource.NORTH:
					int m = (int) (w / spacing);
					for (int i = 0; i <= m; i++)
						addPhotonAtAngle(spacing * i, 0, angle);
					break;
				case LightSource.SOUTH:
					m = (int) (w / spacing);
					for (int i = 0; i <= m; i++)
						addPhotonAtAngle(spacing * i, h, angle);
					break;
				case LightSource.OTHER:
					float dx = (float) (spacing / Math.abs(Math.sin(angle)));
					float dy = (float) (spacing / Math.abs(Math.cos(angle)));
					m = (int) (w / dx);
					n = (int) (h / dy);
					shootAtAngle(m, n, dx, dy, angle);
					break;
				}
			}
		}
	}