easyeda 0.0.372 → 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.
@@ -18258,10 +18258,11 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
18258
18258
  const dx = endX - startX;
18259
18259
  const dy = endY - startY;
18260
18260
  const distance3 = Math.sqrt(dx * dx + dy * dy);
18261
- if (distance3 === 0 || radius < distance3 / 2) {
18261
+ const maxRadius = distance3 / 2;
18262
+ if (distance3 === 0 || radius < maxRadius * (1 - 1e-9)) {
18262
18263
  return [start, end];
18263
18264
  }
18264
- const h = Math.sqrt(radius * radius - distance3 * distance3 / 4);
18265
+ const h = Math.sqrt(Math.max(0, radius * radius - distance3 * distance3 / 4));
18265
18266
  const angle = Math.atan2(dy, dx);
18266
18267
  const centerDirection = (sweepFlag ? -1 : 1) * (largeArcFlag ? -1 : 1);
18267
18268
  const centerX = midX + h * Math.sin(angle) * centerDirection;