@thi.ng/geom 3.3.1 → 3.4.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 +18 -1
- package/README.md +51 -5
- package/api/aabb.d.ts +2 -1
- package/api/aabb.js +6 -1
- package/api/apc.d.ts +3 -2
- package/api/arc.d.ts +1 -0
- package/api/arc.js +3 -0
- package/api/bpatch.d.ts +3 -2
- package/api/bpatch.js +3 -0
- package/api/circle.d.ts +1 -0
- package/api/circle.js +3 -0
- package/api/cubic.d.ts +3 -2
- package/api/cubic.js +3 -0
- package/api/ellipse.d.ts +1 -0
- package/api/ellipse.js +3 -0
- package/api/group.d.ts +1 -0
- package/api/group.js +3 -0
- package/api/line.d.ts +3 -2
- package/api/line.js +3 -0
- package/api/path.d.ts +1 -0
- package/api/path.js +5 -0
- package/api/plane.d.ts +1 -0
- package/api/plane.js +3 -0
- package/api/points.d.ts +5 -3
- package/api/points.js +6 -0
- package/api/polygon.d.ts +3 -2
- package/api/polygon.js +3 -0
- package/api/polyline.d.ts +2 -1
- package/api/polyline.js +3 -0
- package/api/quad.d.ts +3 -2
- package/api/quad.js +3 -0
- package/api/quad3.d.ts +3 -2
- package/api/quad3.js +3 -0
- package/api/quadratic.d.ts +3 -2
- package/api/quadratic.js +3 -0
- package/api/ray.d.ts +1 -0
- package/api/ray.js +3 -0
- package/api/rect.d.ts +2 -1
- package/api/rect.js +6 -1
- package/api/sphere.d.ts +1 -0
- package/api/sphere.js +3 -0
- package/api/text.d.ts +1 -0
- package/api/text.js +3 -0
- package/api/triangle.d.ts +3 -2
- package/api/triangle.js +3 -0
- package/apply-transforms.d.ts +33 -0
- package/apply-transforms.js +59 -0
- package/arc-length.d.ts +10 -9
- package/arc-length.js +11 -10
- package/area.d.ts +24 -23
- package/area.js +26 -23
- package/as-cubic.d.ts +36 -0
- package/as-cubic.js +45 -4
- package/as-path.d.ts +7 -0
- package/as-path.js +7 -0
- package/as-polygon.d.ts +20 -0
- package/as-polygon.js +20 -0
- package/as-polyline.d.ts +23 -0
- package/as-polyline.js +23 -0
- package/bounds.d.ts +28 -0
- package/bounds.js +29 -1
- package/center.d.ts +11 -0
- package/center.js +11 -0
- package/centroid.d.ts +27 -0
- package/centroid.js +32 -4
- package/classify-point.d.ts +23 -0
- package/classify-point.js +23 -0
- package/clip-convex.d.ts +13 -0
- package/clip-convex.js +16 -1
- package/closest-point.d.ts +26 -0
- package/closest-point.js +27 -0
- package/convex-hull.d.ts +21 -0
- package/convex-hull.js +27 -2
- package/edges.d.ts +26 -0
- package/edges.js +35 -0
- package/fit-into-bounds.d.ts +22 -3
- package/fit-into-bounds.js +25 -5
- package/flip.d.ts +23 -0
- package/flip.js +23 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/internal/rotate.d.ts +5 -0
- package/internal/rotate.js +4 -0
- package/internal/scale.d.ts +5 -0
- package/internal/scale.js +6 -0
- package/intersects.d.ts +27 -2
- package/intersects.js +31 -1
- package/map-point.d.ts +15 -0
- package/map-point.js +15 -0
- package/offset.d.ts +17 -0
- package/offset.js +21 -5
- package/package.json +21 -12
- package/point-at.d.ts +25 -0
- package/point-at.js +25 -0
- package/point-inside.d.ts +19 -0
- package/point-inside.js +19 -0
- package/resample.d.ts +19 -0
- package/resample.js +19 -0
- package/rotate.d.ts +30 -0
- package/rotate.js +79 -0
- package/scale.d.ts +37 -0
- package/scale.js +112 -0
- package/scatter.d.ts +13 -0
- package/scatter.js +13 -0
- package/simplify.d.ts +18 -0
- package/simplify.js +21 -3
- package/split-at.d.ts +15 -0
- package/split-at.js +15 -0
- package/split-near.d.ts +6 -6
- package/split-near.js +6 -6
- package/subdiv-curve.d.ts +17 -0
- package/subdiv-curve.js +17 -0
- package/tangent-at.d.ts +19 -0
- package/tangent-at.js +19 -0
- package/tessellate.d.ts +12 -1
- package/tessellate.js +11 -0
- package/transform-vertices.d.ts +35 -10
- package/transform-vertices.js +35 -10
- package/transform.d.ts +34 -8
- package/transform.js +36 -10
- package/translate.d.ts +29 -0
- package/translate.js +29 -0
- package/union.d.ts +10 -0
- package/union.js +10 -0
- package/unmap-point.d.ts +10 -7
- package/unmap-point.js +10 -7
- package/vertices.d.ts +29 -2
- package/vertices.js +33 -5
- package/volume.d.ts +5 -2
- package/volume.js +5 -2
- package/warp-points.d.ts +15 -1
- package/warp-points.js +17 -4
- package/with-attribs.d.ts +10 -1
- package/with-attribs.js +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-06-
|
|
3
|
+
- **Last updated**: 2022-06-28T13:48:51Z
|
|
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,23 @@ 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.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@3.4.0) (2022-06-28)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add AABB support for intersects() ([768dddd](https://github.com/thi-ng/umbrella/commit/768dddd))
|
|
17
|
+
- update warpPoints() args, add docs ([50cb467](https://github.com/thi-ng/umbrella/commit/50cb467))
|
|
18
|
+
- update edges(), support more types ([3e1b340](https://github.com/thi-ng/umbrella/commit/3e1b340))
|
|
19
|
+
- add new transform ops & helpers ([cd8217c](https://github.com/thi-ng/umbrella/commit/cd8217c))
|
|
20
|
+
- add applyTransforms(), rotate(), scale()
|
|
21
|
+
- add internal helpers
|
|
22
|
+
- update transform() rect coercion (now => Quad, previous Polygon)
|
|
23
|
+
- add IAttributed impls for all shape types ([ccb40f1](https://github.com/thi-ng/umbrella/commit/ccb40f1))
|
|
24
|
+
|
|
25
|
+
#### 🩹 Bug fixes
|
|
26
|
+
|
|
27
|
+
- update AABB/Rect.offset(), clamp size to zero ([620121d](https://github.com/thi-ng/umbrella/commit/620121d))
|
|
28
|
+
|
|
12
29
|
### [3.3.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@3.3.1) (2022-06-23)
|
|
13
30
|
|
|
14
31
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -29,11 +29,57 @@ This project is a partially ported from the [Clojure version of the same
|
|
|
29
29
|
name](http://thi.ng/geom-clj). All polymorphic operations built on
|
|
30
30
|
[@thi.ng/defmulti](https://github.com/thi-ng/umbrella/tree/develop/packages/defmulti).
|
|
31
31
|
|
|
32
|
+
<!--
|
|
32
33
|
[**Up-to-date feature matrix spreadsheet**](https://docs.google.com/spreadsheets/d/1GxJm-zOQaGECui2MJUmy3gQPTF-T6BJ6vhNlUnPsmDs/edit?usp=sharing)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
-->
|
|
35
|
+
|
|
36
|
+
The following operations are provided (many also applicable to shape groups
|
|
37
|
+
directly and/or perform automatic resampling/conversion if needed):
|
|
38
|
+
|
|
39
|
+
| Operation | Description |
|
|
40
|
+
|-------------------------------------------------------------------------------------------|--------------------------------------------------------------|
|
|
41
|
+
| [`arcLength()`](https://docs.thi.ng/umbrella/geom/modules.html#arcLength) | compute arc length / perimeter of shape boundary |
|
|
42
|
+
| [`area()`](https://docs.thi.ng/umbrella/geom/modules.html#area) | signed/unsigned surface area |
|
|
43
|
+
| [`asCubic()`](https://docs.thi.ng/umbrella/geom/modules.html#asCubic) | convert shape boundary to cubic bezier segments |
|
|
44
|
+
| [`asPath()`](https://docs.thi.ng/umbrella/geom/modules.html#asPath) | convert shape to path |
|
|
45
|
+
| [`asPolygon()`](https://docs.thi.ng/umbrella/geom/modules.html#asPolygon) | convert shape to polygon |
|
|
46
|
+
| [`asPolyline()`](https://docs.thi.ng/umbrella/geom/modules.html#asPolyline) | convert shape to polyline |
|
|
47
|
+
| [`asSvg()`](https://docs.thi.ng/umbrella/geom/modules.html#asSvg) | serialize shape/group/hierarchy to SVG |
|
|
48
|
+
| [`bounds()`](https://docs.thi.ng/umbrella/geom/modules.html#bounds) | compute bounding box |
|
|
49
|
+
| [`center()`](https://docs.thi.ng/umbrella/geom/modules.html#center) | center shape around origin or point |
|
|
50
|
+
| [`centroid()`](https://docs.thi.ng/umbrella/geom/modules.html#centroid) | compute shape centroid |
|
|
51
|
+
| [`classifyPoint()`](https://docs.thi.ng/umbrella/geom/modules.html#classifyPoint) | classify point in relation to shape boundary (in/out) |
|
|
52
|
+
| [`clipConvex()`](https://docs.thi.ng/umbrella/geom/modules.html#clipConvex) | clip shape against convex boundary |
|
|
53
|
+
| [`closestPoint()`](https://docs.thi.ng/umbrella/geom/modules.html#closestPoint) | compute closest point on shape boundary |
|
|
54
|
+
| [`convexHull()`](https://docs.thi.ng/umbrella/geom/modules.html#convexHull) | compute convex hull (2d only) |
|
|
55
|
+
| [`edges()`](https://docs.thi.ng/umbrella/geom/modules.html#edges) | extract edges |
|
|
56
|
+
| [`fitIntoBounds()`](https://docs.thi.ng/umbrella/geom/modules.html#fitIntoBounds) | rescale/reposition shapes into a destination boundary |
|
|
57
|
+
| [`flip()`](https://docs.thi.ng/umbrella/geom/modules.html#flip) | reverse order (vertices or direction) |
|
|
58
|
+
| [`intersects()`](https://docs.thi.ng/umbrella/geom/modules.html#intersects) | pairwise shape intersection (various types) |
|
|
59
|
+
| [`mapPoint()`](https://docs.thi.ng/umbrella/geom/modules.html#mapPoint) | transform world space point into local shape space |
|
|
60
|
+
| [`offset()`](https://docs.thi.ng/umbrella/geom/modules.html#offset) | shape/path offsetting |
|
|
61
|
+
| [`pointAt()`](https://docs.thi.ng/umbrella/geom/modules.html#pointAt) | compute point on shape boundary at parametric position |
|
|
62
|
+
| [`pointInside()`](https://docs.thi.ng/umbrella/geom/modules.html#pointInside) | check if point is inside shape |
|
|
63
|
+
| [`resample()`](https://docs.thi.ng/umbrella/geom/modules.html#resample) | resample/convert shape |
|
|
64
|
+
| [`rotate()`](https://docs.thi.ng/umbrella/geom/modules.html#rotate) | rotate shape |
|
|
65
|
+
| [`scale()`](https://docs.thi.ng/umbrella/geom/modules.html#scale) | scale shape (uniformly/non-uniformly) |
|
|
66
|
+
| [`scatter()`](https://docs.thi.ng/umbrella/geom/modules.html#scatter) | create random points inside a shape boundary |
|
|
67
|
+
| [`simplify()`](https://docs.thi.ng/umbrella/geom/modules.html#simplify) | simplify shape/boundary (Douglas-Peucker) |
|
|
68
|
+
| [`splitAt()`](https://docs.thi.ng/umbrella/geom/modules.html#splitAt) | split shape/boundary at parametric position |
|
|
69
|
+
| [`splitNear()`](https://docs.thi.ng/umbrella/geom/modules.html#splitNear) | split shape/boundary near world position |
|
|
70
|
+
| [`subdivCurve()`](https://docs.thi.ng/umbrella/geom/modules.html#subdivCurve) | recursively apply curve subdivision kernel |
|
|
71
|
+
| [`tangentAt()`](https://docs.thi.ng/umbrella/geom/modules.html#tangentAt) | compute tangent at parametric position |
|
|
72
|
+
| [`tessellate()`](https://docs.thi.ng/umbrella/geom/modules.html#tessellate) | (recursively) tessellate shape |
|
|
73
|
+
| [`transformVertices()`](https://docs.thi.ng/umbrella/geom/modules.html#transformVertices) | apply custom function to each vertex |
|
|
74
|
+
| [`transform()`](https://docs.thi.ng/umbrella/geom/modules.html#transform) | apply transformation matrix |
|
|
75
|
+
| [`translate()`](https://docs.thi.ng/umbrella/geom/modules.html#translate) | translate shape |
|
|
76
|
+
| [`union()`](https://docs.thi.ng/umbrella/geom/modules.html#union) | compute shape union |
|
|
77
|
+
| [`vertices()`](https://docs.thi.ng/umbrella/geom/modules.html#vertices) | extract/sample vertices from shape boundary |
|
|
78
|
+
| [`volume()`](https://docs.thi.ng/umbrella/geom/modules.html#volume) | compute shape volume (3D only) |
|
|
79
|
+
| [`warpPoints()`](https://docs.thi.ng/umbrella/geom/modules.html#warpPoints) | transfer points between the local spaces defined by 2 shapes |
|
|
80
|
+
|
|
81
|
+
This package acts as a higher-level frontend for most of the following related
|
|
82
|
+
packages (which are more low-level, lightweight and usable by themselves too):
|
|
37
83
|
|
|
38
84
|
### Support packages
|
|
39
85
|
|
|
@@ -85,7 +131,7 @@ node --experimental-repl-await
|
|
|
85
131
|
> const geom = await import("@thi.ng/geom");
|
|
86
132
|
```
|
|
87
133
|
|
|
88
|
-
Package sizes (gzipped, pre-treeshake): ESM:
|
|
134
|
+
Package sizes (gzipped, pre-treeshake): ESM: 13.50 KB
|
|
89
135
|
|
|
90
136
|
## Dependencies
|
|
91
137
|
|
package/api/aabb.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AABBLike, Attribs } from "@thi.ng/geom-api";
|
|
2
|
-
import
|
|
2
|
+
import { Vec } from "@thi.ng/vectors/api";
|
|
3
3
|
export declare class AABB implements AABBLike {
|
|
4
4
|
pos: Vec;
|
|
5
5
|
attribs?: Attribs | undefined;
|
|
@@ -7,6 +7,7 @@ export declare class AABB implements AABBLike {
|
|
|
7
7
|
constructor(pos?: Vec, size?: number | Vec, attribs?: Attribs | undefined);
|
|
8
8
|
get type(): string;
|
|
9
9
|
copy(): AABB;
|
|
10
|
+
withAttribs(attribs: Attribs): AABB;
|
|
10
11
|
max(): Vec;
|
|
11
12
|
offset(offset: number): this;
|
|
12
13
|
}
|
package/api/aabb.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { add3 } from "@thi.ng/vectors/add";
|
|
2
2
|
import { addN3 } from "@thi.ng/vectors/addn";
|
|
3
|
+
import { ZERO3 } from "@thi.ng/vectors/api";
|
|
4
|
+
import { max3 } from "@thi.ng/vectors/max";
|
|
3
5
|
import { set3 } from "@thi.ng/vectors/set";
|
|
4
6
|
import { subN3 } from "@thi.ng/vectors/subn";
|
|
5
7
|
import { __asVec } from "../internal/args.js";
|
|
@@ -16,12 +18,15 @@ export class AABB {
|
|
|
16
18
|
copy() {
|
|
17
19
|
return new AABB(set3([], this.pos), set3([], this.size), __copyAttribs(this));
|
|
18
20
|
}
|
|
21
|
+
withAttribs(attribs) {
|
|
22
|
+
return new AABB(this.pos, this.size, attribs);
|
|
23
|
+
}
|
|
19
24
|
max() {
|
|
20
25
|
return add3([], this.pos, this.size);
|
|
21
26
|
}
|
|
22
27
|
offset(offset) {
|
|
23
28
|
subN3(null, this.pos, offset);
|
|
24
|
-
addN3(null, this.size, offset * 2);
|
|
29
|
+
max3(null, addN3(null, this.size, offset * 2), ZERO3);
|
|
25
30
|
return this;
|
|
26
31
|
}
|
|
27
32
|
}
|
package/api/apc.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { Attribs,
|
|
1
|
+
import type { Attribs, PCLike } from "@thi.ng/geom-api";
|
|
2
2
|
import type { Vec } from "@thi.ng/vectors";
|
|
3
3
|
export declare abstract class APC implements PCLike {
|
|
4
4
|
points: Vec[];
|
|
5
5
|
attribs?: Attribs | undefined;
|
|
6
6
|
constructor(points?: Vec[], attribs?: Attribs | undefined);
|
|
7
7
|
abstract get type(): number | string;
|
|
8
|
-
abstract copy():
|
|
8
|
+
abstract copy(): APC;
|
|
9
|
+
abstract withAttribs(attribs: Attribs): APC;
|
|
9
10
|
[Symbol.iterator](): Generator<Vec, void, undefined>;
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=apc.d.ts.map
|
package/api/arc.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class Arc implements IHiccupShape, IHiccupPathSegment {
|
|
|
12
12
|
constructor(pos: Vec, r: Vec, axis: number, start: number, end: number, xl?: boolean, cw?: boolean, attribs?: Attribs | undefined);
|
|
13
13
|
get type(): string;
|
|
14
14
|
copy(): Arc;
|
|
15
|
+
withAttribs(attribs: Attribs): Arc;
|
|
15
16
|
equiv(o: any): boolean;
|
|
16
17
|
pointAt(t: number, out?: Vec): Vec;
|
|
17
18
|
pointAtTheta(theta: number, out?: Vec): Vec;
|
package/api/arc.js
CHANGED
|
@@ -19,6 +19,9 @@ export class Arc {
|
|
|
19
19
|
copy() {
|
|
20
20
|
return new Arc(set([], this.pos), set([], this.r), this.axis, this.start, this.end, this.xl, this.cw, __copyAttribs(this));
|
|
21
21
|
}
|
|
22
|
+
withAttribs(attribs) {
|
|
23
|
+
return new Arc(this.pos, this.r, this.axis, this.start, this.end, this.xl, this.cw, attribs);
|
|
24
|
+
}
|
|
22
25
|
equiv(o) {
|
|
23
26
|
return (o instanceof Arc &&
|
|
24
27
|
equiv(this.pos, o.pos) &&
|
package/api/bpatch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
|
-
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
|
|
2
|
+
import type { ReadonlyVec, Vec, VecPair } from "@thi.ng/vectors";
|
|
3
3
|
import { APC } from "./apc.js";
|
|
4
4
|
/**
|
|
5
5
|
* nD Cubic bezier patch defined by array of 4x4 control points in this
|
|
@@ -31,7 +31,8 @@ export declare class BPatch extends APC implements IHiccupShape {
|
|
|
31
31
|
constructor(points: Vec[], attribs?: Attribs);
|
|
32
32
|
get type(): string;
|
|
33
33
|
copy(): BPatch;
|
|
34
|
-
|
|
34
|
+
withAttribs(attribs: Attribs): BPatch;
|
|
35
|
+
edges(): VecPair[];
|
|
35
36
|
unmapPoint(uv: ReadonlyVec, out?: Vec): Vec;
|
|
36
37
|
toHiccup(): any[];
|
|
37
38
|
}
|
package/api/bpatch.js
CHANGED
package/api/circle.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class Circle implements IHiccupShape {
|
|
|
7
7
|
constructor(pos?: Vec, r?: number, attribs?: Attribs | undefined);
|
|
8
8
|
get type(): string;
|
|
9
9
|
copy(): Circle;
|
|
10
|
+
withAttribs(attribs: Attribs): Circle;
|
|
10
11
|
toHiccup(): (string | number | Attribs | undefined)[];
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=circle.d.ts.map
|
package/api/circle.js
CHANGED
|
@@ -12,6 +12,9 @@ export class Circle {
|
|
|
12
12
|
copy() {
|
|
13
13
|
return new Circle(set([], this.pos), this.r, __copyAttribs(this));
|
|
14
14
|
}
|
|
15
|
+
withAttribs(attribs) {
|
|
16
|
+
return new Circle(this.pos, this.r, attribs);
|
|
17
|
+
}
|
|
15
18
|
toHiccup() {
|
|
16
19
|
return ["circle", this.attribs, this.pos, this.r];
|
|
17
20
|
}
|
package/api/cubic.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { IHiccupPathSegment } from "@thi.ng/geom-api";
|
|
1
|
+
import type { Attribs, IHiccupPathSegment } from "@thi.ng/geom-api";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
3
|
export declare class Cubic extends APC implements IHiccupPathSegment {
|
|
4
4
|
get type(): string;
|
|
5
5
|
copy(): Cubic;
|
|
6
|
-
|
|
6
|
+
withAttribs(attribs: Attribs): Cubic;
|
|
7
|
+
toHiccup(): (string | Attribs | undefined)[];
|
|
7
8
|
toHiccupPathSegments(): (string | import("@thi.ng/vectors").Vec)[][];
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=cubic.d.ts.map
|
package/api/cubic.js
CHANGED
package/api/ellipse.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class Ellipse implements IHiccupShape {
|
|
|
7
7
|
constructor(pos?: Vec, r?: number | Vec, attribs?: Attribs | undefined);
|
|
8
8
|
get type(): string;
|
|
9
9
|
copy(): Ellipse;
|
|
10
|
+
withAttribs(attribs: Attribs): Ellipse;
|
|
10
11
|
toHiccup(): (string | Attribs | undefined)[];
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=ellipse.d.ts.map
|
package/api/ellipse.js
CHANGED
|
@@ -13,6 +13,9 @@ export class Ellipse {
|
|
|
13
13
|
copy() {
|
|
14
14
|
return new Ellipse(set([], this.pos), set([], this.r), __copyAttribs(this));
|
|
15
15
|
}
|
|
16
|
+
withAttribs(attribs) {
|
|
17
|
+
return new Ellipse(this.pos, this.r, attribs);
|
|
18
|
+
}
|
|
16
19
|
toHiccup() {
|
|
17
20
|
return ["ellipse", this.attribs, this.pos, this.r];
|
|
18
21
|
}
|
package/api/group.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare class Group implements IHiccupShape {
|
|
|
8
8
|
[Symbol.iterator](): Generator<IHiccupShape, void, undefined>;
|
|
9
9
|
copy(): Group;
|
|
10
10
|
copyTransformed(fn: Fn<IHiccupShape, IHiccupShape>): Group;
|
|
11
|
+
withAttribs(attribs: Attribs): Group;
|
|
11
12
|
equiv(o: any): boolean;
|
|
12
13
|
toHiccup(): any[];
|
|
13
14
|
}
|
package/api/group.js
CHANGED
|
@@ -17,6 +17,9 @@ export class Group {
|
|
|
17
17
|
copyTransformed(fn) {
|
|
18
18
|
return new Group(__copyAttribs(this), this.children.map(fn));
|
|
19
19
|
}
|
|
20
|
+
withAttribs(attribs) {
|
|
21
|
+
return new Group(attribs, this.children);
|
|
22
|
+
}
|
|
20
23
|
equiv(o) {
|
|
21
24
|
return o instanceof Group && equiv(this.children, o.children);
|
|
22
25
|
}
|
package/api/line.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { IHiccupPathSegment, IHiccupShape } from "@thi.ng/geom-api";
|
|
1
|
+
import type { Attribs, IHiccupPathSegment, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
3
|
export declare class Line extends APC implements IHiccupShape, IHiccupPathSegment {
|
|
4
4
|
get type(): string;
|
|
5
5
|
copy(): Line;
|
|
6
|
-
|
|
6
|
+
withAttribs(attribs: Attribs): Line;
|
|
7
|
+
toHiccup(): (string | Attribs | undefined)[];
|
|
7
8
|
toHiccupPathSegments(): ((string | number)[] | (string | import("@thi.ng/vectors").Vec)[])[];
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=line.d.ts.map
|
package/api/line.js
CHANGED
package/api/path.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class Path implements IHiccupShape {
|
|
|
7
7
|
get type(): string;
|
|
8
8
|
[Symbol.iterator](): Generator<PathSegment, void, undefined>;
|
|
9
9
|
copy(): Path;
|
|
10
|
+
withAttribs(attribs: Attribs): Path;
|
|
10
11
|
equiv(o: any): boolean;
|
|
11
12
|
add(s: PathSegment): void;
|
|
12
13
|
toHiccup(): (string | Attribs)[];
|
package/api/path.js
CHANGED
|
@@ -24,6 +24,11 @@ export class Path {
|
|
|
24
24
|
p.closed = this.closed;
|
|
25
25
|
return p;
|
|
26
26
|
}
|
|
27
|
+
withAttribs(attribs) {
|
|
28
|
+
const res = new Path(this.segments, attribs);
|
|
29
|
+
res.closed = true;
|
|
30
|
+
return res;
|
|
31
|
+
}
|
|
27
32
|
equiv(o) {
|
|
28
33
|
return o instanceof Path && equiv(this.segments, o.segments);
|
|
29
34
|
}
|
package/api/plane.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class Plane implements IHiccupShape {
|
|
|
7
7
|
constructor(normal?: Vec, w?: number, attribs?: Attribs | undefined);
|
|
8
8
|
get type(): string;
|
|
9
9
|
copy(): Plane;
|
|
10
|
+
withAttribs(attribs: Attribs): Plane;
|
|
10
11
|
toHiccup(): (string | number | Attribs | undefined)[];
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=plane.d.ts.map
|
package/api/plane.js
CHANGED
|
@@ -12,6 +12,9 @@ export class Plane {
|
|
|
12
12
|
copy() {
|
|
13
13
|
return new Plane(set3([], this.normal), this.w, __copyAttribs(this));
|
|
14
14
|
}
|
|
15
|
+
withAttribs(attribs) {
|
|
16
|
+
return new Plane(this.normal, this.w, attribs);
|
|
17
|
+
}
|
|
15
18
|
toHiccup() {
|
|
16
19
|
return ["plane", this.attribs, this.normal, this.w];
|
|
17
20
|
}
|
package/api/points.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type { IHiccupShape } from "@thi.ng/geom-api";
|
|
1
|
+
import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
3
|
export declare class Points extends APC implements IHiccupShape {
|
|
4
4
|
get type(): string;
|
|
5
5
|
copy(): Points;
|
|
6
|
-
|
|
6
|
+
withAttribs(attribs: Attribs): Points;
|
|
7
|
+
toHiccup(): (string | Attribs | undefined)[];
|
|
7
8
|
}
|
|
8
9
|
export declare class Points3 extends APC implements IHiccupShape {
|
|
9
10
|
get type(): string;
|
|
10
11
|
copy(): Points3;
|
|
11
|
-
|
|
12
|
+
withAttribs(attribs: Attribs): Points3;
|
|
13
|
+
toHiccup(): (string | Attribs | undefined)[];
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=points.d.ts.map
|
package/api/points.js
CHANGED
|
@@ -7,6 +7,9 @@ export class Points extends APC {
|
|
|
7
7
|
copy() {
|
|
8
8
|
return __copyShape(Points, this);
|
|
9
9
|
}
|
|
10
|
+
withAttribs(attribs) {
|
|
11
|
+
return new Points(this.points, attribs);
|
|
12
|
+
}
|
|
10
13
|
toHiccup() {
|
|
11
14
|
return ["points", this.attribs, this.points];
|
|
12
15
|
}
|
|
@@ -18,6 +21,9 @@ export class Points3 extends APC {
|
|
|
18
21
|
copy() {
|
|
19
22
|
return __copyShape(Points3, this);
|
|
20
23
|
}
|
|
24
|
+
withAttribs(attribs) {
|
|
25
|
+
return new Points3(this.points, attribs);
|
|
26
|
+
}
|
|
21
27
|
toHiccup() {
|
|
22
28
|
return ["points3", this.attribs, this.points];
|
|
23
29
|
}
|
package/api/polygon.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { IHiccupShape } from "@thi.ng/geom-api";
|
|
1
|
+
import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
3
|
export declare class Polygon extends APC implements IHiccupShape {
|
|
4
4
|
get type(): string;
|
|
5
5
|
copy(): Polygon;
|
|
6
|
-
|
|
6
|
+
withAttribs(attribs: Attribs): Polygon;
|
|
7
|
+
toHiccup(): (string | Attribs | undefined)[];
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=polygon.d.ts.map
|
package/api/polygon.js
CHANGED
package/api/polyline.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { IHiccupPathSegment, IHiccupShape } from "@thi.ng/geom-api";
|
|
1
|
+
import type { Attribs, IHiccupPathSegment, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
3
|
export declare class Polyline extends APC implements IHiccupShape, IHiccupPathSegment {
|
|
4
4
|
get type(): string;
|
|
5
5
|
copy(): Polyline;
|
|
6
|
+
withAttribs(attribs: Attribs): Polyline;
|
|
6
7
|
toHiccup(): (string | import("@thi.ng/vectors").Vec[] | {
|
|
7
8
|
fill: string;
|
|
8
9
|
})[];
|
package/api/polyline.js
CHANGED
package/api/quad.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { IHiccupShape } from "@thi.ng/geom-api";
|
|
1
|
+
import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
3
|
export declare class Quad extends APC implements IHiccupShape {
|
|
4
4
|
get type(): string;
|
|
5
5
|
copy(): Quad;
|
|
6
|
-
|
|
6
|
+
withAttribs(attribs: Attribs): Quad;
|
|
7
|
+
toHiccup(): (string | Attribs | undefined)[];
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=quad.d.ts.map
|
package/api/quad.js
CHANGED
package/api/quad3.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { IHiccupShape } from "@thi.ng/geom-api";
|
|
1
|
+
import type { Attribs, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
3
|
export declare class Quad3 extends APC implements IHiccupShape {
|
|
4
4
|
get type(): string;
|
|
5
5
|
copy(): Quad3;
|
|
6
|
-
|
|
6
|
+
withAttribs(attribs: Attribs): Quad3;
|
|
7
|
+
toHiccup(): (string | Attribs | undefined)[];
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=quad3.d.ts.map
|
package/api/quad3.js
CHANGED
package/api/quadratic.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { IHiccupPathSegment, IHiccupShape } from "@thi.ng/geom-api";
|
|
1
|
+
import type { Attribs, IHiccupPathSegment, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
3
|
export declare class Quadratic extends APC implements IHiccupShape, IHiccupPathSegment {
|
|
4
4
|
get type(): string;
|
|
5
5
|
copy(): Quadratic;
|
|
6
|
-
|
|
6
|
+
withAttribs(attribs: Attribs): Quadratic;
|
|
7
|
+
toHiccup(): (string | Attribs | undefined)[];
|
|
7
8
|
toHiccupPathSegments(): (string | import("@thi.ng/vectors").Vec)[][];
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=quadratic.d.ts.map
|
package/api/quadratic.js
CHANGED
package/api/ray.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class Ray implements IHiccupShape {
|
|
|
7
7
|
constructor(pos: Vec, dir: Vec, attribs?: Attribs | undefined);
|
|
8
8
|
get type(): string;
|
|
9
9
|
copy(): Ray;
|
|
10
|
+
withAttribs(attribs: Attribs): Ray;
|
|
10
11
|
toHiccup(): (string | Attribs | undefined)[];
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=ray.d.ts.map
|
package/api/ray.js
CHANGED
package/api/rect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AABBLike, Attribs, IHiccupShape } from "@thi.ng/geom-api";
|
|
2
|
-
import
|
|
2
|
+
import { Vec } from "@thi.ng/vectors/api";
|
|
3
3
|
export declare class Rect implements AABBLike, IHiccupShape {
|
|
4
4
|
pos: Vec;
|
|
5
5
|
attribs?: Attribs | undefined;
|
|
@@ -7,6 +7,7 @@ export declare class Rect implements AABBLike, IHiccupShape {
|
|
|
7
7
|
constructor(pos?: Vec, size?: number | Vec, attribs?: Attribs | undefined);
|
|
8
8
|
get type(): string;
|
|
9
9
|
copy(): Rect;
|
|
10
|
+
withAttribs(attribs: Attribs): Rect;
|
|
10
11
|
max(): Vec;
|
|
11
12
|
offset(offset: number): this;
|
|
12
13
|
toHiccup(): (string | number | Attribs | undefined)[];
|
package/api/rect.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { add2 } from "@thi.ng/vectors/add";
|
|
2
2
|
import { addN2 } from "@thi.ng/vectors/addn";
|
|
3
|
+
import { ZERO2 } from "@thi.ng/vectors/api";
|
|
4
|
+
import { max2 } from "@thi.ng/vectors/max";
|
|
3
5
|
import { set2 } from "@thi.ng/vectors/set";
|
|
4
6
|
import { subN2 } from "@thi.ng/vectors/subn";
|
|
5
7
|
import { __asVec } from "../internal/args.js";
|
|
@@ -16,12 +18,15 @@ export class Rect {
|
|
|
16
18
|
copy() {
|
|
17
19
|
return new Rect(set2([], this.pos), set2([], this.size), __copyAttribs(this));
|
|
18
20
|
}
|
|
21
|
+
withAttribs(attribs) {
|
|
22
|
+
return new Rect(this.pos, this.size, attribs);
|
|
23
|
+
}
|
|
19
24
|
max() {
|
|
20
25
|
return add2([], this.pos, this.size);
|
|
21
26
|
}
|
|
22
27
|
offset(offset) {
|
|
23
28
|
subN2(null, this.pos, offset);
|
|
24
|
-
addN2(null, this.size, offset * 2);
|
|
29
|
+
max2(null, addN2(null, this.size, offset * 2), ZERO2);
|
|
25
30
|
return this;
|
|
26
31
|
}
|
|
27
32
|
toHiccup() {
|
package/api/sphere.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class Sphere implements IHiccupShape {
|
|
|
7
7
|
constructor(pos?: Vec, r?: number, attribs?: Attribs | undefined);
|
|
8
8
|
get type(): string;
|
|
9
9
|
copy(): Sphere;
|
|
10
|
+
withAttribs(attribs: Attribs): Sphere;
|
|
10
11
|
toHiccup(): (string | number | Attribs | undefined)[];
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=sphere.d.ts.map
|
package/api/sphere.js
CHANGED
|
@@ -12,6 +12,9 @@ export class Sphere {
|
|
|
12
12
|
copy() {
|
|
13
13
|
return new Sphere(set3([], this.pos), this.r, __copyAttribs(this));
|
|
14
14
|
}
|
|
15
|
+
withAttribs(attribs) {
|
|
16
|
+
return new Sphere(this.pos, this.r, attribs);
|
|
17
|
+
}
|
|
15
18
|
toHiccup() {
|
|
16
19
|
return ["sphere", this.attribs, this.pos, this.r];
|
|
17
20
|
}
|
package/api/text.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare class Text implements IHiccupShape {
|
|
|
13
13
|
constructor(pos: Vec, body: any, attribs?: Attribs | undefined);
|
|
14
14
|
get type(): string;
|
|
15
15
|
copy(): Text;
|
|
16
|
+
withAttribs(attribs: Attribs): Text;
|
|
16
17
|
toHiccup(): any[];
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=text.d.ts.map
|
package/api/text.js
CHANGED
|
@@ -18,6 +18,9 @@ export class Text {
|
|
|
18
18
|
copy() {
|
|
19
19
|
return new Text(set([], this.pos), this.body, __copyAttribs(this));
|
|
20
20
|
}
|
|
21
|
+
withAttribs(attribs) {
|
|
22
|
+
return new Text(this.pos, this.body, attribs);
|
|
23
|
+
}
|
|
21
24
|
toHiccup() {
|
|
22
25
|
return ["text", this.attribs, this.pos, this.body];
|
|
23
26
|
}
|