25 #include "chipmunk_types.h"
40 cpBB bb = {l, b, r, t};
48 return cpBBNew(c.x - hw, c.y - hh, c.x + hw, c.y + hh);
60 return (a.l <= b.r && b.l <= a.r && a.b <= b.t && b.b <= a.t);
66 return (bb.l <= other.l && bb.r >= other.r && bb.b <= other.b && bb.t >= other.t);
72 return (bb.l <= v.x && bb.r >= v.x && bb.b <= v.y && bb.t >= v.y);
105 return (bb.r - bb.l)*(bb.t - bb.b);
117 cpFloat idx = 1.0f/(b.x - a.x);
119 #pragma warning(disable: 4056)
121 cpFloat tx1 = (bb.l == a.x ? -INFINITY : (bb.l - a.x)*idx);
122 cpFloat tx2 = (bb.r == a.x ? INFINITY : (bb.r - a.x)*idx);
126 cpFloat idy = 1.0f/(b.y - a.y);
127 cpFloat ty1 = (bb.b == a.y ? -INFINITY : (bb.b - a.y)*idy);
128 cpFloat ty2 = (bb.t == a.y ? INFINITY : (bb.t - a.y)*idy);
130 #pragma warning(default: 4056)
135 if(tymin <= txmax && txmin <= tymax){
139 if(0.0 <= max && min <= 1.0)
return cpfmax(min, 0.0);
163 cpFloat modx = cpfmod(v.x - bb.l, dx);
164 cpFloat x = (modx > 0.0f) ? modx : modx + dx;
167 cpFloat mody = cpfmod(v.y - bb.b, dy);
168 cpFloat y = (mody > 0.0f) ? mody : mody + dy;
170 return cpv(x + bb.l, y + bb.b);