/// <summary> /// Cells are to be merged if they are adjacent, that is, if they share a "significant" number of /// pixels when proejected on the Y axis. /// </summary> protected override bool Overlap(Rectangle rectangle1, Rectangle rectangle2) { int overlap = rectangle1.YOverlap(rectangle2); return Math.Max((overlap * 1.0 / rectangle1.Height), (overlap * 1.0 / rectangle2.Height)) > 0.5; }