Changeset 2463


Ignore:
Timestamp:
Feb 21, 2013, 2:11:37 PM (6 years ago)
Author:
sam
Message:

math: add BoxIsectBox() method to test interesections.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lol/math/geometry.h

    r2460 r2463  
    5959};
    6060
     61static inline bool BoxIsectBox(Box2D const &b1, Box2D const &b2)
     62{
     63    vec2 c1 = 0.5f * (b1.A + b1.B);
     64    vec2 c2 = 0.5f * (b2.A + b2.B);
     65    vec2 e1 = 0.5f * (b1.B - b1.A);
     66    vec2 e2 = 0.5f * (b2.B - b2.A);
     67
     68    return abs(c1.x - c2.x) < abs(e1.x) + abs(e2.x)
     69        || abs(c1.y - c2.y) < abs(e1.y) + abs(e2.y);
     70}
     71
    6172bool TriangleIsectTriangle(vec3 const &v00, vec3 const &v01, vec3 const &v02,
    6273                           vec3 const &v10, vec3 const &v11, vec3 const &v12,
Note: See TracChangeset for help on using the changeset viewer.