Skip to content

Commit

Permalink
Simplify NdcRect::center().
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Sep 27, 2023
1 parent 13c6a59 commit 2beec23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion all-is-cubes/src/raytracer/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ struct NdcRect {
}
impl NdcRect {
fn center(self) -> NdcPoint2 {
self.low.zip(self.high, |a, b| (a + b) / 2.)
(self.low + self.high.to_vector()) / 2.
}

fn point_within(self, uv: euclid::default::Vector2D<f64>) -> NdcPoint2 {
Expand Down

0 comments on commit 2beec23

Please sign in to comment.