Commit 51c74e08 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

In "VRectangle.shape()", use camel case notation and use boolean variables to communicate intuition

parent 2f0acade
Pipeline #371811 passed with stages
in 130 minutes and 28 seconds
......@@ -45,13 +45,14 @@ public class VRectangle extends Rectangle2D.Double implements VShape {
@Override
public boolean contains(VCircle otherShape) {
double x_c = otherShape.getCentroid().x;
double y_c = otherShape.getCentroid().y;
double r_c = otherShape.getRadius();
return ((this.x + r_c) < x_c) && // x < (x_c - r_c)
((this.y + r_c) < y_c) && // y < (y_c - r_c)
((this.x + this.width) > (x_c + r_c)) &&
((this.y + this.height) > (y_c + r_c));
double centerX = otherShape.getCentroid().x;
double centerY = otherShape.getCentroid().y;
double radius = otherShape.getRadius();
boolean circleFitsIntoHorizontally = (centerX > (this.x + radius)) && ((this.x + this.width) > (centerX + radius));
boolean circleFitsIntoVertically = (centerY > (this.y + radius)) && ((this.y + this.height) > (centerY + radius));
return circleFitsIntoHorizontally && circleFitsIntoVertically;
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment