private bool Collision(RectangleDTO rect1, RectangleDTO rect2, out RectangleDTO rinter)
 {
     if (rect1.x < rect2.x + rect2.delta_x &&
         rect1.x + rect1.delta_x > rect2.x &&
         rect1.y < rect2.y + rect2.delta_y &&
         rect1.y + rect1.delta_y > rect2.y)
     {
         var xinter  = Math.Max(rect1.x, rect2.x);
         var yinter  = Math.Max(rect1.y, rect2.y);
         var x2inter = Math.Min(rect1.x + rect1.delta_x, rect2.x + rect2.delta_x);
         var y2inter = Math.Min(rect1.y + rect1.delta_y, rect2.y + rect2.delta_y);
         rinter = new RectangleDTO(xinter, yinter, x2inter - xinter, y2inter - yinter);
         return(true);
     }
     rinter = new RectangleDTO(0, 0, 0, 0);//empty intersection
     return(false);
 }
 public RectangleIntersection(List <RectangleDTO> input, RectangleDTO inter)
 {
     this.input = input;
     this.inter = inter;
     this.Id    = calcIdentifier();
 }