From 78c1b5fd432712e00fda639d64ceea23fcbfa8f2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 26 Sep 2024 19:38:22 +0200 Subject: [PATCH] Add `points_line` field to `LineSegment` --- crates/fj-core/src/geometry/curves/circle.rs | 5 ++++- crates/fj-core/src/geometry/curves/line.rs | 1 + crates/fj-math/src/line_segment.rs | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/fj-core/src/geometry/curves/circle.rs b/crates/fj-core/src/geometry/curves/circle.rs index d27f72190..7f7106b84 100644 --- a/crates/fj-core/src/geometry/curves/circle.rs +++ b/crates/fj-core/src/geometry/curves/circle.rs @@ -43,7 +43,10 @@ impl GenPolyline for Circle { let points = points_curve .map(|point_curve| self.point_from_circle_coords(point_curve)); - LineSegment { points } + LineSegment { + points, + points_line: points_curve, + } } fn generate_polyline( diff --git a/crates/fj-core/src/geometry/curves/line.rs b/crates/fj-core/src/geometry/curves/line.rs index e2bdeebb8..874515c17 100644 --- a/crates/fj-core/src/geometry/curves/line.rs +++ b/crates/fj-core/src/geometry/curves/line.rs @@ -19,6 +19,7 @@ impl GenPolyline for Line { LineSegment { points: [point, point], + points_line: [point_curve; 2], } } diff --git a/crates/fj-math/src/line_segment.rs b/crates/fj-math/src/line_segment.rs index 03768cecd..8cf723375 100644 --- a/crates/fj-math/src/line_segment.rs +++ b/crates/fj-math/src/line_segment.rs @@ -13,6 +13,9 @@ use super::Point; pub struct LineSegment { /// # The end points of the line segment pub points: [Point; 2], + + /// # The end points of the line segment, in line coordinates + pub points_line: [Point<1>; 2], } impl LineSegment { @@ -50,6 +53,7 @@ where fn from(points: [P; 2]) -> Self { Self { points: points.map(Into::into), + points_line: [[0.], [1.]].map(Into::into), } } }