@thi.ng/boids 1.0.30 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-20T14:42:45Z
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/boids",
3
- "version": "1.0.30",
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": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
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.11.0",
40
- "@thi.ng/checks": "^3.6.2",
41
- "@thi.ng/distance": "^2.4.70",
42
- "@thi.ng/geom-closest-point": "^2.1.124",
43
- "@thi.ng/geom-resample": "^2.3.50",
44
- "@thi.ng/math": "^5.10.11",
45
- "@thi.ng/timestep": "^0.5.46",
46
- "@thi.ng/vectors": "^7.10.28"
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": "8339d05ecc857e529c7325a9839c0063b89e728d\n"
146
+ "gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
148
147
  }
@@ -1,4 +0,0 @@
1
- import type { Vec } from "@thi.ng/vectors";
2
- import type { Boid } from "../boid.js";
3
- export declare const mixedBehaviorUpdate: (boid: Boid) => Vec;
4
- //# sourceMappingURL=mixed.d.ts.map
@@ -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
- };
@@ -1,4 +0,0 @@
1
- import type { ReadonlyVec } from "@thi.ng/vectors";
2
- import type { ScalarOrField, IBoidBehavior } from "../api.js";
3
- export declare const followPath: (points: ReadonlyVec[], closed: boolean, weight?: ScalarOrField) => IBoidBehavior;
4
- //# sourceMappingURL=path.d.ts.map
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,4 +0,0 @@
1
- import type { Vec } from "@thi.ng/vectors";
2
- import type { Boid } from "../boid.js";
3
- export declare const probabilisticBehaviorUpdate: (boid: Boid) => Vec;
4
- //# sourceMappingURL=probabilistic.d.ts.map
@@ -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
- };