Commits

jorgenpt  committed 262b572

Fix Circle#contains(x,y).

Previous implementation used top left corner as center of circle for contains().

  • Participants
  • Parent commits 9d7443e

Comments (0)

Files changed (1)

File trunk/Slick/src/org/newdawn/slick/geom/Circle.java

 	 */
     public boolean contains(float x, float y) 
     { 
-        return (x - getX()) * (x - getX()) + (y - getY()) * (y - getY()) < getRadius() * getRadius(); 
+        float xDelta = x - getCenterX(), yDelta = y - getCenterY();
+        return xDelta * xDelta + yDelta * yDelta < getRadius() * getRadius();
     }
     
     /**