From 71e13c363e66a0a67210a979759c4ae231b25aaf Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Mon, 19 May 2025 17:20:38 +0200 Subject: [PATCH] Tidy up --- packages/math/package.json | 2 +- packages/math/src/curve.ts | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/math/package.json b/packages/math/package.json index 65473cbbc..cd856c027 100644 --- a/packages/math/package.json +++ b/packages/math/package.json @@ -57,4 +57,4 @@ "gen:types": "rimraf types && tsc", "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types" } -} +} \ No newline at end of file diff --git a/packages/math/src/curve.ts b/packages/math/src/curve.ts index 7664c70f6..dd9bece10 100644 --- a/packages/math/src/curve.ts +++ b/packages/math/src/curve.ts @@ -428,26 +428,23 @@ export function curvePointAtLength

( let currentLength = 0; // Tolerance for length comparison and iteration limit to avoid infinite loops - const tolerance = totalLength * 0.0001; // 0.01% of total length + const tolerance = totalLength * 0.0001; const maxIterations = 20; for (let iteration = 0; iteration < maxIterations; iteration++) { currentLength = curveLengthAtParameter(c, t); const error = Math.abs(currentLength - targetLength); - // If we're close enough, return the point if (error < tolerance) { break; } - // Update search range if (currentLength < targetLength) { tMin = t; } else { tMax = t; } - // Update parameter using bisection method t = (tMin + tMax) / 2; }