4 * Created on: Apr 20, 2012
15 bool AABB::Overlaps(const Shape &other, Vector &normal) const {
16 if (other.Overlaps(*this, normal)) {
24 bool AABB::Overlaps(const AABB &other, Vector &normal) const {
25 if (Bottom() <= other.Top()) return false;
26 if (other.Bottom() <= Top()) return false;
27 if (Right() <= other.Left()) return false;
28 if (other.Right() <= Left()) return false;
30 if (HorizontalOverlap(other)) {
31 if (Top() < other.Top()) {
32 normal = Vector(0, -1);
34 normal = Vector(0, 1);
37 if (Left() < other.Left()) {
38 normal = Vector(-1, 0);
40 normal = Vector(1, 0);
47 bool AABB::Overlaps(const Circle &other, Vector &normal) const {
48 if (other.Overlaps(*this, normal)) {
56 bool AABB::Overlaps(const FakeLens &other, Vector &normal) const {
57 if (other.Overlaps(*this, normal)) {
65 std::ostream &AABB::Write(std::ostream &out) const {
66 return out << "AABB(" << Width() << 'x' << Height() << '+' << X() << '+' << Y() << ')';
69 } /* namespace geometry */