Fix divide by zero on triangle shapes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user