public Face getFace(Face p_viewpoint) { if (p_viewpoint == Face.TOP) { return(c_currentUp); } else if (p_viewpoint == Face.BOTTOM) { return(FaceHandler.getOpposite(c_currentUp)); } else { return(getHorizonalFacebyVirtual(p_viewpoint)); } }
public void rotate(Rotation p_rotation) { Face l_temp; Face l_face = p_rotation.getFace(); Direction l_direction = p_rotation.getDirection(); if (l_face == Face.TOP) { if (l_direction == Direction.CW) { c_currentFront = getFace(Face.RIGHT); } else { c_currentFront = getFace(Face.LEFT); } } else if (l_face == Face.RIGHT) { if (l_direction == Direction.CW) { l_temp = c_currentFront; c_currentFront = getFace(Face.BOTTOM); c_currentUp = l_temp; } else { l_temp = getFace(Face.BACK); c_currentFront = c_currentUp; c_currentUp = l_temp; } } else if (l_face == Face.FRONT) { if (l_direction == Direction.CW) { c_currentUp = getFace(Face.LEFT); } else { c_currentUp = getFace(Face.RIGHT); } } else { rotate(new Rotation(FaceHandler.getOpposite(l_face), DirectionHandler.getOpposite(l_direction))); } }