- /** does collision detection between 2 rectangles. Returns true in case of
- * collision and fills in the hit structure then.
- */
- static bool rectangle_rectangle(CollisionHit& hit, const Rect& r1,
- const Vector& movement, const Rect& r2);
-
- /** does collision detection between a rectangle and an axis aligned triangle
- * Returns true in case of a collision and fills in the hit structure then.
- */
- static bool rectangle_aatriangle(CollisionHit& hit, const Rect& rect,
- const Vector& movement, const AATriangle& triangle);
+ Constraints() {
+ float infinity = (std::numeric_limits<float>::has_infinity ? std::numeric_limits<float>::infinity() : std::numeric_limits<float>::max());
+ left = -infinity;
+ right = infinity;
+ top = -infinity;
+ bottom = infinity;
+ }
+
+ bool has_constraints() const {
+ float infinity = (std::numeric_limits<float>::has_infinity ? std::numeric_limits<float>::infinity() : std::numeric_limits<float>::max());
+ return left > -infinity || right < infinity
+ || top > -infinity || bottom < infinity;
+ }
+
+ float left;
+ float right;
+ float top;
+ float bottom;
+ Vector ground_movement;
+ CollisionHit hit;