reordered terms in _rect_overlap
parent
0dc35bd9d9
commit
7950e45632
|
@ -31,13 +31,13 @@ static inline
|
|||
int _rect_overlap(float aminx, float aminy, float amaxx, float amaxy, float bminx, float bminy, float bmaxx, float bmaxy) {
|
||||
return
|
||||
(
|
||||
(aminx < bmaxx && aminx > bmaxx)
|
||||
(aminx < bmaxx && aminx > bminx)
|
||||
||
|
||||
(amaxx > bminx && amaxx < bmaxx)
|
||||
(bminx < amaxx && bminx > aminx)
|
||||
) && (
|
||||
(aminy < bmaxy && aminy > bmaxy)
|
||||
(aminy < bmaxy && aminy > bminy)
|
||||
||
|
||||
(amaxy > bminy && amaxy < bmaxy)
|
||||
(bminy < amaxy && bminy > aminy)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,10 @@ short _collision_aabb_aabb(const object_t* a, const object_t* b) {
|
|||
|
||||
static inline
|
||||
short _collision_circle_circle(const object_t* a, const object_t* b) {
|
||||
const float ax = a->sprite.x + a->physics.circle.x, ay = a->sprite.y + a->physics.circle.y,
|
||||
bx = b->sprite.x + b->physics.circle.x, by = b->sprite.y + b->physics.circle.y;
|
||||
const float ax = a->sprite.x + a->physics.circle.x,
|
||||
ay = a->sprite.y + a->physics.circle.y,
|
||||
bx = b->sprite.x + b->physics.circle.x,
|
||||
by = b->sprite.y + b->physics.circle.y;
|
||||
const float dx = fabsf(ax-bx), dy = fabsf(ay-by);
|
||||
const float sqrdist = dx*dx+dy*dy;
|
||||
const float mindist = a->physics.circle.radius + b->physics.circle.radius;
|
||||
|
|
Loading…
Reference in New Issue