Flatland

Documentation

SourceForge.net Logo

aabb.hpp

Go to the documentation of this file.
00001 // Summary: Define a small class for 2D axis-aligned bounding boxes.
00002 // Copyright: 2007  Philip Rideout.  All rights reserved.
00003 // License: see source/bsd-license.txt
00004 
00005 #pragma once
00006 
00007 namespace Flatland
00008 {
00009     /// axis-aligned bounding box in 2D
00010     struct aabb
00011     {
00012         aabb() {}
00013         aabb(float left, float top, float right, float bottom) :
00014             left(left), top(top), right(right), bottom(bottom) {}
00015 
00016         bool intersects(const aabb &x) const
00017         {
00018             return ((left < x.right && x.left < right) && (top < x.bottom && x.top < bottom)); 
00019         }
00020 
00021         float left;
00022         float top;
00023         float right;
00024         float bottom;
00025     };
00026 }

Generated on Sat Jan 13 17:20:21 2007 for Flatland by doxygen 1.5.1