Ok, I know I asked a while back, but I am still stuck on what to do in the else bit in the code:
public GreenfootImage DrawSolid(GreenfootImage ImageToRender, ArrayList<Face> faces) { int i = 0; boolean shouldContinue = true; world3d myWorld; myWorld = (world3d) getWorld(); Camera Cam = myWorld.getCam(); while (shouldContinue && i < faces.size() - 1) { //shouldContinue is used so that I can force a stop of the loop, without changing the value of i Face face1 = faces.get(i + 1); Face face2 = faces.get(i); boolean v1Closer = false; boolean v2Closer = false; boolean v3Closer = false; if( hypot3d(face1.getV1().getX(), face1.getV1().getY(), face1.getV1().getZ(), Cam.camX, Cam.camY, Cam.camZ) > hypot3d(face2.getV1().getX(), face2.getV1().getY(), face2.getV1().getZ(), Cam.camX, Cam.camY, Cam.camZ) ) { v1Closer = true; } if( hypot3d(face1.getV2().getX(), face2.getV2().getY(), face1.getV2().getZ(), Cam.camX, Cam.camY, Cam.camZ) > hypot3d(face2.getV2().getX(), face2.getV2().getY(), face2.getV2().getZ(), Cam.camX, Cam.camY, Cam.camZ)) { v2Closer = true; } if( hypot3d(face1.getV3().getX(), face1.getV3().getY(), face1.getV3().getZ(), Cam.camX, Cam.camY, Cam.camZ) > hypot3d(face2.getV3().getX(), face2.getV3().getY(), face2.getV3().getZ(), Cam.camX, Cam.camY, Cam.camZ)) { v3Closer = true; } if(!v1Closer && !v2Closer && !v3Closer) //face1 is in front, so everything should be left in place { //no positions are changed. } else if(v1Closer && v2Closer && v3Closer) //face2 is in front of face1 and should be moved down { faces.set(i, face1); faces.set(i + 1, face2); } else //mixed results { } i++; } i = 0; while(i<faces.size()) { drawFace(faces.get(i).getV1(),faces.get(i).getV2(),faces.get(i).getV3(),ImageToRender, faces.get(i).getCol()); i++;; } return ImageToRender; }