When this code was optimized the sense of the returned boolean was inverted.
The original implementation (commented out) matches the function-level
comment's description, but the live implementation returns the inverse of this
value. Should swap all > for <= .
/**
* Does this aabb contain the provided AABB.
*
* @return
*/
public final boolean contains(final AABB aabb) {
/*
* boolean result = true; result = result && lowerBound.x <= aabb.lowerBound.x; result = result
* && lowerBound.y <= aabb.lowerBound.y; result = result && aabb.upperBound.x <= upperBound.x;
* result = result && aabb.upperBound.y <= upperBound.y; return result;
*/
// djm: faster putting all of them together, as if one is false we leave the logic
// early
return lowerBound.x > aabb.lowerBound.x && lowerBound.y > aabb.lowerBound.y
&& aabb.upperBound.x > upperBound.x && aabb.upperBound.y > upperBound.y;
}
Original issue reported on code.google.com by emb...@gmail.com on 25 May 2013 at 11:08
Original issue reported on code.google.com by
emb...@gmail.com
on 25 May 2013 at 11:08