Skip to content

Commit

Permalink
fix: prevent division by zero in bezier
Browse files Browse the repository at this point in the history
  • Loading branch information
samvimes01 committed Aug 23, 2024
1 parent 6d27df6 commit e3c8b33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bezier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Bezier {
const dxm = m1.x - m2.x;
const dym = m1.y - m2.y;

const k = l2 / (l1 + l2);
const k = l1 + l2 == 0 ? 0 : l2 / (l1 + l2);
const cm = { x: m2.x + dxm * k, y: m2.y + dym * k };

const tx = s2.x - cm.x;
Expand Down

0 comments on commit e3c8b33

Please sign in to comment.