updated skills
This commit is contained in:
@@ -131,4 +131,3 @@ Bun, Node, Deno, and modern browsers.
|
||||
## License
|
||||
|
||||
MIT — Suaveplan Team.
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ function pickBackgroundColour(pixels, w, h) {
|
||||
|
||||
The flood-fill uses an explicit stack (`pop()`) rather than recursion to
|
||||
avoid blowing the call stack on large emblems. We `add` to `visited`
|
||||
*before* enqueueing the neighbour, which guarantees each pixel is touched
|
||||
_before_ enqueueing the neighbour, which guarantees each pixel is touched
|
||||
at most twice (once when discovered, once when its packed index is popped).
|
||||
The neighbour set is computed as a small inline array of `-1`-sentinel
|
||||
checks for the four cardinal directions; benchmarks against a `for (const
|
||||
|
||||
@@ -62,6 +62,6 @@ The inner `tryMerge` first tests the horizontal merge (same `y`, same
|
||||
against `available` before accepting; this avoids painting through
|
||||
transparent pixels. The outer loop terminates when a full pass produces
|
||||
zero merges, so each call is idempotent. We deliberately do not try
|
||||
*non*-same-extent merges here — that is the job of `optimiseOverlap`,
|
||||
_non_-same-extent merges here — that is the job of `optimiseOverlap`,
|
||||
which can produce overlapping output and is therefore a strictly stronger
|
||||
(but more expensive) operation.
|
||||
|
||||
@@ -18,7 +18,7 @@ on the layer list and is the only pass that mutates `layer.rects`.
|
||||
- Composites every layer into a per-cell `target` grid first (lower-z to
|
||||
higher-z), then walks rect by rect deciding whether removal would
|
||||
change the composited output.
|
||||
- A rect is removed iff *every* one of its required cells is either
|
||||
- A rect is removed iff _every_ one of its required cells is either
|
||||
covered by a sibling rect at the same z-index or overdrawn by a higher-z
|
||||
rect of any colour.
|
||||
- In-place mutation via `Array.prototype.splice` — the converter calls
|
||||
|
||||
@@ -61,7 +61,7 @@ const cover = perIslandCover(info.islands, candidates, w, h);
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
The centroid term is computed against the running set of *uncovered*
|
||||
The centroid term is computed against the running set of _uncovered_
|
||||
required pixels, not the original set — this keeps selections clustered
|
||||
even as the residual shrinks. We use a precomputed `maxDist =
|
||||
sqrt(w² + h²)` so the proximity term is normalised to `[0, 1]`; without
|
||||
|
||||
@@ -59,7 +59,7 @@ const cover = enhancedGreedyCover(candidates, required, cols, rows);
|
||||
The internal `histogramSweep` builds a column-by-column heights table and
|
||||
then walks each row with a monotonic stack. When the stack pops, every
|
||||
height ≥ the popped column's height yields a distinct maximal rect of
|
||||
width `x - leftBound` and height `rectH`. We emit *every* nested height so
|
||||
width `x - leftBound` and height `rectH`. We emit _every_ nested height so
|
||||
the greedy cover can pick a smaller-but-better-positioned rect when the
|
||||
maximal-tall one would force an awkward residual. The transposed sweep is
|
||||
implemented as a fresh `boolean[][]` rather than an index permutation
|
||||
|
||||
@@ -77,7 +77,7 @@ The strip strategy only contributes when it fully covers the required
|
||||
mask. We compute coverage by intersecting each valid strip with the
|
||||
`required` grid (via `pack`) and comparing the resulting count to a
|
||||
single pre-tallied `totalRequired`. The adjacent-rect merge pass runs
|
||||
*after* the strategies have produced their winners; running it earlier
|
||||
_after_ the strategies have produced their winners; running it earlier
|
||||
would force a merge on results that would have been pruned anyway. The
|
||||
final reduce uses a strictly-less-than comparison (`a.length <= b.length`)
|
||||
so the first result wins on ties — this preserves deterministic ordering
|
||||
|
||||
Reference in New Issue
Block a user