public void move() {
		Dimension s = environment.getSize();
		
		double newX = position.getX() + speed * cos(direction);
		// the reason there is a minus instead of a plus is that in our plane
		// Y coordinates rises downwards
		double newY = position.getY() - speed * sin(direction);

		double hw = s.getWidth() / 2;
		double hh = s.getHeight() / 2;

		if (newX < -hw) {
			newX = -hw;
			setDirection(-PI - direction);
		} else if (newX > hw) {
			newX = hw;
			setDirection(-PI - direction);
		}
		
		if (newY < -hh) {
			newY = -hh;
			setDirection(PI * 2 - direction);
		} else if (newY > hh) {
			newY = hh;
			setDirection(PI * 2 - direction);
		}

		setPosition(newX, newY);
	}