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:
parent
d17fb160b0
commit
f61c55fd90
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user