@knowvah/dot-engine 2.4.0 → 2.5.0

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
@@ -37953,12 +37953,14 @@ function computeStep(ng, bbs, margin) {
37953
37953
  c -= W * H;
37954
37954
  }
37955
37955
  const d = b * b - 4 * a * c;
37956
- if (d < 0) return 1;
37957
- const root = Math.floor((-b + Math.sqrt(d)) / (2 * a));
37958
- return root <= 0 ? 1 : root;
37956
+ const r = Math.sqrt(d);
37957
+ const l1 = (-b + r) / (2 * a);
37958
+ let root = Number.isNaN(l1) ? 0 : d2i(l1);
37959
+ if (root === 0) root = 1;
37960
+ return root;
37959
37961
  }
37960
37962
  function gridCells(x, s) {
37961
- return Math.ceil(x / s);
37963
+ return d2i(Math.ceil(x / s));
37962
37964
  }
37963
37965
  function cval(v, s) {
37964
37966
  return v >= 0 ? v / s : (v + 1) / s - 1;
@@ -37999,8 +38001,8 @@ function fits(x, y, info, ctx) {
37999
38001
  const bb = ctx.bbs[info.index];
38000
38002
  if (bb === void 0) return null;
38001
38003
  const place = {
38002
- x: ctx.step * x - cround(bb.ll.x),
38003
- y: ctx.step * y - cround(bb.ll.y)
38004
+ x: Math.imul(ctx.step, x) - cround(bb.ll.x),
38005
+ y: Math.imul(ctx.step, y) - cround(bb.ll.y)
38004
38006
  };
38005
38007
  markCells(info.cells, x, y, ctx.ps);
38006
38008
  return place;