Fix divide by zero on triangle shapes

This commit is contained in:
Mitchell McCaffrey
2020-06-24 09:27:36 +10:00
parent 9a4d047cd5
commit 96a100c02a
2 changed files with 4 additions and 1 deletions

View File

@@ -10,6 +10,9 @@ export function length(p) {
export function normalize(p) {
const l = length(p);
if (l === 0) {
return { x: 0, y: 0 };
}
return divide(p, l);
}