From 342004841c6d1acbe8d9d8b83ef8212521fcfc64 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 26 Aug 2026 14:58:48 -0700 Subject: [PATCH] restore some bits needed for tests --- rust/pspp/src/spv/read/graph/frames.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 { -- 2.47.3