Simplify CurveGeometry impl for Circle

This commit is contained in:
Hanno Braun 2025-04-28 13:57:36 +02:00
parent b868e7d953
commit b81c916ede
2 changed files with 5 additions and 5 deletions

View File

@ -94,19 +94,19 @@ pub trait CurveGeometry {
) -> Vec<Point<1>>; ) -> Vec<Point<1>>;
} }
impl CurveGeometry for (Point<3>, Circle) { impl CurveGeometry for Circle {
fn clone_curve_geometry(&self) -> FloatingCurve { fn clone_curve_geometry(&self) -> FloatingCurve {
Box::new(*self) Box::new(*self)
} }
fn vector_from_local_point(&self, point: Point<1>) -> Vector<3> { fn vector_from_local_point(&self, point: Point<1>) -> Vector<3> {
let (_, circle) = *self; let circle = *self;
circle.vector_from_local_point(point) circle.vector_from_local_point(point)
} }
fn project_vector(&self, vector: Vector<3>) -> Point<1> { fn project_vector(&self, vector: Vector<3>) -> Point<1> {
let (_, circle) = *self; let circle = *self;
circle.project_vector(vector) circle.project_vector(vector)
} }
@ -116,7 +116,7 @@ impl CurveGeometry for (Point<3>, Circle) {
boundary: [Point<1>; 2], boundary: [Point<1>; 2],
tolerance: Tolerance, tolerance: Tolerance,
) -> Vec<Point<1>> { ) -> Vec<Point<1>> {
let (_, circle) = self; let circle = self;
CircleApproxParams::new(circle.radius(), tolerance) CircleApproxParams::new(circle.radius(), tolerance)
.approx_circle(boundary) .approx_circle(boundary)

View File

@ -112,7 +112,7 @@ impl Sketch {
Handle::new(Curve { Handle::new(Curve {
geometry: AnchoredCurve { geometry: AnchoredCurve {
origin, origin,
floating: Box::new((origin, circle)), floating: Box::new(circle),
}, },
}) })
} }