pub fn intersect(&self, other: &Rect) -> Rect {
    let mut out = Rect::default();
    if self.is_empty() || other.is_empty() {
      return out;
    }

    // horizontal intersection
    let mut ha_min = self.x;
    let mut ha_max = ha_min + self.w;
    let hb_min = other.x;
    let hb_max = hb_min + other.w;
    if hb_min > ha_min {
      ha_min = hb_min;
    }
    out.x = ha_min;
    if hb_max < ha_max {
      ha_max = hb_max;
    }
    out.w = ha_max - ha_min;

    // vertical intersection
    let mut va_min = self.y;
    let mut va_max = va_min + self.h;
    let vb_min = other.y;
    let vb_max = vb_min + other.h;
    if vb_min > va_min {
      va_min = vb_min;
    }
    out.y = va_min;
    if vb_max < va_max {
      va_max = vb_max;
    }
    out.h = va_max - va_min;

    out
  }
/// Gives a `Rect` that's the intersection between this and the other rect.
///
/// * If either Rect in the intersection is empty you get a default Rect.
Gives a `Rect` that's the intersection between this and the other rect.
If either Rect in the intersection is empty you get a default Rect.
Gives a ` Rect ` that ' s the intersection between this and the other rect . If either Rect in the intersection is empty you get a default Rect .
pub fn intersect(&self, other: &Rect) -> Rect {
    let mut out = Rect::default();
    if self.is_empty() || other.is_empty() {
      return out;
    }
    // horizontal intersection
    let mut ha_min = self.x;
    let mut ha_max = ha_min + self.w;
    let hb_min = other.x;
    let hb_max = hb_min + other.w;
    if hb_min > ha_min {
      ha_min = hb_min;
    }
    out.x = ha_min;
    if hb_max < ha_max {
      ha_max = hb_max;
    }
    out.w = ha_max - ha_min;
    // vertical intersection
    let mut va_min = self.y;
    let mut va_max = va_min + self.h;
    let vb_min = other.y;
    let vb_max = vb_min + other.h;
    if vb_min > va_min {
      va_min = vb_min;
    }
    out.y = va_min;
    if vb_max < va_max {
      va_max = vb_max;
    }
    out.h = va_max - va_min;
    out
  }
pub fn intersect ( & self , other : & Rect ) -> Rect { let mut out = Rect :: default ( ) ; if self . is_empty ( ) || other . is_empty ( ) { return out ; } // horizontal intersection let mut ha_min = self . x ; let mut ha_max = ha_min + self . w ; let hb_min = other . x ; let hb_max = hb_min + other . w ; if hb_min > ha_min { ha_min = hb_min ; } out . x = ha_min ; if hb_max < ha_max { ha_max = hb_max ; } out . w = ha_max - ha_min ; // vertical intersection let mut va_min = self . y ; let mut va_max = va_min + self . h ; let vb_min = other . y ; let vb_max = vb_min + other . h ; if vb_min > va_min { va_min = vb_min ; } out . y = va_min ; if vb_max < va_max { va_max = vb_max ; } out . h = va_max - va_min ; out }
Gives a `Rect` that's the intersection between this and the other rect.
Gives a ` Rect ` that ' s the intersection between this and the other rect .
&self
other
&Rect
&self
other
&Rect