mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-07 15:55:00 +00:00
Make normalize node safer for the user
This commit is contained in:
parent
592d6bfcbd
commit
7de13aca3e
1 changed files with 3 additions and 1 deletions
|
@ -619,9 +619,11 @@ fn length(_: impl Ctx, vector: DVec2) -> f64 {
|
|||
}
|
||||
|
||||
/// Scales the input vector to unit length while preserving it's direction. This is equivalent to dividing the input vector by it's own magnitude.
|
||||
///
|
||||
/// Returns zero when the input vector is zero.
|
||||
#[node_macro::node(category("Math: Vector"))]
|
||||
fn normalize(_: impl Ctx, vector: DVec2) -> DVec2 {
|
||||
vector.normalize()
|
||||
vector.normalize_or_zero()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue