Positive z-value flips 3d program (Pure Java)

Hey guys,

so I have been coding a 3d projection in Java2D (don’t judge me, testing purposes only :point:) and I ran into this problem: when the camera Z is greater than 0, the program flips and acts in reverse(see gif) when in reality, the camera should just pass the cube. Any ideas.

http://zippy.gfycat.com/TartEcstaticCopepod.gif

This converts 3d points into 2d for drawing



	public Vector3 processPoint(Vector3 point) {//point : the original point
		Vector3 projection = new Vector3();//output point

		if (orthographic) {
			projection.xyz[0] = position.x() + this.position.x();//position : the camera position ->Vector3
			projection.xyz[1] = position.y() + this.position.y() + position.z();
		} else {

			double zdis = point.z() - position.z();
			if (position.z() > 0) {
				Math.abs(point.z() - position.z());
			}
			point.rotateXAround(Math.toRadians(rotX), position);//rotX = 0
			point.rotateYAround(Math.toRadians(rotY), position);//rotY = 0
			point.rotateZAround(Math.toRadians(rotZ), position);//rotZ = 0

			projection.xyz[0] = ((-position.x() + point.x()) * (MainWindow.frame
					.getWidth() / zdis)) + MainWindow.frame.getWidth() / 2;//new x value
			projection.xyz[1] = ((-position.y() + point.y()) * (MainWindow.frame
					.getHeight() / zdis)) + MainWindow.frame.getHeight() / 2;//new y value

		}
		return projection;//this works great with camera z values below 0

	}