diff --git a/crates/fj-core/src/geometry/util.rs b/crates/fj-core/src/geometry/util.rs index 6a4fdf330..35710d8cc 100644 --- a/crates/fj-core/src/geometry/util.rs +++ b/crates/fj-core/src/geometry/util.rs @@ -6,3 +6,22 @@ //! Whatever's in here isn't expected to stay here permanently. Rather, this //! module provides an easy place to put new things, before it's clear what to //! do with them long-term. + +use fj_math::Point; + +use super::{traits::GenPolyline, Tolerance}; + +/// # Convert a point on a curve from curve coordinates to surface coordinates +pub fn curve_point_to_surface_point( + curve: &dyn GenPolyline<2>, + point_curve: impl Into>, + tolerance: impl Into, +) -> Point<2> { + let point_curve = point_curve.into(); + let tolerance = tolerance.into(); + + let line_segment = curve.line_segment_at(point_curve, tolerance); + let line = line_segment.to_line(); + + line.point_from_line_coords(point_curve) +}