checkAABBAxis method

bool checkAABBAxis(
  1. double p1x,
  2. double p1y,
  3. double p2x,
  4. double p2y,
  5. double minx,
  6. double maxx,
  7. double miny,
  8. double maxy,
  9. double radius,
)

Implementation

bool checkAABBAxis(double p1x, double p1y, double p2x, double p2y, double minx, double maxx, double miny, double maxy,
    double radius) {
  return ((minx - p1x < radius || minx - p2x < radius) &&
      (p1x - maxx < radius || p2x - maxx < radius) &&
      (miny - p1y < radius || miny - p2y < radius) &&
      (p1y - maxy < radius || p2y - maxy < radius));
}