Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nical committed May 19, 2024
1 parent b0a22dd commit 472ff4b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/box2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,15 @@ where
#[inline]
pub fn contains(&self, p: Point2D<T, U>) -> bool {
// Use bitwise and instead of && to avoid emitting branches.
(self.min.x <= p.x)
& (p.x < self.max.x)
& (self.min.y <= p.y)
& (p.y < self.max.y)
(self.min.x <= p.x) & (p.x < self.max.x) & (self.min.y <= p.y) & (p.y < self.max.y)
}

/// Returns `true` if this box contains the point `p`. A point is considered
/// in the box2d if it lies on any edge of the box2d.
#[inline]
pub fn contains_inclusive(&self, p: Point2D<T, U>) -> bool {
// Use bitwise and instead of && to avoid emitting branches.
(self.min.x <= p.x)
& (p.x <= self.max.x)
& (self.min.y <= p.y)
& (p.y <= self.max.y)
(self.min.x <= p.x) & (p.x <= self.max.x) & (self.min.y <= p.y) & (p.y <= self.max.y)
}

/// Returns `true` if this box contains the interior of the other box. Always
Expand Down

0 comments on commit 472ff4b

Please sign in to comment.