diff --git a/crates/bevy_math/src/primitives/dim2.rs b/crates/bevy_math/src/primitives/dim2.rs index 63d7c3896aa8b..8d094e3e957d0 100644 --- a/crates/bevy_math/src/primitives/dim2.rs +++ b/crates/bevy_math/src/primitives/dim2.rs @@ -88,6 +88,12 @@ pub struct Circle { impl Primitive2d for Circle {} impl Circle { + /// Create a new [`Circle`] from a `radius` + #[inline(always)] + pub const fn new(radius: f32) -> Self { + Self { radius } + } + /// Finds the point on the circle that is closest to the given `point`. /// /// If the point is outside the circle, the returned point will be on the perimeter of the circle. diff --git a/crates/bevy_math/src/primitives/dim3.rs b/crates/bevy_math/src/primitives/dim3.rs index 4d270fd8acd1b..8c12f2b789f5b 100644 --- a/crates/bevy_math/src/primitives/dim3.rs +++ b/crates/bevy_math/src/primitives/dim3.rs @@ -92,6 +92,12 @@ pub struct Sphere { impl Primitive3d for Sphere {} impl Sphere { + /// Create a new [`Sphere`] from a `radius` + #[inline(always)] + pub const fn new(radius: f32) -> Self { + Self { radius } + } + /// Finds the point on the sphere that is closest to the given `point`. /// /// If the point is outside the sphere, the returned point will be on the surface of the sphere.