The class from Nils is a total mess and not complete. For instance, the contains method does not work etc... This class should be replace by the libgdx supporting classes such as Rectangle and Polygon from com.badlogic.gdx.math.Rectangle and com.badlogic.gdx.math.Polygon