diff --git a/crates/fj-kernel/src/path.rs b/crates/fj-kernel/src/path.rs index 1165059a38..aef057a0cb 100644 --- a/crates/fj-kernel/src/path.rs +++ b/crates/fj-kernel/src/path.rs @@ -43,10 +43,9 @@ impl SurfacePath { pub fn circle_from_radius(radius: impl Into) -> Self { let radius = radius.into(); - SurfacePath::Circle(Circle::new( + SurfacePath::Circle(Circle::from_center_and_radius( Point::origin(), - Vector::from([radius, Scalar::ZERO]), - Vector::from([Scalar::ZERO, radius]), + radius, )) } @@ -106,10 +105,9 @@ impl GlobalPath { pub fn circle_from_radius(radius: impl Into) -> Self { let radius = radius.into(); - GlobalPath::Circle(Circle::new( + GlobalPath::Circle(Circle::from_center_and_radius( Point::origin(), - Vector::from([radius, Scalar::ZERO, Scalar::ZERO]), - Vector::from([Scalar::ZERO, radius, Scalar::ZERO]), + radius, )) } diff --git a/crates/fj-math/src/circle.rs b/crates/fj-math/src/circle.rs index 6b8b548523..bdae2d0acf 100644 --- a/crates/fj-math/src/circle.rs +++ b/crates/fj-math/src/circle.rs @@ -54,6 +54,22 @@ impl Circle { Self { center, a, b } } + /// Construct a `Circle` from a center point and a radius + pub fn from_center_and_radius( + center: impl Into>, + radius: impl Into, + ) -> Self { + let radius = radius.into(); + + let mut a = [Scalar::ZERO; D]; + let mut b = [Scalar::ZERO; D]; + + a[0] = radius; + b[1] = radius; + + Circle::new(center, a, b) + } + /// Access the center point of the circle pub fn center(&self) -> Point { self.center