diff --git a/crates/fj-kernel/src/algorithms/sweep.rs b/crates/fj-kernel/src/algorithms/sweep.rs index d93883c01..3dad26b5d 100644 --- a/crates/fj-kernel/src/algorithms/sweep.rs +++ b/crates/fj-kernel/src/algorithms/sweep.rs @@ -154,7 +154,7 @@ mod tests { use crate::{ algorithms::Tolerance, - geometry::{Surface, SweptCurve}, + geometry::Surface, shape::{Handle, Shape}, topology::{Cycle, Edge, Face}, }; @@ -230,8 +230,7 @@ mod tests { let cycles = shape.insert(Cycle::new(vec![ab, bc, ca]))?; - let surface = - Surface::SweptCurve(SweptCurve::plane_from_points([a, b, c])); + let surface = Surface::plane_from_points([a, b, c]); let surface = if reverse { surface.reverse() } else { surface }; let surface = shape.insert(surface)?; diff --git a/crates/fj-kernel/src/geometry/surfaces/mod.rs b/crates/fj-kernel/src/geometry/surfaces/mod.rs index b71a5dc77..219864dcd 100644 --- a/crates/fj-kernel/src/geometry/surfaces/mod.rs +++ b/crates/fj-kernel/src/geometry/surfaces/mod.rs @@ -2,7 +2,7 @@ pub mod swept; pub use self::swept::SweptCurve; -use fj_math::{Point, Transform, Vector}; +use fj_math::{Line, Point, Transform, Vector}; use crate::geometry; @@ -40,6 +40,16 @@ impl Surface { }) } + /// Construct a plane from 3 points + pub fn plane_from_points(points: [impl Into>; 3]) -> Self { + let [a, b, c] = points.map(Into::into); + + let curve = Curve::Line(Line::from_points([a, b])); + let path = c - a; + + Self::SweptCurve(SweptCurve { curve, path }) + } + /// Create a new instance that is reversed #[must_use] pub fn reverse(self) -> Self { diff --git a/crates/fj-kernel/src/geometry/surfaces/swept.rs b/crates/fj-kernel/src/geometry/surfaces/swept.rs index ca5bdfd2a..d3458126f 100644 --- a/crates/fj-kernel/src/geometry/surfaces/swept.rs +++ b/crates/fj-kernel/src/geometry/surfaces/swept.rs @@ -13,15 +13,6 @@ pub struct SweptCurve { } impl SweptCurve { - /// Construct a plane from 3 points - #[cfg(test)] - pub fn plane_from_points([a, b, c]: [Point<3>; 3]) -> Self { - let curve = Curve::Line(Line::from_points([a, b])); - let path = c - a; - - Self { curve, path } - } - /// Create a new instance that is reversed #[must_use] pub fn reverse(mut self) -> Self {