Skip to content

Commit

Permalink
Add Rect::from_pos
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jun 19, 2024
1 parent 159f836 commit 902b4d9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/emath/src/rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ impl Rect {
}
}

/// A zero-sized rect at a specific point.
#[inline]
pub fn from_pos(point: Pos2) -> Self {
Self {
min: point,
max: point,
}
}

/// Bounding-box around the points.
pub fn from_points(points: &[Pos2]) -> Self {
let mut rect = Self::NOTHING;
Expand Down

0 comments on commit 902b4d9

Please sign in to comment.