]> pintos-os.org Git - pspp/commitdiff
restore some bits needed for tests
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 26 Aug 2026 21:58:48 +0000 (14:58 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 26 Aug 2026 21:58:48 +0000 (14:58 -0700)
rust/pspp/src/spv/read/graph/frames.rs

index 6b29a1b7bd491e0c71da87ff4a58ccf5a9ce6b0e..c777e65e1b2b41195ad9984ee1ff132dd63b18b8 100644 (file)
@@ -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<f64> for Point {