@thi.ng/geom 5.1.8 → 5.2.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-08-27T11:20:59Z
3
+ - **Last updated**: 2023-08-29T09:49:09Z
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,21 @@ 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
+ ## [5.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@5.2.0) (2023-08-29)
13
+
14
+ #### 🚀 Features
15
+
16
+ - update various shape ctors to accept iterables ([ae0cf5b](https://github.com/thi-ng/umbrella/commit/ae0cf5b))
17
+ - update shared APC ctor
18
+ - update other shape ctors: BPatch, Group, Path
19
+ - add assertions to verify vertex counts in these ctors:
20
+ - BPatch
21
+ - Cubic
22
+ - Line
23
+ - Quad/Quad3
24
+ - Quadratic
25
+ - Triangle
26
+
12
27
  ## [5.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@5.1.0) (2023-08-06)
13
28
 
14
29
  #### 🚀 Features
package/README.md CHANGED
@@ -200,7 +200,7 @@ For Node.js REPL:
200
200
  const geom = await import("@thi.ng/geom");
201
201
  ```
202
202
 
203
- Package sizes (brotli'd, pre-treeshake): ESM: 12.70 KB
203
+ Package sizes (brotli'd, pre-treeshake): ESM: 12.75 KB
204
204
 
205
205
  ## Dependencies
206
206
 
@@ -255,7 +255,7 @@ A selection:
255
255
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/kmeans-viz.jpg" width="240"/> | k-means clustering visualization | [Demo](https://demo.thi.ng/umbrella/kmeans-viz/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/kmeans-viz) |
256
256
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/poisson/poisson.jpg" width="240"/> | 2D Poisson-disc sampler with procedural gradient map | [Demo](https://demo.thi.ng/umbrella/poisson-circles/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poisson-circles) |
257
257
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-spline.png" width="240"/> | Polygon to cubic curve conversion & visualization | [Demo](https://demo.thi.ng/umbrella/poly-spline/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-spline) |
258
- | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-canvas-basics.png" width="240"/> | Minimal rdom-canvas animation | [Demo](https://demo.thi.ng/umbrella/rdom-canvas-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-canvas-basics) |
258
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-canvas-basics.jpg" width="240"/> | Minimal rdom-canvas animation | [Demo](https://demo.thi.ng/umbrella/rdom-canvas-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-canvas-basics) |
259
259
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rotating-voronoi.jpg" width="240"/> | Animated Voronoi diagram, cubic splines & SVG download | [Demo](https://demo.thi.ng/umbrella/rotating-voronoi/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rotating-voronoi) |
260
260
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/scenegraph.png" width="240"/> | 2D scenegraph & shape picking | [Demo](https://demo.thi.ng/umbrella/scenegraph/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/scenegraph) |
261
261
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/scenegraph-image.png" width="240"/> | 2D scenegraph & image map based geometry manipulation | [Demo](https://demo.thi.ng/umbrella/scenegraph-image/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/scenegraph-image) |
package/api/apc.d.ts CHANGED
@@ -2,9 +2,9 @@ import type { IClear } from "@thi.ng/api";
2
2
  import type { Attribs, PCLike } from "@thi.ng/geom-api";
3
3
  import type { Vec } from "@thi.ng/vectors";
4
4
  export declare abstract class APC implements IClear, PCLike {
5
- points: Vec[];
6
5
  attribs?: Attribs | undefined;
7
- constructor(points?: Vec[], attribs?: Attribs | undefined);
6
+ points: Vec[];
7
+ constructor(points?: Iterable<Vec>, attribs?: Attribs | undefined);
8
8
  abstract get type(): number | string;
9
9
  abstract copy(): APC;
10
10
  abstract withAttribs(attribs: Attribs): APC;
package/api/apc.js CHANGED
@@ -1,7 +1,8 @@
1
+ import { ensureArray } from "@thi.ng/arrays/ensure-array";
1
2
  export class APC {
2
- constructor(points = [], attribs) {
3
- this.points = points;
3
+ constructor(points, attribs) {
4
4
  this.attribs = attribs;
5
+ this.points = points ? ensureArray(points) : [];
5
6
  }
6
7
  *[Symbol.iterator]() {
7
8
  yield* this.points;
package/api/bpatch.d.ts CHANGED
@@ -28,7 +28,7 @@ import { APC } from "./apc.js";
28
28
  *
29
29
  */
30
30
  export declare class BPatch extends APC implements IHiccupShape {
31
- constructor(points: Vec[], attribs?: Attribs);
31
+ constructor(points: Iterable<Vec>, attribs?: Attribs);
32
32
  get type(): string;
33
33
  copy(): BPatch;
34
34
  withAttribs(attribs: Attribs): BPatch;
package/api/bpatch.js CHANGED
@@ -1,6 +1,6 @@
1
- import { assert } from "@thi.ng/errors/assert";
2
1
  import { mixCubic } from "@thi.ng/vectors/mix-cubic";
3
2
  import { __copyShape } from "../internal/copy.js";
3
+ import { __ensureNumVerts } from "../internal/pclike.js";
4
4
  import { APC } from "./apc.js";
5
5
  /**
6
6
  * nD Cubic bezier patch defined by array of 4x4 control points in this
@@ -30,8 +30,8 @@ import { APC } from "./apc.js";
30
30
  */
31
31
  export class BPatch extends APC {
32
32
  constructor(points, attribs) {
33
- assert(points.length === 16, "require 16 control points");
34
33
  super(points, attribs);
34
+ __ensureNumVerts(this.points.length, 16);
35
35
  }
36
36
  get type() {
37
37
  return "bpatch";
package/api/cubic.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import type { Attribs, IHiccupPathSegment } from "@thi.ng/geom-api";
2
+ import type { Vec } from "@thi.ng/vectors";
2
3
  import { APC } from "./apc.js";
3
4
  export declare class Cubic extends APC implements IHiccupPathSegment {
5
+ constructor(points: Iterable<Vec>, attribs?: Attribs);
4
6
  get type(): string;
5
7
  copy(): Cubic;
6
8
  withAttribs(attribs: Attribs): Cubic;
7
- toHiccup(): (string | Attribs | (string | import("@thi.ng/vectors").Vec)[][] | undefined)[];
8
- toHiccupPathSegments(): (string | import("@thi.ng/vectors").Vec)[][];
9
+ toHiccup(): (string | Attribs | (string | Vec)[][] | undefined)[];
10
+ toHiccupPathSegments(): (string | Vec)[][];
9
11
  }
10
12
  //# sourceMappingURL=cubic.d.ts.map
package/api/cubic.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { __copyShape } from "../internal/copy.js";
2
+ import { __ensureNumVerts } from "../internal/pclike.js";
2
3
  import { APC } from "./apc.js";
3
4
  export class Cubic extends APC {
5
+ constructor(points, attribs) {
6
+ super(points, attribs);
7
+ __ensureNumVerts(this.points.length, 4);
8
+ }
4
9
  get type() {
5
10
  return "cubic";
6
11
  }
package/api/group.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
7
7
  export declare class Group implements IClear, IHiccupShape {
8
8
  attribs?: Attribs | undefined;
9
9
  children: IHiccupShape[];
10
- constructor(attribs?: Attribs | undefined, children?: IHiccupShape[]);
10
+ constructor(attribs?: Attribs | undefined, children?: Iterable<IHiccupShape>);
11
11
  get type(): string;
12
12
  [Symbol.iterator](): Generator<IHiccupShape, void, undefined>;
13
13
  /**
package/api/group.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { ensureArray } from "@thi.ng/arrays/ensure-array";
1
2
  import { equiv } from "@thi.ng/equiv";
2
3
  import { __copyAttribs } from "../internal/copy.js";
3
4
  /**
@@ -5,9 +6,9 @@ import { __copyAttribs } from "../internal/copy.js";
5
6
  * groups.
6
7
  */
7
8
  export class Group {
8
- constructor(attribs, children = []) {
9
+ constructor(attribs, children) {
9
10
  this.attribs = attribs;
10
- this.children = children;
11
+ this.children = children ? ensureArray(children) : [];
11
12
  }
12
13
  get type() {
13
14
  return "group";
package/api/line.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import type { Attribs, IHiccupPathSegment, IHiccupShape } from "@thi.ng/geom-api";
2
+ import type { Vec } from "@thi.ng/vectors";
2
3
  import { APC } from "./apc.js";
3
4
  export declare class Line extends APC implements IHiccupShape, IHiccupPathSegment {
5
+ constructor(points: Iterable<Vec>, attribs?: Attribs);
4
6
  get type(): string;
5
7
  copy(): Line;
6
8
  withAttribs(attribs: Attribs): Line;
7
- toHiccup(): (string | import("@thi.ng/vectors").Vec | Attribs | undefined)[];
8
- toHiccupPathSegments(): ((string | number)[] | (string | import("@thi.ng/vectors").Vec)[])[];
9
+ toHiccup(): (string | Vec | Attribs | undefined)[];
10
+ toHiccupPathSegments(): ((string | number)[] | (string | Vec)[])[];
9
11
  }
10
12
  //# sourceMappingURL=line.d.ts.map
package/api/line.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { __copyShape } from "../internal/copy.js";
2
+ import { __ensureNumVerts } from "../internal/pclike.js";
2
3
  import { APC } from "./apc.js";
3
4
  export class Line extends APC {
5
+ constructor(points, attribs) {
6
+ super(points, attribs);
7
+ __ensureNumVerts(this.points.length, 2);
8
+ }
4
9
  get type() {
5
10
  return "line";
6
11
  }
package/api/path.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { IClear } from "@thi.ng/api";
2
2
  import type { Attribs, IHiccupShape, PathSegment } from "@thi.ng/geom-api";
3
3
  export declare class Path implements IClear, IHiccupShape {
4
- segments: PathSegment[];
5
4
  attribs?: Attribs | undefined;
5
+ segments: PathSegment[];
6
6
  closed: boolean;
7
- constructor(segments?: PathSegment[], attribs?: Attribs | undefined);
7
+ constructor(segments?: Iterable<PathSegment>, attribs?: Attribs | undefined);
8
8
  get type(): string;
9
9
  [Symbol.iterator](): Generator<PathSegment, void, undefined>;
10
10
  clear(): void;
package/api/path.js CHANGED
@@ -1,12 +1,13 @@
1
+ import { ensureArray } from "@thi.ng/arrays/ensure-array";
1
2
  import { equiv } from "@thi.ng/equiv";
2
3
  import { illegalState } from "@thi.ng/errors/illegal-state";
3
4
  import { copy } from "@thi.ng/vectors/copy";
4
5
  import { __copyAttribs } from "../internal/copy.js";
5
6
  export class Path {
6
- constructor(segments = [], attribs) {
7
- this.segments = segments;
7
+ constructor(segments, attribs) {
8
8
  this.attribs = attribs;
9
9
  this.closed = false;
10
+ this.segments = segments ? ensureArray(segments) : [];
10
11
  }
11
12
  get type() {
12
13
  return "path";
package/api/quad.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
2
+ import type { Vec } from "@thi.ng/vectors";
2
3
  import { APC } from "./apc.js";
3
4
  export declare class Quad extends APC implements IHiccupShape {
5
+ constructor(points: Iterable<Vec>, attribs?: Attribs);
4
6
  get type(): string;
5
7
  copy(): Quad;
6
8
  withAttribs(attribs: Attribs): Quad;
7
- toHiccup(): (string | import("@thi.ng/vectors").Vec[] | Attribs | undefined)[];
9
+ toHiccup(): (string | Vec[] | Attribs | undefined)[];
8
10
  }
9
11
  //# sourceMappingURL=quad.d.ts.map
package/api/quad.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { __copyShape } from "../internal/copy.js";
2
+ import { __ensureNumVerts } from "../internal/pclike.js";
2
3
  import { APC } from "./apc.js";
3
4
  export class Quad extends APC {
5
+ constructor(points, attribs) {
6
+ super(points, attribs);
7
+ __ensureNumVerts(this.points.length, 4);
8
+ }
4
9
  get type() {
5
10
  return "quad";
6
11
  }
package/api/quad3.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
2
+ import type { Vec } from "@thi.ng/vectors";
2
3
  import { APC } from "./apc.js";
3
4
  export declare class Quad3 extends APC implements IHiccupShape {
5
+ constructor(points: Iterable<Vec>, attribs?: Attribs);
4
6
  get type(): string;
5
7
  copy(): Quad3;
6
8
  withAttribs(attribs: Attribs): Quad3;
7
- toHiccup(): (string | import("@thi.ng/vectors").Vec[] | Attribs | undefined)[];
9
+ toHiccup(): (string | Vec[] | Attribs | undefined)[];
8
10
  }
9
11
  //# sourceMappingURL=quad3.d.ts.map
package/api/quad3.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { __copyShape } from "../internal/copy.js";
2
+ import { __ensureNumVerts } from "../internal/pclike.js";
2
3
  import { APC } from "./apc.js";
3
4
  export class Quad3 extends APC {
5
+ constructor(points, attribs) {
6
+ super(points, attribs);
7
+ __ensureNumVerts(this.points.length, 4);
8
+ }
4
9
  get type() {
5
10
  return "quad3";
6
11
  }
@@ -1,10 +1,12 @@
1
1
  import type { Attribs, IHiccupPathSegment, IHiccupShape } from "@thi.ng/geom-api";
2
+ import type { Vec } from "@thi.ng/vectors";
2
3
  import { APC } from "./apc.js";
3
4
  export declare class Quadratic extends APC implements IHiccupShape, IHiccupPathSegment {
5
+ constructor(points: Iterable<Vec>, attribs?: Attribs);
4
6
  get type(): string;
5
7
  copy(): Quadratic;
6
8
  withAttribs(attribs: Attribs): Quadratic;
7
- toHiccup(): (string | Attribs | (string | import("@thi.ng/vectors").Vec)[][] | undefined)[];
8
- toHiccupPathSegments(): (string | import("@thi.ng/vectors").Vec)[][];
9
+ toHiccup(): (string | Attribs | (string | Vec)[][] | undefined)[];
10
+ toHiccupPathSegments(): (string | Vec)[][];
9
11
  }
10
12
  //# sourceMappingURL=quadratic.d.ts.map
package/api/quadratic.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { __copyShape } from "../internal/copy.js";
2
+ import { __ensureNumVerts } from "../internal/pclike.js";
2
3
  import { APC } from "./apc.js";
3
4
  export class Quadratic extends APC {
5
+ constructor(points, attribs) {
6
+ super(points, attribs);
7
+ __ensureNumVerts(this.points.length, 3);
8
+ }
4
9
  get type() {
5
10
  return "quadratic";
6
11
  }
package/api/triangle.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
2
+ import type { Vec } from "@thi.ng/vectors";
2
3
  import { APC } from "./apc.js";
3
4
  export declare class Triangle extends APC implements IHiccupShape {
5
+ constructor(points: Iterable<Vec>, attribs?: Attribs);
4
6
  get type(): string;
5
7
  copy(): Triangle;
6
8
  withAttribs(attribs: Attribs): Triangle;
7
- toHiccup(): (string | import("@thi.ng/vectors").Vec[] | Attribs | undefined)[];
9
+ toHiccup(): (string | Vec[] | Attribs | undefined)[];
8
10
  }
9
11
  //# sourceMappingURL=triangle.d.ts.map
package/api/triangle.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { __copyShape } from "../internal/copy.js";
2
+ import { __ensureNumVerts } from "../internal/pclike.js";
2
3
  import { APC } from "./apc.js";
3
4
  export class Triangle extends APC {
5
+ constructor(points, attribs) {
6
+ super(points, attribs);
7
+ __ensureNumVerts(this.points.length, 3);
8
+ }
4
9
  get type() {
5
10
  return "tri";
6
11
  }
package/bpatch.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Attribs } from "@thi.ng/geom-api";
2
2
  import type { Vec } from "@thi.ng/vectors";
3
3
  import { BPatch } from "./api/bpatch.js";
4
- export declare const bpatch: (pts: Vec[], attribs?: Attribs) => BPatch;
4
+ export declare const bpatch: (pts: Iterable<Vec>, attribs?: Attribs) => BPatch;
5
5
  export declare const bpatchFromQuad: (pts: Vec[], attribs?: Attribs) => BPatch;
6
6
  export declare const bpatchFromHex: (pts: Vec[], attribs?: Attribs) => BPatch;
7
7
  //# sourceMappingURL=bpatch.d.ts.map
package/cubic.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { Vec } from "@thi.ng/vectors";
3
3
  import type { Arc } from "./api/arc.js";
4
4
  import { Cubic } from "./api/cubic.js";
5
5
  export declare function cubic(a: Vec, b: Vec, c: Vec, d: Vec, attribs?: Attribs): Cubic;
6
- export declare function cubic(pts: Vec[], attribs?: Attribs): Cubic;
6
+ export declare function cubic(pts: Iterable<Vec>, attribs?: Attribs): Cubic;
7
7
  export declare const cubicFromArc: (arc: Arc) => Cubic[];
8
8
  export declare const cubicFromLine: (a: Vec, b: Vec, attribs?: Attribs) => Cubic;
9
9
  export declare const cubicFromQuadratic: (a: Vec, b: Vec, c: Vec, attribs?: Attribs) => Cubic;
package/group.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
2
2
  import { Group } from "./api/group.js";
3
- export declare const group: (attribs?: Attribs, children?: IHiccupShape[]) => Group;
3
+ export declare const group: (attribs?: Attribs, children?: Iterable<IHiccupShape>) => Group;
4
4
  //# sourceMappingURL=group.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type { PCLikeConstructor } from "@thi.ng/geom-api";
2
2
  export declare const __pclike: (ctor: PCLikeConstructor, args: any[]) => import("@thi.ng/geom-api").PCLike;
3
+ export declare const __ensureNumVerts: (num: number, expected: number) => void;
3
4
  //# sourceMappingURL=pclike.d.ts.map
@@ -1,5 +1,7 @@
1
+ import { assert } from "@thi.ng/errors/assert";
1
2
  import { __argAttribs } from "./args.js";
2
3
  export const __pclike = (ctor, args) => {
3
4
  const attr = __argAttribs(args);
4
5
  return new ctor(args.length === 1 ? args[0] : args, attr);
5
6
  };
7
+ export const __ensureNumVerts = (num, expected) => assert(num === expected, `require ${expected} points`);
package/line.d.ts CHANGED
@@ -3,6 +3,6 @@ import type { Vec, VecPair } from "@thi.ng/vectors";
3
3
  import { Line } from "./api/line.js";
4
4
  import { Rect } from "./api/rect.js";
5
5
  export declare function line(a: Vec, b: Vec, attribs?: Attribs): Line;
6
- export declare function line(pts: Vec[], attribs?: Attribs): Line;
6
+ export declare function line(pts: Iterable<Vec>, attribs?: Attribs): Line;
7
7
  export declare const clippedLine: (l: Line, bounds: VecPair | Rect) => Line | undefined;
8
8
  //# sourceMappingURL=line.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/geom",
3
- "version": "5.1.8",
3
+ "version": "5.2.0",
4
4
  "description": "Functional, polymorphic API for 2D geometry types & SVG generation",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -37,31 +37,31 @@
37
37
  "dependencies": {
38
38
  "@thi.ng/api": "^8.9.5",
39
39
  "@thi.ng/arrays": "^2.5.21",
40
- "@thi.ng/associative": "^6.3.2",
40
+ "@thi.ng/associative": "^6.3.3",
41
41
  "@thi.ng/checks": "^3.4.5",
42
42
  "@thi.ng/defmulti": "^2.1.44",
43
43
  "@thi.ng/equiv": "^2.1.30",
44
44
  "@thi.ng/errors": "^2.3.5",
45
- "@thi.ng/geom-api": "^3.4.28",
46
- "@thi.ng/geom-arc": "^2.1.71",
47
- "@thi.ng/geom-clip-line": "^2.3.28",
48
- "@thi.ng/geom-clip-poly": "^2.1.70",
49
- "@thi.ng/geom-closest-point": "^2.1.66",
50
- "@thi.ng/geom-hull": "^2.1.66",
51
- "@thi.ng/geom-isec": "^2.1.70",
52
- "@thi.ng/geom-poly-utils": "^2.3.54",
53
- "@thi.ng/geom-resample": "^2.2.28",
54
- "@thi.ng/geom-splines": "^2.2.45",
55
- "@thi.ng/geom-subdiv-curve": "^2.1.70",
56
- "@thi.ng/geom-tessellate": "^2.1.70",
57
- "@thi.ng/hiccup": "^4.3.0",
58
- "@thi.ng/hiccup-svg": "^5.0.15",
45
+ "@thi.ng/geom-api": "^3.4.29",
46
+ "@thi.ng/geom-arc": "^2.1.72",
47
+ "@thi.ng/geom-clip-line": "^2.3.29",
48
+ "@thi.ng/geom-clip-poly": "^2.1.71",
49
+ "@thi.ng/geom-closest-point": "^2.1.67",
50
+ "@thi.ng/geom-hull": "^2.1.67",
51
+ "@thi.ng/geom-isec": "^2.1.71",
52
+ "@thi.ng/geom-poly-utils": "^2.3.55",
53
+ "@thi.ng/geom-resample": "^2.2.29",
54
+ "@thi.ng/geom-splines": "^2.2.46",
55
+ "@thi.ng/geom-subdiv-curve": "^2.1.71",
56
+ "@thi.ng/geom-tessellate": "^2.1.71",
57
+ "@thi.ng/hiccup": "^4.3.1",
58
+ "@thi.ng/hiccup-svg": "^5.0.17",
59
59
  "@thi.ng/math": "^5.6.1",
60
- "@thi.ng/matrices": "^2.1.67",
60
+ "@thi.ng/matrices": "^2.1.68",
61
61
  "@thi.ng/random": "^3.6.3",
62
62
  "@thi.ng/strings": "^3.4.13",
63
- "@thi.ng/transducers": "^8.6.2",
64
- "@thi.ng/vectors": "^7.7.10"
63
+ "@thi.ng/transducers": "^8.6.3",
64
+ "@thi.ng/vectors": "^7.7.11"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@microsoft/api-extractor": "^7.36.4",
@@ -398,5 +398,5 @@
398
398
  ],
399
399
  "year": 2013
400
400
  },
401
- "gitHead": "5929dd20497668496af13415cdf784a4d6f69aa3\n"
401
+ "gitHead": "9dec130cc636c1da0bc4f2baa0d995579d3b7629\n"
402
402
  }
package/path.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { Attribs, PathSegment } from "@thi.ng/geom-api";
2
2
  import type { Vec } from "@thi.ng/vectors";
3
3
  import type { Cubic } from "./api/cubic.js";
4
4
  import { Path } from "./api/path.js";
5
- export declare const path: (segments: PathSegment[], attribs?: Attribs) => Path;
5
+ export declare const path: (segments: Iterable<PathSegment>, attribs?: Attribs) => Path;
6
6
  export declare const pathFromCubics: (cubics: Cubic[], attribs?: Attribs) => Path;
7
7
  export declare const normalizedPath: (path: Path) => Path;
8
8
  export declare const roundedRect: (pos: Vec, size: Vec, r: number | Vec, attribs?: Attribs) => Path;
package/path.js CHANGED
@@ -14,11 +14,9 @@ export const pathFromCubics = (cubics, attribs) => {
14
14
  }
15
15
  return path;
16
16
  };
17
- export const normalizedPath = (path) => new Path([
18
- ...mapcat((s) => s.geo
19
- ? map((c) => ({ type: "c", geo: c }), asCubic(s.geo))
20
- : [{ ...s }], path.segments),
21
- ], path.attribs);
17
+ export const normalizedPath = (path) => new Path(mapcat((s) => s.geo
18
+ ? map((c) => ({ type: "c", geo: c }), asCubic(s.geo))
19
+ : [{ ...s }], path.segments), path.attribs);
22
20
  export const roundedRect = (pos, size, r, attribs) => {
23
21
  r = isNumber(r) ? [r, r] : r;
24
22
  const [w, h] = maddN2([], r, -2, size);
package/points.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Attribs } from "@thi.ng/geom-api";
2
2
  import type { Vec } from "@thi.ng/vectors";
3
3
  import { Points, Points3 } from "./api/points.js";
4
- export declare const points: (pts?: Vec[], attribs?: Attribs) => Points;
5
- export declare const points3: (pts?: Vec[], attribs?: Attribs) => Points3;
4
+ export declare const points: (pts?: Iterable<Vec>, attribs?: Attribs) => Points;
5
+ export declare const points3: (pts?: Iterable<Vec>, attribs?: Attribs) => Points3;
6
6
  //# sourceMappingURL=points.d.ts.map
package/polygon.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Attribs } from "@thi.ng/geom-api";
2
2
  import type { Vec } from "@thi.ng/vectors";
3
3
  import { Polygon } from "./api/polygon.js";
4
- export declare const polygon: (pts?: Vec[], attribs?: Attribs) => Polygon;
4
+ export declare const polygon: (pts?: Iterable<Vec>, attribs?: Attribs) => Polygon;
5
5
  /**
6
6
  * Syntax sugar for {@link starWithCentroid}, using [0,0] as center.
7
7
  *
package/polyline.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Attribs } from "@thi.ng/geom-api";
2
2
  import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
3
3
  import { Polyline } from "./api/polyline.js";
4
- export declare const polyline: (pts: Vec[], attribs?: Attribs) => Polyline;
4
+ export declare const polyline: (pts: Iterable<Vec>, attribs?: Attribs) => Polyline;
5
5
  /**
6
6
  * Creates a polyline spiral from given params. The number of twists is defined
7
7
  * by the angle range. Resolution depends on angle range and number of steps.
package/quad.d.ts CHANGED
@@ -4,8 +4,8 @@ import type { Plane } from "./api/plane.js";
4
4
  import { Quad } from "./api/quad.js";
5
5
  import { Quad3 } from "./api/quad3.js";
6
6
  export declare function quad(a: Vec, b: Vec, c: Vec, d: Vec, attribs?: Attribs): Quad;
7
- export declare function quad(pts: Vec[], attribs?: Attribs): Quad;
7
+ export declare function quad(pts: Iterable<Vec>, attribs?: Attribs): Quad;
8
8
  export declare function quad3(a: Vec, b: Vec, c: Vec, d: Vec, attribs?: Attribs): Quad;
9
- export declare function quad3(pts: Vec[], attribs?: Attribs): Quad;
9
+ export declare function quad3(pts: Iterable<Vec>, attribs?: Attribs): Quad;
10
10
  export declare const quadOnPlane: (plane: Plane, pos: ReadonlyVec, size: number | ReadonlyVec, attribs?: Attribs) => Quad3;
11
11
  //# sourceMappingURL=quad.d.ts.map
package/quadratic.d.ts CHANGED
@@ -2,6 +2,6 @@ import type { Attribs } from "@thi.ng/geom-api";
2
2
  import type { Vec } from "@thi.ng/vectors";
3
3
  import { Quadratic } from "./api/quadratic.js";
4
4
  export declare function quadratic(a: Vec, b: Vec, c: Vec, attribs?: Attribs): Quadratic;
5
- export declare function quadratic(pts: Vec[], attribs?: Attribs): Quadratic;
5
+ export declare function quadratic(pts: Iterable<Vec>, attribs?: Attribs): Quadratic;
6
6
  export declare const quadraticFromLine: (a: Vec, b: Vec, attribs?: Attribs) => Quadratic;
7
7
  //# sourceMappingURL=quadratic.d.ts.map
package/triangle.d.ts CHANGED
@@ -2,6 +2,6 @@ import type { Attribs } from "@thi.ng/geom-api";
2
2
  import type { Vec } from "@thi.ng/vectors";
3
3
  import { Triangle } from "./api/triangle.js";
4
4
  export declare function triangle(a: Vec, b: Vec, c: Vec, attribs?: Attribs): Triangle;
5
- export declare function triangle(pts: Vec[], attribs?: Attribs): Triangle;
5
+ export declare function triangle(pts: Iterable<Vec>, attribs?: Attribs): Triangle;
6
6
  export declare const equilateralTriangle: (a: Vec, b: Vec, attribs?: Attribs) => Triangle;
7
7
  //# sourceMappingURL=triangle.d.ts.map