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 <francois.mockers@vleue.com>
This commit is contained in:
IcyLeave6109 2024-05-15 23:22:50 -03:00 committed by GitHub
parent d17fb160b0
commit f61c55fd90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -723,10 +723,13 @@ impl RegularPolygon {
///
/// # Panics
///
/// Panics if `circumradius` is non-positive
/// Panics if `circumradius` is negative
#[inline(always)]
pub fn new(circumradius: f32, sides: usize) -> Self {
assert!(circumradius > 0.0, "polygon has a non-positive radius");
assert!(
circumradius.is_sign_positive(),
"polygon has a negative radius"
);
assert!(sides > 2, "polygon has less than 3 sides");
Self {