@thi.ng/geom 3.2.4 → 3.3.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 +10 -1
- package/aabb.d.ts +4 -1
- package/aabb.js +4 -0
- package/api/aabb.d.ts +1 -0
- package/api/aabb.js +7 -0
- package/api/rect.d.ts +1 -0
- package/api/rect.js +7 -0
- package/arc.d.ts +1 -1
- package/as-path.d.ts +1 -1
- package/bounds.d.ts +2 -2
- package/bounds.js +22 -17
- package/bpatch.d.ts +3 -3
- package/circle.d.ts +2 -2
- package/cubic.d.ts +2 -2
- package/group.d.ts +1 -1
- package/internal/bounds.d.ts +4 -4
- package/internal/bounds.js +4 -4
- package/internal/copy.d.ts +3 -1
- package/internal/copy.js +3 -0
- package/internal/dispatch.d.ts +2 -0
- package/internal/dispatch.js +2 -0
- package/internal/points-as-shape.d.ts +1 -1
- package/package.json +42 -33
- package/path-builder.d.ts +1 -1
- package/path.d.ts +3 -3
- package/plane.d.ts +3 -3
- package/points.d.ts +2 -2
- package/polygon.d.ts +2 -2
- package/polyline.d.ts +1 -1
- package/quad.d.ts +1 -1
- package/quadratic.d.ts +1 -1
- package/ray.d.ts +1 -1
- package/rect.d.ts +4 -2
- package/rect.js +2 -0
- package/sphere.d.ts +1 -1
- package/text.d.ts +1 -1
- package/triangle.d.ts +1 -1
- package/warp-points.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-
|
|
3
|
+
- **Last updated**: 2022-06-20T17:33:30Z
|
|
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,15 @@ 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
|
+
## [3.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@3.3.0) (2022-06-20)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update bounds() to support opt. margin ([8cdc372](https://github.com/thi-ng/umbrella/commit/8cdc372))
|
|
17
|
+
- update rect/aabb, add new factory fns ([f74e377](https://github.com/thi-ng/umbrella/commit/f74e377))
|
|
18
|
+
- add ...WithMargin() factory fns
|
|
19
|
+
- add AABBLike.offset() impls
|
|
20
|
+
|
|
12
21
|
### [3.2.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@3.2.1) (2022-04-07)
|
|
13
22
|
|
|
14
23
|
#### 🩹 Bug fixes
|
package/aabb.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ import type { Sphere } from "./api/sphere.js";
|
|
|
5
5
|
export declare function aabb(pos: Vec, size: number | Vec, attribs?: Attribs): AABB;
|
|
6
6
|
export declare function aabb(size: number | Vec, attribs?: Attribs): AABB;
|
|
7
7
|
export declare function aabb(attribs?: Attribs): AABB;
|
|
8
|
-
export declare const aabbFromMinMax: (min: Vec, max: Vec, attribs?: Attribs
|
|
8
|
+
export declare const aabbFromMinMax: (min: Vec, max: Vec, attribs?: Attribs) => AABB;
|
|
9
|
+
export declare const aabbFromMinMaxWithMargin: (min: Vec, max: Vec, margin: number, attribs?: Attribs) => AABB;
|
|
10
|
+
export declare const aabbFromCentroid: (centroid: Vec, size: Vec, attribs?: Attribs) => AABB;
|
|
11
|
+
export declare const aabbFromCentroidWithMargin: (centroid: Vec, size: Vec, margin: number, attribs?: Attribs) => AABB;
|
|
9
12
|
/**
|
|
10
13
|
* Returns the intersection AABB of given inputs or `undefined` if they
|
|
11
14
|
* are non-overlapping.
|
package/aabb.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SQRT2_2 } from "@thi.ng/math/api";
|
|
2
2
|
import { add3 } from "@thi.ng/vectors/add";
|
|
3
3
|
import { ZERO3 } from "@thi.ng/vectors/api";
|
|
4
|
+
import { maddN3 } from "@thi.ng/vectors/maddn";
|
|
4
5
|
import { max3 } from "@thi.ng/vectors/max";
|
|
5
6
|
import { min3 } from "@thi.ng/vectors/min";
|
|
6
7
|
import { sub3 } from "@thi.ng/vectors/sub";
|
|
@@ -11,6 +12,9 @@ export function aabb(...args) {
|
|
|
11
12
|
return new AABB(...__argsVV(args));
|
|
12
13
|
}
|
|
13
14
|
export const aabbFromMinMax = (min, max, attribs) => new AABB(min, sub3([], max, min), attribs);
|
|
15
|
+
export const aabbFromMinMaxWithMargin = (min, max, margin, attribs) => aabbFromMinMax(min, max, attribs).offset(margin);
|
|
16
|
+
export const aabbFromCentroid = (centroid, size, attribs) => new AABB(maddN3([], size, -0.5, centroid), size, attribs);
|
|
17
|
+
export const aabbFromCentroidWithMargin = (centroid, size, margin, attribs) => aabbFromCentroid(centroid, size, attribs).offset(margin);
|
|
14
18
|
/**
|
|
15
19
|
* Returns the intersection AABB of given inputs or `undefined` if they
|
|
16
20
|
* are non-overlapping.
|
package/api/aabb.d.ts
CHANGED
package/api/aabb.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isNumber } from "@thi.ng/checks/is-number";
|
|
2
2
|
import { add3 } from "@thi.ng/vectors/add";
|
|
3
|
+
import { addN3 } from "@thi.ng/vectors/addn";
|
|
3
4
|
import { set } from "@thi.ng/vectors/set";
|
|
5
|
+
import { subN3 } from "@thi.ng/vectors/subn";
|
|
4
6
|
import { __copyAttribs } from "../internal/copy.js";
|
|
5
7
|
export class AABB {
|
|
6
8
|
constructor(pos = [0, 0, 0], size = 1, attribs) {
|
|
@@ -17,4 +19,9 @@ export class AABB {
|
|
|
17
19
|
max() {
|
|
18
20
|
return add3([], this.pos, this.size);
|
|
19
21
|
}
|
|
22
|
+
offset(offset) {
|
|
23
|
+
subN3(null, this.pos, offset);
|
|
24
|
+
addN3(null, this.size, offset * 2);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
20
27
|
}
|
package/api/rect.d.ts
CHANGED
package/api/rect.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isNumber } from "@thi.ng/checks/is-number";
|
|
2
2
|
import { add2 } from "@thi.ng/vectors/add";
|
|
3
|
+
import { addN2 } from "@thi.ng/vectors/addn";
|
|
3
4
|
import { set2 } from "@thi.ng/vectors/set";
|
|
5
|
+
import { subN2 } from "@thi.ng/vectors/subn";
|
|
4
6
|
import { __copyAttribs } from "../internal/copy.js";
|
|
5
7
|
export class Rect {
|
|
6
8
|
constructor(pos = [0, 0], size = 1, attribs) {
|
|
@@ -17,6 +19,11 @@ export class Rect {
|
|
|
17
19
|
max() {
|
|
18
20
|
return add2([], this.pos, this.size);
|
|
19
21
|
}
|
|
22
|
+
offset(offset) {
|
|
23
|
+
subN2(null, this.pos, offset);
|
|
24
|
+
addN2(null, this.size, offset * 2);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
20
27
|
toHiccup() {
|
|
21
28
|
return ["rect", this.attribs, this.pos, this.size[0], this.size[1]];
|
|
22
29
|
}
|
package/arc.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { Attribs } from "@thi.ng/geom-api";
|
|
|
2
2
|
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
|
|
3
3
|
import { Arc } from "./api/arc.js";
|
|
4
4
|
export declare const arc: (pos: Vec, r: number | Vec, axis: number, start: number, end: number, xl?: boolean, clockwise?: boolean) => Arc;
|
|
5
|
-
export declare const arcFrom2Points: (a: ReadonlyVec, b: ReadonlyVec, radii: ReadonlyVec, axis?: number, xl?: boolean, cw?: boolean, attribs?: Attribs
|
|
5
|
+
export declare const arcFrom2Points: (a: ReadonlyVec, b: ReadonlyVec, radii: ReadonlyVec, axis?: number, xl?: boolean, cw?: boolean, attribs?: Attribs) => Arc | undefined;
|
|
6
6
|
//# sourceMappingURL=arc.d.ts.map
|
package/as-path.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Attribs, IShape } from "@thi.ng/geom-api";
|
|
2
|
-
export declare const asPath: (src: IShape, attribs?: Attribs
|
|
2
|
+
export declare const asPath: (src: IShape, attribs?: Attribs) => import("./index.js").Path;
|
|
3
3
|
//# sourceMappingURL=as-path.d.ts.map
|
package/bounds.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MultiFn1O } from "@thi.ng/defmulti";
|
|
2
2
|
import type { AABBLike, IShape } from "@thi.ng/geom-api";
|
|
3
|
-
export declare const bounds:
|
|
3
|
+
export declare const bounds: MultiFn1O<IShape, number, AABBLike | undefined>;
|
|
4
4
|
//# sourceMappingURL=bounds.d.ts.map
|
package/bounds.js
CHANGED
|
@@ -7,18 +7,18 @@ import { comp } from "@thi.ng/transducers/comp";
|
|
|
7
7
|
import { filter } from "@thi.ng/transducers/filter";
|
|
8
8
|
import { iterator1 } from "@thi.ng/transducers/iterator";
|
|
9
9
|
import { map } from "@thi.ng/transducers/map";
|
|
10
|
+
import { addN2 } from "@thi.ng/vectors/addn";
|
|
10
11
|
import { max } from "@thi.ng/vectors/max";
|
|
11
12
|
import { min } from "@thi.ng/vectors/min";
|
|
12
13
|
import { mul2 } from "@thi.ng/vectors/mul";
|
|
13
14
|
import { mulN2 } from "@thi.ng/vectors/muln";
|
|
14
|
-
import { set2 } from "@thi.ng/vectors/set";
|
|
15
15
|
import { sub2 } from "@thi.ng/vectors/sub";
|
|
16
16
|
import { subN2 } from "@thi.ng/vectors/subn";
|
|
17
|
-
import {
|
|
17
|
+
import { aabbFromMinMaxWithMargin } from "./aabb.js";
|
|
18
18
|
import { Rect } from "./api/rect.js";
|
|
19
19
|
import { __collBounds } from "./internal/bounds.js";
|
|
20
20
|
import { __dispatch } from "./internal/dispatch.js";
|
|
21
|
-
import {
|
|
21
|
+
import { rectFromMinMaxWithMargin } from "./rect.js";
|
|
22
22
|
export const bounds = defmulti(__dispatch, {
|
|
23
23
|
aabb: "rect",
|
|
24
24
|
bpatch: "points",
|
|
@@ -27,24 +27,29 @@ export const bounds = defmulti(__dispatch, {
|
|
|
27
27
|
quad: "points",
|
|
28
28
|
tri: "points",
|
|
29
29
|
}, {
|
|
30
|
-
arc: (
|
|
31
|
-
circle: (
|
|
32
|
-
cubic: ({ points }) =>
|
|
33
|
-
ellipse: (
|
|
34
|
-
|
|
30
|
+
arc: ($, margin = 0) => rectFromMinMaxWithMargin(...arcBounds($.pos, $.r, $.axis, $.start, $.end), margin),
|
|
31
|
+
circle: ($, margin = 0) => new Rect(subN2([], $.pos, $.r + margin), mulN2(null, [2, 2], $.r + margin)),
|
|
32
|
+
cubic: ({ points }, margin = 0) => rectFromMinMaxWithMargin(...cubicBounds(points[0], points[1], points[2], points[3]), margin),
|
|
33
|
+
ellipse: ($, margin = 0) => {
|
|
34
|
+
const r = addN2([], $.r, margin);
|
|
35
|
+
return new Rect(sub2([], $.pos, r), mul2(null, [2, 2], r));
|
|
36
|
+
},
|
|
37
|
+
group: ($, margin = 0) => {
|
|
35
38
|
const res = __collBounds($.children, bounds);
|
|
36
|
-
return res ? new Rect(...res) : undefined;
|
|
39
|
+
return res ? new Rect(...res).offset(margin) : undefined;
|
|
37
40
|
},
|
|
38
|
-
line: ({ points: [a, b] }) =>
|
|
39
|
-
path: (path) => {
|
|
41
|
+
line: ({ points: [a, b] }, margin = 0) => rectFromMinMaxWithMargin(min([], a, b), max([], a, b), margin),
|
|
42
|
+
path: (path, margin = 0) => {
|
|
40
43
|
const b = __collBounds([
|
|
41
44
|
...iterator1(comp(map((s) => s.geo), filter((s) => !!s)), path.segments),
|
|
42
45
|
], bounds);
|
|
43
|
-
return b ? new Rect(...b) : undefined;
|
|
46
|
+
return b ? new Rect(...b).offset(margin) : undefined;
|
|
44
47
|
},
|
|
45
|
-
points: (
|
|
46
|
-
points3: (
|
|
47
|
-
quadratic: ({ points }) =>
|
|
48
|
-
rect: (
|
|
49
|
-
|
|
48
|
+
points: ($, margin = 0) => rectFromMinMaxWithMargin(...bounds2($.points), margin),
|
|
49
|
+
points3: ($, margin = 0) => aabbFromMinMaxWithMargin(...bounds3($.points), margin),
|
|
50
|
+
quadratic: ({ points }, margin = 0) => rectFromMinMaxWithMargin(...quadraticBounds(points[0], points[1], points[2]), margin),
|
|
51
|
+
rect: ($, margin = 0) => margin === 0
|
|
52
|
+
? $.copy()
|
|
53
|
+
: $.copy().offset(margin),
|
|
54
|
+
text: ($, margin = 0) => new Rect(subN2([], $.pos, margin), [0, 0]), // TODO
|
|
50
55
|
});
|
package/bpatch.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Attribs } from "@thi.ng/geom-api";
|
|
2
2
|
import { Vec } from "@thi.ng/vectors";
|
|
3
3
|
import { BPatch } from "./api/bpatch.js";
|
|
4
|
-
export declare const bpatch: (pts: Vec[], attribs?: Attribs
|
|
5
|
-
export declare const bpatchFromQuad: (pts: Vec[], attribs?: Attribs
|
|
6
|
-
export declare const bpatchFromHex: (pts: Vec[], attribs?: Attribs
|
|
4
|
+
export declare const bpatch: (pts: Vec[], attribs?: Attribs) => BPatch;
|
|
5
|
+
export declare const bpatchFromQuad: (pts: Vec[], attribs?: Attribs) => BPatch;
|
|
6
|
+
export declare const bpatchFromHex: (pts: Vec[], attribs?: Attribs) => BPatch;
|
|
7
7
|
//# sourceMappingURL=bpatch.d.ts.map
|
package/circle.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export declare function circle(pos: Vec, r: number, attribs?: Attribs): Circle;
|
|
|
5
5
|
export declare function circle(pos: Vec, attribs?: Attribs): Circle;
|
|
6
6
|
export declare function circle(r: number, attribs?: Attribs): Circle;
|
|
7
7
|
export declare function circle(attribs?: Attribs): Circle;
|
|
8
|
-
export declare const circleFrom2Points: (a: ReadonlyVec, b: ReadonlyVec, attribs?: Attribs
|
|
9
|
-
export declare const circleFrom3Points: (a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, attribs?: Attribs
|
|
8
|
+
export declare const circleFrom2Points: (a: ReadonlyVec, b: ReadonlyVec, attribs?: Attribs) => Circle;
|
|
9
|
+
export declare const circleFrom3Points: (a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, attribs?: Attribs) => Circle | undefined;
|
|
10
10
|
//# sourceMappingURL=circle.d.ts.map
|
package/cubic.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import { Cubic } from "./api/cubic.js";
|
|
|
5
5
|
export declare function cubic(a: Vec, b: Vec, c: Vec, d: Vec, attribs?: Attribs): Cubic;
|
|
6
6
|
export declare function cubic(pts: Vec[], attribs?: Attribs): Cubic;
|
|
7
7
|
export declare const cubicFromArc: (arc: Arc) => Cubic[];
|
|
8
|
-
export declare const cubicFromLine: (a: Vec, b: Vec, attribs?: Attribs
|
|
9
|
-
export declare const cubicFromQuadratic: (a: Vec, b: Vec, c: Vec, attribs?: Attribs
|
|
8
|
+
export declare const cubicFromLine: (a: Vec, b: Vec, attribs?: Attribs) => Cubic;
|
|
9
|
+
export declare const cubicFromQuadratic: (a: Vec, b: Vec, c: Vec, attribs?: Attribs) => Cubic;
|
|
10
10
|
//# sourceMappingURL=cubic.d.ts.map
|
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[]
|
|
3
|
+
export declare const group: (attribs?: Attribs, children?: IHiccupShape[]) => Group;
|
|
4
4
|
//# sourceMappingURL=group.d.ts.map
|
package/internal/bounds.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import type { Fn } from "@thi.ng/api";
|
|
|
2
2
|
import type { AABBLike, IShape } from "@thi.ng/geom-api";
|
|
3
3
|
import type { ReadonlyVec, VecPair } from "@thi.ng/vectors";
|
|
4
4
|
/**
|
|
5
|
-
* Computes the total bounds for the given shape collection, which
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Computes the total bounds for the given shape collection, which should either
|
|
6
|
+
* contain only 2D or 3D types. No mixed dimensions are allowed! Currently the
|
|
7
|
+
* {@link bounds} function MUST be passed in as arg to avoid circular module
|
|
8
|
+
* dependencies. Returns 2-tuple of `[pos, size]`.
|
|
9
9
|
*
|
|
10
10
|
* @param shapes - input shapes
|
|
11
11
|
* @param bounds - bbox function
|
package/internal/bounds.js
CHANGED
|
@@ -3,10 +3,10 @@ import { max } from "@thi.ng/vectors/max";
|
|
|
3
3
|
import { min } from "@thi.ng/vectors/min";
|
|
4
4
|
import { sub } from "@thi.ng/vectors/sub";
|
|
5
5
|
/**
|
|
6
|
-
* Computes the total bounds for the given shape collection, which
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Computes the total bounds for the given shape collection, which should either
|
|
7
|
+
* contain only 2D or 3D types. No mixed dimensions are allowed! Currently the
|
|
8
|
+
* {@link bounds} function MUST be passed in as arg to avoid circular module
|
|
9
|
+
* dependencies. Returns 2-tuple of `[pos, size]`.
|
|
10
10
|
*
|
|
11
11
|
* @param shapes - input shapes
|
|
12
12
|
* @param bounds - bbox function
|
package/internal/copy.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Attribs, IShape, PCLike, PCLikeConstructor } from "@thi.ng/geom-api";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare const __copyAttribs: ($: IShape) => Attribs;
|
|
3
|
-
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare const __copyShape: <T extends PCLike>(ctor: PCLikeConstructor, inst: T) => T;
|
|
4
6
|
//# sourceMappingURL=copy.d.ts.map
|
package/internal/copy.js
CHANGED
package/internal/dispatch.d.ts
CHANGED
package/internal/dispatch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Attribs, PCLikeConstructor } from "@thi.ng/geom-api";
|
|
2
2
|
import type { Vec } from "@thi.ng/vectors";
|
|
3
|
-
export declare const __pointArraysAsShapes: (ctor: PCLikeConstructor, src?: Iterable<Vec[]
|
|
3
|
+
export declare const __pointArraysAsShapes: (ctor: PCLikeConstructor, src?: Iterable<Vec[]>, attribs?: Attribs) => import("@thi.ng/geom-api").PCLike[] | undefined;
|
|
4
4
|
//# sourceMappingURL=points-as-shape.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Functional, polymorphic API for 2D geometry types & SVG generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,41 +35,41 @@
|
|
|
35
35
|
"tool:bpatch": "tools:node-esm tools/bpatch.ts"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.3.
|
|
39
|
-
"@thi.ng/arrays": "^2.2.
|
|
40
|
-
"@thi.ng/associative": "^6.1.
|
|
41
|
-
"@thi.ng/checks": "^3.1
|
|
42
|
-
"@thi.ng/defmulti": "^2.1.
|
|
43
|
-
"@thi.ng/equiv": "^2.1.
|
|
44
|
-
"@thi.ng/errors": "^2.1.
|
|
45
|
-
"@thi.ng/geom-api": "^3.
|
|
46
|
-
"@thi.ng/geom-arc": "^2.1.
|
|
47
|
-
"@thi.ng/geom-clip-line": "^2.1.
|
|
48
|
-
"@thi.ng/geom-clip-poly": "^2.1.
|
|
49
|
-
"@thi.ng/geom-closest-point": "^2.1.
|
|
50
|
-
"@thi.ng/geom-hull": "^2.1.
|
|
51
|
-
"@thi.ng/geom-isec": "^2.1.
|
|
52
|
-
"@thi.ng/geom-poly-utils": "^2.2.
|
|
53
|
-
"@thi.ng/geom-resample": "^2.1.
|
|
54
|
-
"@thi.ng/geom-splines": "^2.1.
|
|
55
|
-
"@thi.ng/geom-subdiv-curve": "^2.1.
|
|
56
|
-
"@thi.ng/geom-tessellate": "^2.1.
|
|
57
|
-
"@thi.ng/hiccup": "^4.2.
|
|
58
|
-
"@thi.ng/hiccup-svg": "^4.
|
|
59
|
-
"@thi.ng/math": "^5.3.
|
|
60
|
-
"@thi.ng/matrices": "^2.1.
|
|
61
|
-
"@thi.ng/random": "^3.3.
|
|
62
|
-
"@thi.ng/strings": "^3.3.
|
|
63
|
-
"@thi.ng/transducers": "^8.3.
|
|
64
|
-
"@thi.ng/vectors": "^7.5.
|
|
38
|
+
"@thi.ng/api": "^8.3.7",
|
|
39
|
+
"@thi.ng/arrays": "^2.2.5",
|
|
40
|
+
"@thi.ng/associative": "^6.1.10",
|
|
41
|
+
"@thi.ng/checks": "^3.2.1",
|
|
42
|
+
"@thi.ng/defmulti": "^2.1.7",
|
|
43
|
+
"@thi.ng/equiv": "^2.1.7",
|
|
44
|
+
"@thi.ng/errors": "^2.1.7",
|
|
45
|
+
"@thi.ng/geom-api": "^3.2.0",
|
|
46
|
+
"@thi.ng/geom-arc": "^2.1.15",
|
|
47
|
+
"@thi.ng/geom-clip-line": "^2.1.15",
|
|
48
|
+
"@thi.ng/geom-clip-poly": "^2.1.15",
|
|
49
|
+
"@thi.ng/geom-closest-point": "^2.1.14",
|
|
50
|
+
"@thi.ng/geom-hull": "^2.1.14",
|
|
51
|
+
"@thi.ng/geom-isec": "^2.1.15",
|
|
52
|
+
"@thi.ng/geom-poly-utils": "^2.2.7",
|
|
53
|
+
"@thi.ng/geom-resample": "^2.1.15",
|
|
54
|
+
"@thi.ng/geom-splines": "^2.1.15",
|
|
55
|
+
"@thi.ng/geom-subdiv-curve": "^2.1.15",
|
|
56
|
+
"@thi.ng/geom-tessellate": "^2.1.15",
|
|
57
|
+
"@thi.ng/hiccup": "^4.2.9",
|
|
58
|
+
"@thi.ng/hiccup-svg": "^4.3.0",
|
|
59
|
+
"@thi.ng/math": "^5.3.3",
|
|
60
|
+
"@thi.ng/matrices": "^2.1.14",
|
|
61
|
+
"@thi.ng/random": "^3.3.2",
|
|
62
|
+
"@thi.ng/strings": "^3.3.5",
|
|
63
|
+
"@thi.ng/transducers": "^8.3.5",
|
|
64
|
+
"@thi.ng/vectors": "^7.5.6"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@microsoft/api-extractor": "^7.
|
|
68
|
-
"@thi.ng/testament": "^0.2.
|
|
67
|
+
"@microsoft/api-extractor": "^7.25.0",
|
|
68
|
+
"@thi.ng/testament": "^0.2.8",
|
|
69
69
|
"rimraf": "^3.0.2",
|
|
70
70
|
"tools": "^0.0.1",
|
|
71
|
-
"typedoc": "^0.22.
|
|
72
|
-
"typescript": "^4.
|
|
71
|
+
"typedoc": "^0.22.17",
|
|
72
|
+
"typescript": "^4.7.3"
|
|
73
73
|
},
|
|
74
74
|
"keywords": [
|
|
75
75
|
"2d",
|
|
@@ -247,6 +247,15 @@
|
|
|
247
247
|
"./group": {
|
|
248
248
|
"default": "./group.js"
|
|
249
249
|
},
|
|
250
|
+
"./internal/copy": {
|
|
251
|
+
"default": "./internal/copy.js"
|
|
252
|
+
},
|
|
253
|
+
"./internal/dispatch": {
|
|
254
|
+
"default": "./internal/dispatch.js"
|
|
255
|
+
},
|
|
256
|
+
"./internal/transform": {
|
|
257
|
+
"default": "./internal/transform.js"
|
|
258
|
+
},
|
|
250
259
|
"./intersects": {
|
|
251
260
|
"default": "./intersects.js"
|
|
252
261
|
},
|
|
@@ -362,5 +371,5 @@
|
|
|
362
371
|
"thi.ng": {
|
|
363
372
|
"year": 2013
|
|
364
373
|
},
|
|
365
|
-
"gitHead": "
|
|
374
|
+
"gitHead": "f50e292ecc7dc74a6705b07fc739bf827cc5efd7\n"
|
|
366
375
|
}
|
package/path-builder.d.ts
CHANGED
|
@@ -40,5 +40,5 @@ export declare class PathBuilder {
|
|
|
40
40
|
protected addCubic(cp1: Vec, cp2: Vec, p: Vec, relative: boolean): void;
|
|
41
41
|
protected addQuadratic(cp: Vec, p: Vec, relative: boolean): void;
|
|
42
42
|
}
|
|
43
|
-
export declare const pathBuilder: (attribs?: Attribs
|
|
43
|
+
export declare const pathBuilder: (attribs?: Attribs, opts?: Partial<PathBuilderOpts>) => PathBuilder;
|
|
44
44
|
//# sourceMappingURL=path-builder.d.ts.map
|
package/path.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ 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
|
|
6
|
-
export declare const pathFromCubics: (cubics: Cubic[], attribs?: Attribs
|
|
5
|
+
export declare const path: (segments: PathSegment[], attribs?: Attribs) => Path;
|
|
6
|
+
export declare const pathFromCubics: (cubics: Cubic[], attribs?: Attribs) => Path;
|
|
7
7
|
export declare const normalizedPath: (path: Path) => Path;
|
|
8
|
-
export declare const roundedRect: (pos: Vec, size: Vec, r: number | Vec, attribs?: Attribs
|
|
8
|
+
export declare const roundedRect: (pos: Vec, size: Vec, r: number | Vec, attribs?: Attribs) => Path;
|
|
9
9
|
//# sourceMappingURL=path.d.ts.map
|
package/plane.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 { Plane } from "./api/plane.js";
|
|
4
|
-
export declare const plane: (normal: Vec, w: number, attribs?: Attribs
|
|
5
|
-
export declare const planeWithPoint: (normal: Vec, p: ReadonlyVec, attribs?: Attribs
|
|
6
|
-
export declare const planeFrom3Points: (a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, attribs?: Attribs
|
|
4
|
+
export declare const plane: (normal: Vec, w: number, attribs?: Attribs) => Plane;
|
|
5
|
+
export declare const planeWithPoint: (normal: Vec, p: ReadonlyVec, attribs?: Attribs) => Plane;
|
|
6
|
+
export declare const planeFrom3Points: (a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, attribs?: Attribs) => Plane;
|
|
7
7
|
//# sourceMappingURL=plane.d.ts.map
|
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[]
|
|
5
|
-
export declare const points3: (pts?: Vec[]
|
|
4
|
+
export declare const points: (pts?: Vec[], attribs?: Attribs) => Points;
|
|
5
|
+
export declare const points3: (pts?: Vec[], attribs?: Attribs) => Points3;
|
|
6
6
|
//# sourceMappingURL=points.d.ts.map
|
package/polygon.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 { Polygon } from "./api/polygon.js";
|
|
4
|
-
export declare const polygon: (pts?: Vec[]
|
|
5
|
-
export declare const star: (r: number, n: number, profile: number[], attribs?: Attribs
|
|
4
|
+
export declare const polygon: (pts?: Vec[], attribs?: Attribs) => Polygon;
|
|
5
|
+
export declare const star: (r: number, n: number, profile: number[], attribs?: Attribs) => Polygon;
|
|
6
6
|
//# sourceMappingURL=polygon.d.ts.map
|
package/polyline.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Attribs } from "@thi.ng/geom-api";
|
|
2
2
|
import type { Vec } from "@thi.ng/vectors";
|
|
3
3
|
import { Polyline } from "./api/polyline.js";
|
|
4
|
-
export declare const polyline: (pts: Vec[], attribs?: Attribs
|
|
4
|
+
export declare const polyline: (pts: Vec[], attribs?: Attribs) => Polyline;
|
|
5
5
|
//# sourceMappingURL=polyline.d.ts.map
|
package/quad.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export declare function quad(a: Vec, b: Vec, c: Vec, d: Vec, attribs?: Attribs):
|
|
|
7
7
|
export declare function quad(pts: Vec[], attribs?: Attribs): Quad;
|
|
8
8
|
export declare function quad3(a: Vec, b: Vec, c: Vec, d: Vec, attribs?: Attribs): Quad;
|
|
9
9
|
export declare function quad3(pts: Vec[], attribs?: Attribs): Quad;
|
|
10
|
-
export declare const quadOnPlane: (plane: Plane, pos: ReadonlyVec, size: number | ReadonlyVec, attribs?: Attribs
|
|
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
|
@@ -3,5 +3,5 @@ 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
5
|
export declare function quadratic(pts: Vec[], attribs?: Attribs): Quadratic;
|
|
6
|
-
export declare const quadraticFromLine: (a: Vec, b: Vec, attribs?: Attribs
|
|
6
|
+
export declare const quadraticFromLine: (a: Vec, b: Vec, attribs?: Attribs) => Quadratic;
|
|
7
7
|
//# sourceMappingURL=quadratic.d.ts.map
|
package/ray.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Attribs } from "@thi.ng/geom-api";
|
|
2
2
|
import type { Vec } from "@thi.ng/vectors";
|
|
3
3
|
import { Ray } from "./api/ray.js";
|
|
4
|
-
export declare const ray: (pos: Vec, dir: Vec, attribs?: Attribs
|
|
4
|
+
export declare const ray: (pos: Vec, dir: Vec, attribs?: Attribs, normalize?: boolean) => Ray;
|
|
5
5
|
//# sourceMappingURL=ray.d.ts.map
|
package/rect.d.ts
CHANGED
|
@@ -6,8 +6,10 @@ import { Rect } from "./api/rect.js";
|
|
|
6
6
|
export declare function rect(pos: Vec, size: number | Vec, attribs?: Attribs): Rect;
|
|
7
7
|
export declare function rect(size: number | Vec, attribs?: Attribs): Rect;
|
|
8
8
|
export declare function rect(attribs?: Attribs): Rect;
|
|
9
|
-
export declare const rectFromMinMax: (min: Vec, max: Vec, attribs?: Attribs
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const rectFromMinMax: (min: Vec, max: Vec, attribs?: Attribs) => Rect;
|
|
10
|
+
export declare const rectFromMinMaxWithMargin: (min: Vec, max: Vec, margin: number, attribs?: Attribs) => Rect;
|
|
11
|
+
export declare const rectFromCentroid: (centroid: Vec, size: Vec, attribs?: Attribs) => Rect;
|
|
12
|
+
export declare const rectFromCentroidWithMargin: (centroid: Vec, size: Vec, margin: number, attribs?: Attribs) => Rect;
|
|
11
13
|
/**
|
|
12
14
|
* Returns the intersection rect of given inputs or `undefined` if they
|
|
13
15
|
* are non-overlapping.
|
package/rect.js
CHANGED
|
@@ -14,7 +14,9 @@ export function rect(...args) {
|
|
|
14
14
|
return new Rect(...__argsVV(args));
|
|
15
15
|
}
|
|
16
16
|
export const rectFromMinMax = (min, max, attribs) => new Rect(min, sub2([], max, min), attribs);
|
|
17
|
+
export const rectFromMinMaxWithMargin = (min, max, margin, attribs) => rectFromMinMax(min, max, attribs).offset(margin);
|
|
17
18
|
export const rectFromCentroid = (centroid, size, attribs) => new Rect(maddN2([], size, -0.5, centroid), size, attribs);
|
|
19
|
+
export const rectFromCentroidWithMargin = (centroid, size, margin, attribs) => rectFromCentroid(centroid, size, attribs).offset(margin);
|
|
18
20
|
/**
|
|
19
21
|
* Returns the intersection rect of given inputs or `undefined` if they
|
|
20
22
|
* are non-overlapping.
|
package/sphere.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export declare function sphere(pos: Vec, r: number, attribs?: Attribs): Sphere;
|
|
|
5
5
|
export declare function sphere(pos: Vec, attribs?: Attribs): Sphere;
|
|
6
6
|
export declare function sphere(r: number, attribs?: Attribs): Sphere;
|
|
7
7
|
export declare function sphere(attribs?: Attribs): Sphere;
|
|
8
|
-
export declare const sphereFrom2Points: (a: ReadonlyVec, b: ReadonlyVec, attribs?: Attribs
|
|
8
|
+
export declare const sphereFrom2Points: (a: ReadonlyVec, b: ReadonlyVec, attribs?: Attribs) => Sphere;
|
|
9
9
|
//# sourceMappingURL=sphere.d.ts.map
|
package/text.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Attribs } from "@thi.ng/geom-api";
|
|
2
2
|
import type { Vec } from "@thi.ng/vectors";
|
|
3
3
|
import { Text } from "./api/text.js";
|
|
4
|
-
export declare const text: (pos: Vec, body: any, attribs?: Attribs
|
|
4
|
+
export declare const text: (pos: Vec, body: any, attribs?: Attribs) => Text;
|
|
5
5
|
//# sourceMappingURL=text.d.ts.map
|
package/triangle.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ 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
5
|
export declare function triangle(pts: Vec[], attribs?: Attribs): Triangle;
|
|
6
|
-
export declare const equilateralTriangle: (a: Vec, b: Vec, attribs?: Attribs
|
|
6
|
+
export declare const equilateralTriangle: (a: Vec, b: Vec, attribs?: Attribs) => Triangle;
|
|
7
7
|
//# sourceMappingURL=triangle.d.ts.map
|
package/warp-points.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import type { ReadonlyVec, Vec } from "@thi.ng/vectors/api";
|
|
|
3
3
|
import type { BPatch } from "./api/bpatch.js";
|
|
4
4
|
import type { Rect } from "./api/rect.js";
|
|
5
5
|
export declare const warpPoints: (pts: ReadonlyVec[], dest: IShape, src: IShape) => Vec[];
|
|
6
|
-
export declare const warpPointsBPatch: (pts: ReadonlyVec[], dest: BPatch, src?: Rect
|
|
6
|
+
export declare const warpPointsBPatch: (pts: ReadonlyVec[], dest: BPatch, src?: Rect, out?: Vec[]) => Vec[];
|
|
7
7
|
//# sourceMappingURL=warp-points.d.ts.map
|