Skip to content

Commit

Permalink
Make GenPolyline object-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Sep 13, 2024
1 parent 69f2e68 commit 7891a69
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions crates/fj-core/src/geometry/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub trait GenPolyline<const D: usize> {
fn line_segment_at(
&self,
point: Point<1>,
tolerance: impl Into<Tolerance>,
tolerance: Tolerance,
) -> [Point<D>; 2];
}

Expand All @@ -81,7 +81,7 @@ impl<const D: usize> GenPolyline<D> for Circle<D> {
fn line_segment_at(
&self,
point: Point<1>,
tolerance: impl Into<Tolerance>,
tolerance: Tolerance,
) -> [Point<D>; 2] {
let params = PathApproxParams::for_circle(self, tolerance);

Expand All @@ -95,11 +95,7 @@ impl<const D: usize> GenPolyline<D> for Line<D> {
self.origin()
}

fn line_segment_at(
&self,
point: Point<1>,
_: impl Into<Tolerance>,
) -> [Point<D>; 2] {
fn line_segment_at(&self, point: Point<1>, _: Tolerance) -> [Point<D>; 2] {
// Collapse line segment into a point, as per documentation.
let point = self.origin() + self.direction() * point.t;

Expand All @@ -120,7 +116,7 @@ impl<const D: usize> GenPolyline<D> for Path<D> {
fn line_segment_at(
&self,
point: Point<1>,
tolerance: impl Into<Tolerance>,
tolerance: Tolerance,
) -> [Point<D>; 2] {
match self {
Self::Circle(circle) => circle.line_segment_at(point, tolerance),
Expand Down

0 comments on commit 7891a69

Please sign in to comment.