From 2beec235c2d9e50bfc5f43052b07d8bb32c9874e Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Wed, 27 Sep 2023 16:31:35 -0700 Subject: [PATCH] Simplify `NdcRect::center()`. --- all-is-cubes/src/raytracer/renderer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/all-is-cubes/src/raytracer/renderer.rs b/all-is-cubes/src/raytracer/renderer.rs index 7a10a7806..510860fff 100644 --- a/all-is-cubes/src/raytracer/renderer.rs +++ b/all-is-cubes/src/raytracer/renderer.rs @@ -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) -> NdcPoint2 {