Skip to content

Commit f61c55f

Browse files
juliohqmockersf
andauthored
Allow shapes to be constructed with zero values (#13365)
# Objective Fixes #13332. ## Solution The assertion `circumradius >= 0.0` to allow zero. Are there any other shapes that need to be allowed to be constructed with zero? --------- Co-authored-by: François Mockers <[email protected]>
1 parent d17fb16 commit f61c55f

File tree

1 file changed

+5
-2
lines changed
  • crates/bevy_math/src/primitives

1 file changed

+5
-2
lines changed

crates/bevy_math/src/primitives/dim2.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,13 @@ impl RegularPolygon {
723723
///
724724
/// # Panics
725725
///
726-
/// Panics if `circumradius` is non-positive
726+
/// Panics if `circumradius` is negative
727727
#[inline(always)]
728728
pub fn new(circumradius: f32, sides: usize) -> Self {
729-
assert!(circumradius > 0.0, "polygon has a non-positive radius");
729+
assert!(
730+
circumradius.is_sign_positive(),
731+
"polygon has a negative radius"
732+
);
730733
assert!(sides > 2, "polygon has less than 3 sides");
731734

732735
Self {

0 commit comments

Comments
 (0)