mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 01:48:28 +00:00
Improve panic message
Previously, computing the `sqrt` could have resulted in `NaN`, which would have lead to a generic panic in `Scalar` complaining about just that.
This commit is contained in:
parent
161546522a
commit
e6528bef3b
@ -71,6 +71,16 @@ impl Sketch {
|
||||
let c = radius;
|
||||
|
||||
let b_squared = c * c - a * a;
|
||||
|
||||
if b_squared < Scalar::ZERO {
|
||||
panic!(
|
||||
"Radius of arc (`{radius}`) is too small: \
|
||||
Must be at least half the distance between \
|
||||
start (`{start:?}`) and end (`{end:?}`) \
|
||||
points, or the arc is not possible."
|
||||
);
|
||||
}
|
||||
|
||||
b_squared.sqrt()
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user