@thi.ng/geom 4.0.1 → 4.1.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 +9 -1
- package/README.md +2 -2
- package/api/text.d.ts +3 -2
- package/api/text.js +3 -2
- package/as-polygon.d.ts +2 -1
- package/as-polygon.js +2 -1
- package/as-polyline.d.ts +2 -1
- package/as-polyline.js +2 -1
- package/as-svg.d.ts +16 -4
- package/as-svg.js +23 -4
- package/classify-point.d.ts +3 -3
- package/classify-point.js +3 -3
- package/clip-convex.d.ts +3 -2
- package/clip-convex.js +3 -2
- package/convex-hull.d.ts +2 -1
- package/convex-hull.js +2 -1
- package/edges.d.ts +1 -1
- package/edges.js +1 -1
- package/internal/bounds.d.ts +2 -2
- package/internal/bounds.js +2 -2
- package/intersects.d.ts +1 -1
- package/intersects.js +1 -1
- package/offset.d.ts +2 -1
- package/offset.js +2 -1
- package/package.json +30 -30
- package/scatter.d.ts +4 -2
- package/scatter.js +4 -2
- package/simplify.d.ts +4 -2
- package/simplify.js +4 -2
- package/subdiv-curve.d.ts +5 -3
- package/subdiv-curve.js +5 -3
- package/tessellate.d.ts +4 -2
- package/tessellate.js +4 -2
- package/vertices.d.ts +2 -1
- package/vertices.js +2 -1
- package/with-attribs.d.ts +3 -2
- package/with-attribs.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-12-
|
|
3
|
+
- **Last updated**: 2022-12-22T21:47:07Z
|
|
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,14 @@ 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
|
+
## [4.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@4.1.0) (2022-12-22)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add SVG default attribs & setter ([3cb07a6](https://github.com/thi-ng/umbrella/commit/3cb07a6))
|
|
17
|
+
- set defaults to no fill & black stroke
|
|
18
|
+
- add setSvgDefaultAttribs()
|
|
19
|
+
|
|
12
20
|
# [4.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@4.0.0) (2022-12-10)
|
|
13
21
|
|
|
14
22
|
#### 🛑 Breaking changes
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ For the Clojure version, please visit: [thi.ng/geom-clj](https://thi.ng/geom-clj
|
|
|
27
27
|
|
|
28
28
|
## About
|
|
29
29
|
|
|
30
|
-
Functional, polymorphic API for 2D geometry types & SVG generation
|
|
30
|
+
Functional, polymorphic API for 2D geometry types & SVG generation.
|
|
31
31
|
|
|
32
32
|
This project is a partially ported from the [Clojure version of the same
|
|
33
33
|
name](http://thi.ng/geom-clj). All polymorphic operations built on
|
|
@@ -186,7 +186,7 @@ For Node.js REPL:
|
|
|
186
186
|
const geom = await import("@thi.ng/geom");
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
189
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 12.03 KB
|
|
190
190
|
|
|
191
191
|
## Dependencies
|
|
192
192
|
|
package/api/text.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ import type { Vec } from "@thi.ng/vectors";
|
|
|
3
3
|
/**
|
|
4
4
|
* Basic stub for text elements. Currently, only a minimal set of geometry
|
|
5
5
|
* operations are implemented for this type, however this type implements
|
|
6
|
-
*
|
|
7
|
-
* text elements in {@link Group}s with
|
|
6
|
+
* [`IToHiccup`](https://docs.thi.ng/umbrella/api/interfaces/IToHiccup.html) and
|
|
7
|
+
* so is useful as wrapper for inclusion of text elements in {@link Group}s with
|
|
8
|
+
* other shape types.
|
|
8
9
|
*/
|
|
9
10
|
export declare class Text implements IHiccupShape {
|
|
10
11
|
pos: Vec;
|
package/api/text.js
CHANGED
|
@@ -3,8 +3,9 @@ import { __copyAttribs } from "../internal/copy.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Basic stub for text elements. Currently, only a minimal set of geometry
|
|
5
5
|
* operations are implemented for this type, however this type implements
|
|
6
|
-
*
|
|
7
|
-
* text elements in {@link Group}s with
|
|
6
|
+
* [`IToHiccup`](https://docs.thi.ng/umbrella/api/interfaces/IToHiccup.html) and
|
|
7
|
+
* so is useful as wrapper for inclusion of text elements in {@link Group}s with
|
|
8
|
+
* other shape types.
|
|
8
9
|
*/
|
|
9
10
|
export class Text {
|
|
10
11
|
constructor(pos, body, attribs) {
|
package/as-polygon.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { IShape, SamplingOpts } from "@thi.ng/geom-api";
|
|
|
3
3
|
import { Polygon } from "./api/polygon.js";
|
|
4
4
|
/**
|
|
5
5
|
* Converts given shape into a {@link Polygon}, optionally using provided
|
|
6
|
-
*
|
|
6
|
+
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom-api/interfaces/SamplingOpts.html)
|
|
7
|
+
* or number of target vertices.
|
|
7
8
|
*
|
|
8
9
|
* @remarks
|
|
9
10
|
* Currently implemented for:
|
package/as-polygon.js
CHANGED
|
@@ -5,7 +5,8 @@ import { __dispatch } from "./internal/dispatch.js";
|
|
|
5
5
|
import { vertices } from "./vertices.js";
|
|
6
6
|
/**
|
|
7
7
|
* Converts given shape into a {@link Polygon}, optionally using provided
|
|
8
|
-
*
|
|
8
|
+
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom-api/interfaces/SamplingOpts.html)
|
|
9
|
+
* or number of target vertices.
|
|
9
10
|
*
|
|
10
11
|
* @remarks
|
|
11
12
|
* Currently implemented for:
|
package/as-polyline.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { IShape, SamplingOpts } from "@thi.ng/geom-api";
|
|
|
3
3
|
import { Polyline } from "./api/polyline.js";
|
|
4
4
|
/**
|
|
5
5
|
* Converts given shape into a {@link Polyline}, optionally using provided
|
|
6
|
-
*
|
|
6
|
+
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom-api/interfaces/SamplingOpts.html)
|
|
7
|
+
* or number of target vertices.
|
|
7
8
|
*
|
|
8
9
|
* @remarks
|
|
9
10
|
* Currently implemented for:
|
package/as-polyline.js
CHANGED
|
@@ -6,7 +6,8 @@ import { __dispatch } from "./internal/dispatch.js";
|
|
|
6
6
|
import { vertices } from "./vertices.js";
|
|
7
7
|
/**
|
|
8
8
|
* Converts given shape into a {@link Polyline}, optionally using provided
|
|
9
|
-
*
|
|
9
|
+
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom-api/interfaces/SamplingOpts.html)
|
|
10
|
+
* or number of target vertices.
|
|
10
11
|
*
|
|
11
12
|
* @remarks
|
|
12
13
|
* Currently implemented for:
|
package/as-svg.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import type { Attribs, IShape } from "@thi.ng/geom-api";
|
|
2
|
+
/**
|
|
3
|
+
* Sets the SVG root element attribs used by default by {@link svgDoc}.
|
|
4
|
+
*
|
|
5
|
+
* @param attribs
|
|
6
|
+
*/
|
|
7
|
+
export declare const setSvgDefaultAttribs: (attribs: Attribs) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Serializes given hiccup tree to an actual SVG source string.
|
|
10
|
+
*
|
|
11
|
+
* @param args
|
|
12
|
+
*/
|
|
2
13
|
export declare const asSvg: (...args: any[]) => string;
|
|
3
14
|
/**
|
|
4
|
-
* Creates a hiccup SVG doc element for given {@link IShape}s and attribs
|
|
5
|
-
* the attribs do not include a `viewBox`, it
|
|
6
|
-
* Furthermore (and only for the case a viewbox
|
|
7
|
-
* attrib can be provided to include a
|
|
15
|
+
* Creates a hiccup SVG doc element for given {@link IShape}s and attribs
|
|
16
|
+
* (merged with default attribs). If the attribs do not include a `viewBox`, it
|
|
17
|
+
* will be computed automatically. Furthermore (and only for the case a viewbox
|
|
18
|
+
* needs to be computed), a `bleed` attrib can be provided to include a
|
|
19
|
+
* bleed/margin for the viewbox.
|
|
8
20
|
*
|
|
9
21
|
* @remarks
|
|
10
22
|
* Use {@link asSvg} to serialize the resulting doc to an SVG string.
|
package/as-svg.js
CHANGED
|
@@ -5,12 +5,30 @@ import { svg } from "@thi.ng/hiccup-svg/svg";
|
|
|
5
5
|
import { serialize } from "@thi.ng/hiccup/serialize";
|
|
6
6
|
import { bounds } from "./bounds.js";
|
|
7
7
|
import { __collBounds } from "./internal/bounds.js";
|
|
8
|
+
/**
|
|
9
|
+
* Can be overridden via {@link setSvgDefaultAttribs}.
|
|
10
|
+
*/
|
|
11
|
+
let DEFAULT_ATTRIBS = { fill: "none", stroke: "#000" };
|
|
12
|
+
/**
|
|
13
|
+
* Sets the SVG root element attribs used by default by {@link svgDoc}.
|
|
14
|
+
*
|
|
15
|
+
* @param attribs
|
|
16
|
+
*/
|
|
17
|
+
export const setSvgDefaultAttribs = (attribs) => {
|
|
18
|
+
DEFAULT_ATTRIBS = attribs;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Serializes given hiccup tree to an actual SVG source string.
|
|
22
|
+
*
|
|
23
|
+
* @param args
|
|
24
|
+
*/
|
|
8
25
|
export const asSvg = (...args) => args.map((x) => serialize(convertTree(x))).join("");
|
|
9
26
|
/**
|
|
10
|
-
* Creates a hiccup SVG doc element for given {@link IShape}s and attribs
|
|
11
|
-
* the attribs do not include a `viewBox`, it
|
|
12
|
-
* Furthermore (and only for the case a viewbox
|
|
13
|
-
* attrib can be provided to include a
|
|
27
|
+
* Creates a hiccup SVG doc element for given {@link IShape}s and attribs
|
|
28
|
+
* (merged with default attribs). If the attribs do not include a `viewBox`, it
|
|
29
|
+
* will be computed automatically. Furthermore (and only for the case a viewbox
|
|
30
|
+
* needs to be computed), a `bleed` attrib can be provided to include a
|
|
31
|
+
* bleed/margin for the viewbox.
|
|
14
32
|
*
|
|
15
33
|
* @remarks
|
|
16
34
|
* Use {@link asSvg} to serialize the resulting doc to an SVG string.
|
|
@@ -19,6 +37,7 @@ export const asSvg = (...args) => args.map((x) => serialize(convertTree(x))).joi
|
|
|
19
37
|
* @param xs
|
|
20
38
|
*/
|
|
21
39
|
export const svgDoc = (attribs, ...xs) => {
|
|
40
|
+
attribs = { ...DEFAULT_ATTRIBS, ...attribs };
|
|
22
41
|
if (xs.length > 0) {
|
|
23
42
|
if (!attribs.viewBox) {
|
|
24
43
|
const cbounds = __collBounds(xs, bounds);
|
package/classify-point.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ import type { ReadonlyVec } from "@thi.ng/vectors";
|
|
|
14
14
|
* - {@link Sphere}
|
|
15
15
|
* - {@link Triangle}
|
|
16
16
|
*
|
|
17
|
-
* The
|
|
18
|
-
* feature set (incl. support for more shapes) to perform
|
|
19
|
-
* function.
|
|
17
|
+
* The [thi.ng/geom-sdf](https://thi.ng/thi.ng/geom-sdf) package provides a much
|
|
18
|
+
* more comprehensive feature set (incl. support for more shapes) to perform
|
|
19
|
+
* similar checks as this function.
|
|
20
20
|
*
|
|
21
21
|
* Also see {@link pointInside}.
|
|
22
22
|
*
|
package/classify-point.js
CHANGED
|
@@ -17,9 +17,9 @@ import { __dispatch } from "./internal/dispatch.js";
|
|
|
17
17
|
* - {@link Sphere}
|
|
18
18
|
* - {@link Triangle}
|
|
19
19
|
*
|
|
20
|
-
* The
|
|
21
|
-
* feature set (incl. support for more shapes) to perform
|
|
22
|
-
* function.
|
|
20
|
+
* The [thi.ng/geom-sdf](https://thi.ng/thi.ng/geom-sdf) package provides a much
|
|
21
|
+
* more comprehensive feature set (incl. support for more shapes) to perform
|
|
22
|
+
* similar checks as this function.
|
|
23
23
|
*
|
|
24
24
|
* Also see {@link pointInside}.
|
|
25
25
|
*
|
package/clip-convex.d.ts
CHANGED
|
@@ -7,8 +7,9 @@ import type { ReadonlyVec } from "@thi.ng/vectors";
|
|
|
7
7
|
* boundary). Returns `undefined` if there're no remaining result vertices.
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
|
-
* Internally uses
|
|
11
|
-
*
|
|
10
|
+
* Internally uses
|
|
11
|
+
* [`sutherlandHodgeman()`](https://docs.thi.ng/umbrella/geom-clip-poly/functions/sutherlandHodgeman.html).
|
|
12
|
+
* For groups, calls itself for each child shape individually and returns a new
|
|
12
13
|
* group of results (if any).
|
|
13
14
|
*
|
|
14
15
|
* @param shape
|
package/clip-convex.js
CHANGED
|
@@ -14,8 +14,9 @@ import { ensureVertices, vertices } from "./vertices.js";
|
|
|
14
14
|
* boundary). Returns `undefined` if there're no remaining result vertices.
|
|
15
15
|
*
|
|
16
16
|
* @remarks
|
|
17
|
-
* Internally uses
|
|
18
|
-
*
|
|
17
|
+
* Internally uses
|
|
18
|
+
* [`sutherlandHodgeman()`](https://docs.thi.ng/umbrella/geom-clip-poly/functions/sutherlandHodgeman.html).
|
|
19
|
+
* For groups, calls itself for each child shape individually and returns a new
|
|
19
20
|
* group of results (if any).
|
|
20
21
|
*
|
|
21
22
|
* @param shape
|
package/convex-hull.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import type { IShape } from "@thi.ng/geom-api";
|
|
|
4
4
|
* Computes the convex hull for given shape and returns it as {@link Polygon}.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
|
-
* Internally uses
|
|
7
|
+
* Internally uses
|
|
8
|
+
* [`grahamScan2()`](https://docs.thi.ng/umbrella/geom-hull/functions/grahamScan2.html).
|
|
8
9
|
*
|
|
9
10
|
* Currently implemented for:
|
|
10
11
|
*
|
package/convex-hull.js
CHANGED
|
@@ -8,7 +8,8 @@ import { vertices } from "./vertices.js";
|
|
|
8
8
|
* Computes the convex hull for given shape and returns it as {@link Polygon}.
|
|
9
9
|
*
|
|
10
10
|
* @remarks
|
|
11
|
-
* Internally uses
|
|
11
|
+
* Internally uses
|
|
12
|
+
* [`grahamScan2()`](https://docs.thi.ng/umbrella/geom-hull/functions/grahamScan2.html).
|
|
12
13
|
*
|
|
13
14
|
* Currently implemented for:
|
|
14
15
|
*
|
package/edges.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { VecPair } from "@thi.ng/vectors";
|
|
|
4
4
|
/**
|
|
5
5
|
* Extracts the edges of given shape's boundary and returns them as an iterable
|
|
6
6
|
* of vector pairs. Some shapes also support
|
|
7
|
-
*
|
|
7
|
+
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom-api/interfaces/SamplingOpts.html).
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
10
|
* Currently implemented for:
|
package/edges.js
CHANGED
|
@@ -7,7 +7,7 @@ import { vertices } from "./vertices.js";
|
|
|
7
7
|
/**
|
|
8
8
|
* Extracts the edges of given shape's boundary and returns them as an iterable
|
|
9
9
|
* of vector pairs. Some shapes also support
|
|
10
|
-
*
|
|
10
|
+
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom-api/interfaces/SamplingOpts.html).
|
|
11
11
|
*
|
|
12
12
|
* @remarks
|
|
13
13
|
* Currently implemented for:
|
package/internal/bounds.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ import type { ReadonlyVec, VecPair } from "@thi.ng/vectors";
|
|
|
13
13
|
export declare const __collBounds: (shapes: IShape[], bounds: Fn<IShape, AABBLike | undefined>) => import("@thi.ng/vectors").Vec[] | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* Takes the position and size vectors of 2
|
|
16
|
-
*
|
|
17
|
-
* `[pos,size]` of their union bounds.
|
|
16
|
+
* [`AABBLike`](https://docs.thi.ng/umbrella/geom-api/interfaces/AABBLike.html)s
|
|
17
|
+
* and returns 2-tuple of `[pos,size]` of their union bounds.
|
|
18
18
|
*
|
|
19
19
|
* @param apos - bbox 1 min pos
|
|
20
20
|
* @param asize - bbox1 size
|
package/internal/bounds.js
CHANGED
|
@@ -29,8 +29,8 @@ export const __collBounds = (shapes, bounds) => {
|
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Takes the position and size vectors of 2
|
|
32
|
-
*
|
|
33
|
-
* `[pos,size]` of their union bounds.
|
|
32
|
+
* [`AABBLike`](https://docs.thi.ng/umbrella/geom-api/interfaces/AABBLike.html)s
|
|
33
|
+
* and returns 2-tuple of `[pos,size]` of their union bounds.
|
|
34
34
|
*
|
|
35
35
|
* @param apos - bbox 1 min pos
|
|
36
36
|
* @param asize - bbox1 size
|
package/intersects.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { MultiFn2 } from "@thi.ng/defmulti";
|
|
|
2
2
|
import type { IntersectionResult, IShape } from "@thi.ng/geom-api";
|
|
3
3
|
/**
|
|
4
4
|
* Performs intersection tests on given 2 shapes and returns
|
|
5
|
-
*
|
|
5
|
+
* [`IntersectionResult`](https://docs.thi.ng/umbrella/geom-api/interfaces/IntersectionResult.html).
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
8
|
* Currently supported pairs:
|
package/intersects.js
CHANGED
|
@@ -12,7 +12,7 @@ import { testAabbAabb, testRectRect } from "@thi.ng/geom-isec/rect-rect";
|
|
|
12
12
|
import { __dispatch2 } from "./internal/dispatch.js";
|
|
13
13
|
/**
|
|
14
14
|
* Performs intersection tests on given 2 shapes and returns
|
|
15
|
-
*
|
|
15
|
+
* [`IntersectionResult`](https://docs.thi.ng/umbrella/geom-api/interfaces/IntersectionResult.html).
|
|
16
16
|
*
|
|
17
17
|
* @remarks
|
|
18
18
|
* Currently supported pairs:
|
package/offset.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import type { IShape } from "@thi.ng/geom-api";
|
|
|
5
5
|
* distance `dist`.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* Also see
|
|
8
|
+
* Also see [thi.ng/geom-sdf](https://thi.ng/thi.ng/geom-sdf) package for more
|
|
9
|
+
* flexible & advanced usage.
|
|
9
10
|
*
|
|
10
11
|
* Currently only implemented for:
|
|
11
12
|
*
|
package/offset.js
CHANGED
|
@@ -15,7 +15,8 @@ import { rectWithCentroidAndMargin } from "./rect.js";
|
|
|
15
15
|
* distance `dist`.
|
|
16
16
|
*
|
|
17
17
|
* @remarks
|
|
18
|
-
* Also see
|
|
18
|
+
* Also see [thi.ng/geom-sdf](https://thi.ng/thi.ng/geom-sdf) package for more
|
|
19
|
+
* flexible & advanced usage.
|
|
19
20
|
*
|
|
20
21
|
* Currently only implemented for:
|
|
21
22
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Functional, polymorphic API for 2D geometry types & SVG generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,37 +35,37 @@
|
|
|
35
35
|
"tool:bpatch": "tools:node-esm tools/bpatch.ts"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.6.
|
|
39
|
-
"@thi.ng/arrays": "^2.4.
|
|
40
|
-
"@thi.ng/associative": "^6.2.
|
|
41
|
-
"@thi.ng/checks": "^3.3.
|
|
42
|
-
"@thi.ng/defmulti": "^2.1.
|
|
43
|
-
"@thi.ng/equiv": "^2.1.
|
|
44
|
-
"@thi.ng/errors": "^2.2.
|
|
45
|
-
"@thi.ng/geom-api": "^3.3.
|
|
46
|
-
"@thi.ng/geom-arc": "^2.1.
|
|
47
|
-
"@thi.ng/geom-clip-line": "^2.2.
|
|
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.3.
|
|
53
|
-
"@thi.ng/geom-resample": "^2.1.
|
|
54
|
-
"@thi.ng/geom-splines": "^2.2.
|
|
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.3.
|
|
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.6.2",
|
|
39
|
+
"@thi.ng/arrays": "^2.4.7",
|
|
40
|
+
"@thi.ng/associative": "^6.2.21",
|
|
41
|
+
"@thi.ng/checks": "^3.3.6",
|
|
42
|
+
"@thi.ng/defmulti": "^2.1.26",
|
|
43
|
+
"@thi.ng/equiv": "^2.1.16",
|
|
44
|
+
"@thi.ng/errors": "^2.2.7",
|
|
45
|
+
"@thi.ng/geom-api": "^3.3.23",
|
|
46
|
+
"@thi.ng/geom-arc": "^2.1.41",
|
|
47
|
+
"@thi.ng/geom-clip-line": "^2.2.3",
|
|
48
|
+
"@thi.ng/geom-clip-poly": "^2.1.40",
|
|
49
|
+
"@thi.ng/geom-closest-point": "^2.1.37",
|
|
50
|
+
"@thi.ng/geom-hull": "^2.1.37",
|
|
51
|
+
"@thi.ng/geom-isec": "^2.1.40",
|
|
52
|
+
"@thi.ng/geom-poly-utils": "^2.3.24",
|
|
53
|
+
"@thi.ng/geom-resample": "^2.1.41",
|
|
54
|
+
"@thi.ng/geom-splines": "^2.2.15",
|
|
55
|
+
"@thi.ng/geom-subdiv-curve": "^2.1.40",
|
|
56
|
+
"@thi.ng/geom-tessellate": "^2.1.40",
|
|
57
|
+
"@thi.ng/hiccup": "^4.2.28",
|
|
58
|
+
"@thi.ng/hiccup-svg": "^4.3.26",
|
|
59
|
+
"@thi.ng/math": "^5.3.18",
|
|
60
|
+
"@thi.ng/matrices": "^2.1.38",
|
|
61
|
+
"@thi.ng/random": "^3.3.20",
|
|
62
|
+
"@thi.ng/strings": "^3.3.22",
|
|
63
|
+
"@thi.ng/transducers": "^8.3.28",
|
|
64
|
+
"@thi.ng/vectors": "^7.5.29"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@microsoft/api-extractor": "^7.33.7",
|
|
68
|
-
"@thi.ng/testament": "^0.3.
|
|
68
|
+
"@thi.ng/testament": "^0.3.8",
|
|
69
69
|
"rimraf": "^3.0.2",
|
|
70
70
|
"tools": "^0.0.1",
|
|
71
71
|
"typedoc": "^0.23.22",
|
|
@@ -383,5 +383,5 @@
|
|
|
383
383
|
"thi.ng": {
|
|
384
384
|
"year": 2013
|
|
385
385
|
},
|
|
386
|
-
"gitHead": "
|
|
386
|
+
"gitHead": "bc6f7f5e2765bb96fe64db804eaf4b2443b47fc6\n"
|
|
387
387
|
}
|
package/scatter.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { IShape } from "@thi.ng/geom-api";
|
|
2
2
|
import type { Vec } from "@thi.ng/vectors";
|
|
3
3
|
/**
|
|
4
|
-
* Produces `num` random points for which {@link pointInside}
|
|
4
|
+
* Produces `num` random points for which {@link pointInside} succeeds for the
|
|
5
5
|
* given `shape`. Writes results into `out` array (or creates a new one).
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
8
|
* Samples are only created with the shapes bounding box and are chosen using
|
|
9
|
-
*
|
|
9
|
+
* optionally provided `rnd`
|
|
10
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
11
|
+
* instance.
|
|
10
12
|
*
|
|
11
13
|
* @param shape
|
|
12
14
|
* @param num
|
package/scatter.js
CHANGED
|
@@ -3,12 +3,14 @@ import { randMinMax } from "@thi.ng/vectors/random";
|
|
|
3
3
|
import { bounds } from "./bounds.js";
|
|
4
4
|
import { pointInside } from "./point-inside.js";
|
|
5
5
|
/**
|
|
6
|
-
* Produces `num` random points for which {@link pointInside}
|
|
6
|
+
* Produces `num` random points for which {@link pointInside} succeeds for the
|
|
7
7
|
* given `shape`. Writes results into `out` array (or creates a new one).
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
10
|
* Samples are only created with the shapes bounding box and are chosen using
|
|
11
|
-
*
|
|
11
|
+
* optionally provided `rnd`
|
|
12
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html)
|
|
13
|
+
* instance.
|
|
12
14
|
*
|
|
13
15
|
* @param shape
|
|
14
16
|
* @param num
|
package/simplify.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import type { MultiFn2 } from "@thi.ng/defmulti";
|
|
|
2
2
|
import type { IShape } from "@thi.ng/geom-api";
|
|
3
3
|
/**
|
|
4
4
|
* Simplifies given 2D shape boundary using Douglas-Peucker algorithm
|
|
5
|
-
* (implemented by
|
|
6
|
-
*
|
|
5
|
+
* (implemented by
|
|
6
|
+
* [`simplify()`](https://docs.thi.ng/umbrella/geom-resample/functions/simplify.html))
|
|
7
|
+
* and given `threshold` distance (default: 0, which removes only co-linear
|
|
8
|
+
* vertices).
|
|
7
9
|
*
|
|
8
10
|
* @remarks
|
|
9
11
|
* Currently only implemented for:
|
package/simplify.js
CHANGED
|
@@ -9,8 +9,10 @@ import { __dispatch } from "./internal/dispatch.js";
|
|
|
9
9
|
import { vertices } from "./vertices.js";
|
|
10
10
|
/**
|
|
11
11
|
* Simplifies given 2D shape boundary using Douglas-Peucker algorithm
|
|
12
|
-
* (implemented by
|
|
13
|
-
*
|
|
12
|
+
* (implemented by
|
|
13
|
+
* [`simplify()`](https://docs.thi.ng/umbrella/geom-resample/functions/simplify.html))
|
|
14
|
+
* and given `threshold` distance (default: 0, which removes only co-linear
|
|
15
|
+
* vertices).
|
|
14
16
|
*
|
|
15
17
|
* @remarks
|
|
16
18
|
* Currently only implemented for:
|
package/subdiv-curve.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { MultiFn2O } from "@thi.ng/defmulti";
|
|
2
2
|
import type { IShape, SubdivKernel } from "@thi.ng/geom-api";
|
|
3
3
|
/**
|
|
4
|
-
* Recursively applies
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Recursively applies
|
|
5
|
+
* [`SubdivKernel`](https://docs.thi.ng/umbrella/geom-api/interfaces/SubdivKernel.html)
|
|
6
|
+
* to given shape/boundary. See
|
|
7
|
+
* [thi.ng/geom-subdiv-curve](https://thi.ng/thi.ng/geom-subdiv-curve) package
|
|
8
|
+
* for further details.
|
|
7
9
|
*
|
|
8
10
|
* @remarks
|
|
9
11
|
* By default only applies a single iteration.
|
package/subdiv-curve.js
CHANGED
|
@@ -5,9 +5,11 @@ import { Polyline } from "./api/polyline.js";
|
|
|
5
5
|
import { __copyAttribs } from "./internal/copy.js";
|
|
6
6
|
import { __dispatch } from "./internal/dispatch.js";
|
|
7
7
|
/**
|
|
8
|
-
* Recursively applies
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Recursively applies
|
|
9
|
+
* [`SubdivKernel`](https://docs.thi.ng/umbrella/geom-api/interfaces/SubdivKernel.html)
|
|
10
|
+
* to given shape/boundary. See
|
|
11
|
+
* [thi.ng/geom-subdiv-curve](https://thi.ng/thi.ng/geom-subdiv-curve) package
|
|
12
|
+
* for further details.
|
|
11
13
|
*
|
|
12
14
|
* @remarks
|
|
13
15
|
* By default only applies a single iteration.
|
package/tessellate.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import type { IShape, Tessellator } from "@thi.ng/geom-api";
|
|
|
2
2
|
import type { Vec } from "@thi.ng/vectors";
|
|
3
3
|
/**
|
|
4
4
|
* Recursively tessellates shape using provided
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* [`Tessellator`](https://docs.thi.ng/umbrella/geom-api/types/Tessellator.html)
|
|
6
|
+
* functions. See
|
|
7
|
+
* [thi.ng/geom-tessellate](https://thi.ng/thi.ng/geom-tessellate) package for
|
|
8
|
+
* more details.
|
|
7
9
|
*
|
|
8
10
|
* @remarks
|
|
9
11
|
* Implemented for all shapes supported by {@link vertices}.
|
package/tessellate.js
CHANGED
|
@@ -4,8 +4,10 @@ import { __dispatch } from "./internal/dispatch.js";
|
|
|
4
4
|
import { vertices } from "./vertices.js";
|
|
5
5
|
/**
|
|
6
6
|
* Recursively tessellates shape using provided
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* [`Tessellator`](https://docs.thi.ng/umbrella/geom-api/types/Tessellator.html)
|
|
8
|
+
* functions. See
|
|
9
|
+
* [thi.ng/geom-tessellate](https://thi.ng/thi.ng/geom-tessellate) package for
|
|
10
|
+
* more details.
|
|
9
11
|
*
|
|
10
12
|
* @remarks
|
|
11
13
|
* Implemented for all shapes supported by {@link vertices}.
|
package/vertices.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { SamplingOpts } from "@thi.ng/geom-api/sample";
|
|
|
4
4
|
import type { Vec } from "@thi.ng/vectors";
|
|
5
5
|
/**
|
|
6
6
|
* Extracts/samples vertices from given shape's boundary and returns them as
|
|
7
|
-
* array. Some shapes also support
|
|
7
|
+
* array. Some shapes also support
|
|
8
|
+
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom-api/interfaces/SamplingOpts.html).
|
|
8
9
|
*
|
|
9
10
|
* @remarks
|
|
10
11
|
* The given sampling options (if any) can also be overridden per shape using
|
package/vertices.js
CHANGED
|
@@ -16,7 +16,8 @@ import { Polygon } from "./api/polygon.js";
|
|
|
16
16
|
import { __dispatch } from "./internal/dispatch.js";
|
|
17
17
|
/**
|
|
18
18
|
* Extracts/samples vertices from given shape's boundary and returns them as
|
|
19
|
-
* array. Some shapes also support
|
|
19
|
+
* array. Some shapes also support
|
|
20
|
+
* [`SamplingOpts`](https://docs.thi.ng/umbrella/geom-api/interfaces/SamplingOpts.html).
|
|
20
21
|
*
|
|
21
22
|
* @remarks
|
|
22
23
|
* The given sampling options (if any) can also be overridden per shape using
|
package/with-attribs.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Attribs, IShape } from "@thi.ng/geom-api";
|
|
2
2
|
/**
|
|
3
3
|
* Returns a shallow copy of given shape with new `attribs` assigned (using
|
|
4
|
-
*
|
|
5
|
-
* new attribs will be merged with the existing ones
|
|
4
|
+
* [`IAttributed`](https://docs.thi.ng/umbrella/geom-api/interfaces/IAttributed.html).withAttribs}).
|
|
5
|
+
* If `replace` is false, the new attribs will be merged with the existing ones
|
|
6
|
+
* (if any).
|
|
6
7
|
*
|
|
7
8
|
* @param shape
|
|
8
9
|
* @param attribs
|
package/with-attribs.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns a shallow copy of given shape with new `attribs` assigned (using
|
|
3
|
-
*
|
|
4
|
-
* new attribs will be merged with the existing ones
|
|
3
|
+
* [`IAttributed`](https://docs.thi.ng/umbrella/geom-api/interfaces/IAttributed.html).withAttribs}).
|
|
4
|
+
* If `replace` is false, the new attribs will be merged with the existing ones
|
|
5
|
+
* (if any).
|
|
5
6
|
*
|
|
6
7
|
* @param shape
|
|
7
8
|
* @param attribs
|