From: Ben Pfaff Date: Wed, 26 Aug 2026 21:58:48 +0000 (-0700) Subject: restore some bits needed for tests X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=342004841c6d1acbe8d9d8b83ef8212521fcfc64;p=pspp restore some bits needed for tests --- diff --git a/rust/pspp/src/spv/read/graph/frames.rs b/rust/pspp/src/spv/read/graph/frames.rs index 6b29a1b7bd..c777e65e1b 100644 --- a/rust/pspp/src/spv/read/graph/frames.rs +++ b/rust/pspp/src/spv/read/graph/frames.rs @@ -889,12 +889,24 @@ mod simplex { pub struct Point(pub [f64; 2]); impl Point { + #[cfg(test)] + pub fn new(x: f64, y: f64) -> Self { + Self([x, y]) + } + pub fn midpoint(self, other: Self) -> Self { Self([ self.0[0].midpoint(other.0[0]), self.0[1].midpoint(other.0[1]), ]) } + + #[cfg(test)] + pub fn distance(self, other: Self) -> f64 { + let dx = self.0[0] - other.0[0]; + let dy = self.0[1] - other.0[1]; + dx.hypot(dy) + } } impl Mul for Point {