@graphty/webgpu-graph-algorithms 0.6.25 → 0.6.26
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/src/layouts/seed.d.ts +3 -1
- package/dist/src/layouts/seed.d.ts.map +1 -1
- package/dist/src/layouts/seed.js +10 -1
- package/dist/src/layouts/seed.js.map +1 -1
- package/dist/webgpu-graph-algorithms.js +5 -0
- package/dist/webgpu-graph-algorithms.js.map +1 -1
- package/package.json +3 -3
- package/src/layouts/seed.ts +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphty/webgpu-graph-algorithms",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.26",
|
|
4
4
|
"description": "WebGPU-accelerated graph algorithms and layouts over the @graphty/graph-format snapshot, for Node (Dawn) and browsers",
|
|
5
5
|
"author": "Adam Powers <apowers@ato.ms>",
|
|
6
6
|
"type": "module",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"vite": "^7.0.5",
|
|
96
96
|
"vitest": "4.1.11",
|
|
97
97
|
"webgpu": "0.4.0",
|
|
98
|
-
"@graphty/
|
|
99
|
-
"@graphty/
|
|
98
|
+
"@graphty/layout": "^2.0.9",
|
|
99
|
+
"@graphty/algorithms": "^3.1.8"
|
|
100
100
|
},
|
|
101
101
|
"scripts": {
|
|
102
102
|
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
|
package/src/layouts/seed.ts
CHANGED
|
@@ -79,7 +79,9 @@ function resolveCenter(center: ArrayLike<number> | null): [number, number, numbe
|
|
|
79
79
|
* "fa2"`; `"fr"` is [0, 1)), otherwise uniform inside the [min, max] box of the finite components per axis,
|
|
80
80
|
* converted to layout units (an axis with no finite value falls back to the range box); the value is written as
|
|
81
81
|
* `v * scale + center[axis]`, which for scale 1 / center 0 is bit-identical to the port's `u * 2 - 1` (resp. `u`);
|
|
82
|
-
* in 2D the third component of a seeded row is written as center[2].
|
|
82
|
+
* in 2D the third component of a seeded row is written as center[2]. An axis whose finite box has zero width (one
|
|
83
|
+
* finite row, or every finite row sharing that coordinate) is padded to the range box's width centered on it, so
|
|
84
|
+
* the drawn rows never all land on one point or one line. Finite components are never changed and a
|
|
83
85
|
* fully finite row is never touched. No random number is drawn when nothing needs seeding.
|
|
84
86
|
* PLAN DECISION 12 (P3-T1): the box is taken over every finite COMPONENT (the port's rule), not over the fully
|
|
85
87
|
* finite ROWS only; the two differ only when a partially finite row's finite axis lies outside the fully finite
|
|
@@ -170,6 +172,13 @@ export function seedPositions(
|
|
|
170
172
|
if (Number.isFinite(lo[axis]) && Number.isFinite(hi[axis])) {
|
|
171
173
|
boxLo[axis] = (lo[axis] - c[axis]) / scale;
|
|
172
174
|
boxHi[axis] = (hi[axis] - c[axis]) / scale;
|
|
175
|
+
if (boxLo[axis] === boxHi[axis]) {
|
|
176
|
+
// a zero-width axis (one finite row, or every finite row on one line) would stack every drawn
|
|
177
|
+
// row on that coordinate: pad it to the range box's width, centered on it
|
|
178
|
+
const half = (rangeHi - rangeLo) / 2;
|
|
179
|
+
boxLo[axis] -= half;
|
|
180
|
+
boxHi[axis] += half;
|
|
181
|
+
}
|
|
173
182
|
}
|
|
174
183
|
}
|
|
175
184
|
}
|