@thi.ng/boids 1.0.29 → 1.0.31
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/CHANGELOG.md +7 -1
- package/README.md +2 -2
- package/package.json +11 -12
- package/behaviors/mixed.d.ts +0 -4
- package/behaviors/mixed.js +0 -13
- package/behaviors/path.d.ts +0 -4
- package/behaviors/path.js +0 -18
- package/behaviors/probabilistic.d.ts +0 -4
- package/behaviors/probabilistic.js +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-04-
|
|
3
|
+
- **Last updated**: 2024-04-23T07:02:17Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [1.0.30](https://github.com/thi-ng/umbrella/tree/@thi.ng/boids@1.0.30) (2024-04-20)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update type usage ([abad151](https://github.com/thi-ng/umbrella/commit/abad151))
|
|
17
|
+
|
|
12
18
|
# [1.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/boids@1.0.0) (2024-01-23)
|
|
13
19
|
|
|
14
20
|
#### 🛑 Breaking changes
|
package/README.md
CHANGED
|
@@ -100,10 +100,10 @@ import * as boids from "@thi.ng/boids";
|
|
|
100
100
|
Browser ESM import:
|
|
101
101
|
|
|
102
102
|
```html
|
|
103
|
-
<script type="module" src="https://
|
|
103
|
+
<script type="module" src="https://esm.run/@thi.ng/boids"></script>
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
[
|
|
106
|
+
[JSDelivr documentation](https://www.jsdelivr.com/)
|
|
107
107
|
|
|
108
108
|
For Node.js REPL:
|
|
109
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/boids",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"description": "n-dimensional boids simulation with modular behavior system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "yarn build:esbuild && yarn build:decl",
|
|
28
28
|
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
29
29
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
30
|
-
"clean": "
|
|
30
|
+
"clean": "bun ../../tools/src/clean-package.ts",
|
|
31
31
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
32
32
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
33
33
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
@@ -36,19 +36,18 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/distance": "^2.4.
|
|
42
|
-
"@thi.ng/geom-closest-point": "^2.1.
|
|
43
|
-
"@thi.ng/geom-resample": "^2.3.
|
|
44
|
-
"@thi.ng/math": "^5.10.
|
|
45
|
-
"@thi.ng/timestep": "^0.5.
|
|
46
|
-
"@thi.ng/vectors": "^7.10.
|
|
39
|
+
"@thi.ng/api": "^8.11.1",
|
|
40
|
+
"@thi.ng/checks": "^3.6.3",
|
|
41
|
+
"@thi.ng/distance": "^2.4.71",
|
|
42
|
+
"@thi.ng/geom-closest-point": "^2.1.125",
|
|
43
|
+
"@thi.ng/geom-resample": "^2.3.51",
|
|
44
|
+
"@thi.ng/math": "^5.10.12",
|
|
45
|
+
"@thi.ng/timestep": "^0.5.47",
|
|
46
|
+
"@thi.ng/vectors": "^7.10.29"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@microsoft/api-extractor": "^7.43.0",
|
|
50
50
|
"esbuild": "^0.20.2",
|
|
51
|
-
"rimraf": "^5.0.5",
|
|
52
51
|
"typedoc": "^0.25.12",
|
|
53
52
|
"typescript": "^5.4.3"
|
|
54
53
|
},
|
|
@@ -144,5 +143,5 @@
|
|
|
144
143
|
"status": "alpha",
|
|
145
144
|
"year": 2023
|
|
146
145
|
},
|
|
147
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
|
|
148
147
|
}
|
package/behaviors/mixed.d.ts
DELETED
package/behaviors/mixed.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const mixedBehaviorUpdate = (boid) => {
|
|
2
|
-
const { maddN, zeroes } = boid.api;
|
|
3
|
-
const force = zeroes();
|
|
4
|
-
for (let behavior of boid.behaviors) {
|
|
5
|
-
const weight = behavior.weight(boid);
|
|
6
|
-
if (weight !== 0)
|
|
7
|
-
maddN(force, behavior.update(boid), weight, force);
|
|
8
|
-
}
|
|
9
|
-
return force;
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
mixedBehaviorUpdate
|
|
13
|
-
};
|
package/behaviors/path.d.ts
DELETED
package/behaviors/path.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { closestPointPolyline } from "@thi.ng/geom-closest-point";
|
|
2
|
-
import { __ensureFn } from "../internal/ensure.js";
|
|
3
|
-
const followPath = (points, closed, weight = 1) => {
|
|
4
|
-
const closest = [];
|
|
5
|
-
const pos = [];
|
|
6
|
-
return {
|
|
7
|
-
weight: __ensureFn(weight),
|
|
8
|
-
update: (boid) => closestPointPolyline(
|
|
9
|
-
boid.api.add(pos, boid.pos.curr, boid.vel.curr),
|
|
10
|
-
points,
|
|
11
|
-
closed,
|
|
12
|
-
closest
|
|
13
|
-
) ? boid.steerTowards(closest) : boid.api.ZERO
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
followPath
|
|
18
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { argSort } from "@thi.ng/arrays/arg-sort";
|
|
2
|
-
const probabilisticBehaviorUpdate = (boid) => {
|
|
3
|
-
const { maddN, magSq, zeroes } = boid.api;
|
|
4
|
-
const force = zeroes();
|
|
5
|
-
const behaviors = boid.behaviors;
|
|
6
|
-
const num = behaviors.length;
|
|
7
|
-
const weights = behaviors.map((b) => b.weight(boid));
|
|
8
|
-
const order = argSort(weights, (a, b) => b - a);
|
|
9
|
-
for (let i = 0; i < num; i++) {
|
|
10
|
-
const id = order[i];
|
|
11
|
-
const weight = weights[id];
|
|
12
|
-
if (Math.random() < weight) {
|
|
13
|
-
const f = behaviors[id].update(boid);
|
|
14
|
-
if (magSq(f) > 0) {
|
|
15
|
-
maddN(force, f, weight, force);
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return force;
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
probabilisticBehaviorUpdate
|
|
24
|
-
};
|