isLinesShadowOver static method

bool isLinesShadowOver(
  1. Vector2 a,
  2. Vector2 b,
  3. Vector2 c,
  4. Vector2 d,
)

Rapid rejection experiment Determine whether the projections of the line segment a~b and the line segment c~d on the x-axis and y-axis have a common area

Implementation

static bool isLinesShadowOver(Vector2 a, Vector2 b, Vector2 c, Vector2 d) {
  if (min(a.x, b.x) > max(c.x, d.x) ||
      min(c.x, d.x) > max(a.x, b.x) ||
      min(a.y, b.y) > max(c.y, d.y) ||
      min(c.y, d.y) > max(a.y, b.y)) {
    return false;
  }

  return true;
}