1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-31 03:59:58 +02:00

fixed curvature

This commit is contained in:
Pomax
2020-09-25 16:02:29 -07:00
parent 4778f9a689
commit 8caa51813a
17 changed files with 8080 additions and 20419 deletions

View File

@@ -41,6 +41,7 @@ drawCurvature(curve) {
// and then draw it.
ox = k * n.x;
oy = k * n.y;
setStroke(`rgba(255,127,${s},0.6)`);
line(p.x, p.y, p.x + ox, p.y + oy);
@@ -57,7 +58,7 @@ computeCurvature(curve, t) {
dd = curve.dderivative(t),
num = d.x * dd.y - d.y * dd.x,
qdsum = d.x * d.x + d.y * d.y,
dnm = qdsum ** 3/2;
dnm = qdsum ** (3/2);
// shortcut
if (num === 0 || dnm === 0) return 0;