easyeda 0.0.373 → 0.0.374

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14437,10 +14437,11 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
14437
14437
  const dx = endX - startX;
14438
14438
  const dy = endY - startY;
14439
14439
  const distance3 = Math.sqrt(dx * dx + dy * dy);
14440
- if (distance3 === 0 || radius < distance3 / 2) {
14440
+ const maxRadius = distance3 / 2;
14441
+ if (distance3 === 0 || radius < maxRadius * (1 - 1e-9)) {
14441
14442
  return [start, end];
14442
14443
  }
14443
- const h = Math.sqrt(radius * radius - distance3 * distance3 / 4);
14444
+ const h = Math.sqrt(Math.max(0, radius * radius - distance3 * distance3 / 4));
14444
14445
  const angle = Math.atan2(dy, dx);
14445
14446
  const centerDirection = (sweepFlag ? -1 : 1) * (largeArcFlag ? -1 : 1);
14446
14447
  const centerX = midX + h * Math.sin(angle) * centerDirection;