Skip to content

Commit

Permalink
Merge pull request #3297 from Darkyenus/circle-contains
Browse files Browse the repository at this point in the history
Fix Circle.contains
  • Loading branch information
xoppa committed Jul 21, 2015
2 parents 154c0cb + b947d30 commit 55c5a02
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gdx/src/com/badlogic/gdx/math/Circle.java
Expand Up @@ -167,10 +167,11 @@ public boolean contains (Vector2 point) {
/** @param c the other {@link Circle}
* @return whether this circle contains the other circle. */
public boolean contains (Circle c) {
final float radiusDiff = radius - c.radius;
if (radiusDiff < 0f) return false; // Can't contain bigger circle
final float dx = x - c.x;
final float dy = y - c.y;
final float dst = dx * dx + dy * dy;
final float radiusDiff = radius - c.radius;
final float radiusSum = radius + c.radius;
return (!(radiusDiff * radiusDiff < dst) && (dst < radiusSum * radiusSum));
}
Expand Down

0 comments on commit 55c5a02

Please sign in to comment.