@thi.ng/geom 6.0.7 → 6.0.9
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 +1 -1
- package/README.md +1 -1
- package/aabb.js +31 -32
- package/api/aabb.js +34 -29
- package/api/apc.js +15 -13
- package/api/arc.js +82 -66
- package/api/bpatch.js +79 -96
- package/api/circle.js +21 -21
- package/api/cubic.js +28 -25
- package/api/ellipse.js +26 -21
- package/api/group.js +45 -47
- package/api/line.js +26 -27
- package/api/path.js +62 -58
- package/api/plane.js +21 -21
- package/api/points.js +30 -26
- package/api/polygon.js +19 -16
- package/api/polyline.js +25 -22
- package/api/quad.js +20 -17
- package/api/quad3.js +20 -17
- package/api/quadratic.js +28 -25
- package/api/ray.js +30 -26
- package/api/rect.js +34 -29
- package/api/sphere.js +21 -21
- package/api/text.js +21 -28
- package/api/triangle.js +20 -17
- package/apply-transforms.js +28 -48
- package/arc-length.js +17 -30
- package/arc.js +17 -6
- package/area.js +19 -45
- package/as-cubic.js +38 -57
- package/as-path.js +4 -8
- package/as-polygon.js +12 -29
- package/as-polyline.js +18 -38
- package/as-svg.js +32 -63
- package/bounds.js +46 -48
- package/bpatch.js +22 -14
- package/center.js +22 -17
- package/centroid.js +14 -34
- package/circle.js +11 -6
- package/classify-point.js +20 -27
- package/clip-convex.js +40 -39
- package/closest-point.js +28 -34
- package/convex-hull.js +12 -27
- package/cubic.js +13 -5
- package/edges.js +31 -60
- package/ellipse.js +5 -2
- package/fit-into-bounds.js +78 -61
- package/flip.js +24 -41
- package/group.js +4 -1
- package/internal/args.js +18 -51
- package/internal/bounds.js +23 -38
- package/internal/collate.js +33 -17
- package/internal/copy.js +12 -23
- package/internal/dispatch.js +6 -4
- package/internal/edges.js +4 -1
- package/internal/pclike.js +8 -4
- package/internal/points-as-shape.js +4 -3
- package/internal/rotate.js +6 -2
- package/internal/scale.js +8 -2
- package/internal/split.js +9 -6
- package/internal/transform.js +24 -12
- package/internal/translate.js +6 -2
- package/internal/vertices.js +15 -31
- package/intersects.js +15 -39
- package/line.js +11 -9
- package/map-point.js +10 -18
- package/offset.js +31 -29
- package/package.json +33 -30
- package/path-builder.js +152 -143
- package/path-from-svg.js +129 -131
- package/path.js +28 -25
- package/plane.js +10 -5
- package/point-at.js +12 -30
- package/point-inside.js +20 -25
- package/points.js +6 -2
- package/polygon.js +15 -47
- package/polyline.js +18 -22
- package/quad.js +23 -15
- package/quadratic.js +7 -3
- package/ray.js +4 -1
- package/rect.js +47 -46
- package/resample.js +12 -27
- package/rotate.js +30 -42
- package/scale.js +66 -64
- package/scatter.js +18 -30
- package/simplify.js +38 -55
- package/sphere.js +7 -3
- package/split-arclength.js +53 -108
- package/split-at.js +46 -26
- package/split-near.js +28 -22
- package/subdiv-curve.js +33 -72
- package/tangent-at.js +12 -24
- package/tessellate.js +22 -47
- package/text.js +4 -1
- package/transform-vertices.js +31 -55
- package/transform.js +31 -54
- package/translate.js +39 -46
- package/triangle.js +7 -3
- package/union.js +12 -15
- package/unmap-point.js +21 -25
- package/vertices.js +91 -113
- package/volume.js +10 -14
- package/warp-points.js +15 -25
- package/with-attribs.js +4 -11
package/api/ellipse.js
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { set } from "@thi.ng/vectors/set";
|
|
2
2
|
import { __asVec } from "../internal/args.js";
|
|
3
3
|
import { __copyAttribs } from "../internal/copy.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
class Ellipse {
|
|
5
|
+
constructor(pos = [0, 0], r = [1, 1], attribs) {
|
|
6
|
+
this.pos = pos;
|
|
7
|
+
this.attribs = attribs;
|
|
8
|
+
this.r = __asVec(r);
|
|
9
|
+
}
|
|
10
|
+
r;
|
|
11
|
+
get type() {
|
|
12
|
+
return "ellipse";
|
|
13
|
+
}
|
|
14
|
+
copy() {
|
|
15
|
+
return new Ellipse(
|
|
16
|
+
set([], this.pos),
|
|
17
|
+
set([], this.r),
|
|
18
|
+
__copyAttribs(this)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
withAttribs(attribs) {
|
|
22
|
+
return new Ellipse(this.pos, this.r, attribs);
|
|
23
|
+
}
|
|
24
|
+
toHiccup() {
|
|
25
|
+
return ["ellipse", this.attribs, this.pos, this.r];
|
|
26
|
+
}
|
|
25
27
|
}
|
|
28
|
+
export {
|
|
29
|
+
Ellipse
|
|
30
|
+
};
|
package/api/group.js
CHANGED
|
@@ -1,51 +1,49 @@
|
|
|
1
1
|
import { ensureArray } from "@thi.ng/arrays/ensure-array";
|
|
2
2
|
import { equiv } from "@thi.ng/equiv";
|
|
3
3
|
import { __copyAttribs } from "../internal/copy.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return o instanceof Group && equiv(this.children, o.children);
|
|
47
|
-
}
|
|
48
|
-
toHiccup() {
|
|
49
|
-
return ["g", this.attribs, ...this.children.map((x) => x.toHiccup())];
|
|
50
|
-
}
|
|
4
|
+
class Group {
|
|
5
|
+
constructor(attribs, children) {
|
|
6
|
+
this.attribs = attribs;
|
|
7
|
+
this.children = children ? ensureArray(children) : [];
|
|
8
|
+
}
|
|
9
|
+
children;
|
|
10
|
+
get type() {
|
|
11
|
+
return "group";
|
|
12
|
+
}
|
|
13
|
+
*[Symbol.iterator]() {
|
|
14
|
+
yield* this.children;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Appends given `shapes` to this {@link Group.children} array.
|
|
18
|
+
*
|
|
19
|
+
* @param shapes
|
|
20
|
+
*/
|
|
21
|
+
add(...shapes) {
|
|
22
|
+
this.children.push(...shapes);
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Removes all children from the group.
|
|
27
|
+
*/
|
|
28
|
+
clear() {
|
|
29
|
+
this.children.length = 0;
|
|
30
|
+
}
|
|
31
|
+
copy() {
|
|
32
|
+
return this.copyTransformed((c) => c.copy());
|
|
33
|
+
}
|
|
34
|
+
copyTransformed(fn) {
|
|
35
|
+
return new Group(__copyAttribs(this), this.children.map(fn));
|
|
36
|
+
}
|
|
37
|
+
withAttribs(attribs) {
|
|
38
|
+
return new Group(attribs, this.children);
|
|
39
|
+
}
|
|
40
|
+
equiv(o) {
|
|
41
|
+
return o instanceof Group && equiv(this.children, o.children);
|
|
42
|
+
}
|
|
43
|
+
toHiccup() {
|
|
44
|
+
return ["g", this.attribs, ...this.children.map((x) => x.toHiccup())];
|
|
45
|
+
}
|
|
51
46
|
}
|
|
47
|
+
export {
|
|
48
|
+
Group
|
|
49
|
+
};
|
package/api/line.js
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { __copyShape } from "../internal/copy.js";
|
|
2
2
|
import { __ensureNumVerts } from "../internal/pclike.js";
|
|
3
3
|
import { APC } from "./apc.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
? ["H", b[0]]
|
|
28
|
-
: ["L", b],
|
|
29
|
-
];
|
|
30
|
-
}
|
|
4
|
+
class Line extends APC {
|
|
5
|
+
constructor(points, attribs) {
|
|
6
|
+
super(points, attribs);
|
|
7
|
+
__ensureNumVerts(this.points.length, 2);
|
|
8
|
+
}
|
|
9
|
+
get type() {
|
|
10
|
+
return "line";
|
|
11
|
+
}
|
|
12
|
+
copy() {
|
|
13
|
+
return __copyShape(Line, this);
|
|
14
|
+
}
|
|
15
|
+
withAttribs(attribs) {
|
|
16
|
+
return new Line(this.points, attribs);
|
|
17
|
+
}
|
|
18
|
+
toHiccup() {
|
|
19
|
+
return ["line", this.attribs, this.points[0], this.points[1]];
|
|
20
|
+
}
|
|
21
|
+
toHiccupPathSegments() {
|
|
22
|
+
const [a, b] = this.points;
|
|
23
|
+
return [
|
|
24
|
+
a[0] === b[0] ? ["V", b[1]] : a[1] === b[1] ? ["H", b[0]] : ["L", b]
|
|
25
|
+
];
|
|
26
|
+
}
|
|
31
27
|
}
|
|
28
|
+
export {
|
|
29
|
+
Line
|
|
30
|
+
};
|
package/api/path.js
CHANGED
|
@@ -3,64 +3,68 @@ import { equiv } from "@thi.ng/equiv";
|
|
|
3
3
|
import { illegalState } from "@thi.ng/errors/illegal-state";
|
|
4
4
|
import { copy } from "@thi.ng/vectors/copy";
|
|
5
5
|
import { __copyAttribs } from "../internal/copy.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
if (this.closed) {
|
|
61
|
-
dest.push(["Z"]);
|
|
62
|
-
}
|
|
6
|
+
class Path {
|
|
7
|
+
constructor(segments, attribs) {
|
|
8
|
+
this.attribs = attribs;
|
|
9
|
+
this.segments = segments ? ensureArray(segments) : [];
|
|
10
|
+
}
|
|
11
|
+
segments;
|
|
12
|
+
closed = false;
|
|
13
|
+
get type() {
|
|
14
|
+
return "path";
|
|
15
|
+
}
|
|
16
|
+
*[Symbol.iterator]() {
|
|
17
|
+
yield* this.segments;
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
this.segments.length = 0;
|
|
21
|
+
}
|
|
22
|
+
copy() {
|
|
23
|
+
const p = new Path(
|
|
24
|
+
this.segments.map((s) => {
|
|
25
|
+
const d = { type: s.type };
|
|
26
|
+
s.point && (d.point = copy(s.point));
|
|
27
|
+
s.geo && (d.geo = s.geo.copy());
|
|
28
|
+
return d;
|
|
29
|
+
}),
|
|
30
|
+
__copyAttribs(this)
|
|
31
|
+
);
|
|
32
|
+
p.closed = this.closed;
|
|
33
|
+
return p;
|
|
34
|
+
}
|
|
35
|
+
withAttribs(attribs) {
|
|
36
|
+
const res = new Path(this.segments, attribs);
|
|
37
|
+
res.closed = this.closed;
|
|
38
|
+
return res;
|
|
39
|
+
}
|
|
40
|
+
equiv(o) {
|
|
41
|
+
return o instanceof Path && equiv(this.segments, o.segments);
|
|
42
|
+
}
|
|
43
|
+
add(...segments) {
|
|
44
|
+
if (this.closed)
|
|
45
|
+
illegalState("path already closed");
|
|
46
|
+
this.segments.push(...segments);
|
|
47
|
+
}
|
|
48
|
+
toHiccup() {
|
|
49
|
+
let dest = [];
|
|
50
|
+
const segments = this.segments;
|
|
51
|
+
const n = segments.length;
|
|
52
|
+
if (n > 1) {
|
|
53
|
+
for (let i = 0; i < n; i++) {
|
|
54
|
+
const s = segments[i];
|
|
55
|
+
if (s.geo) {
|
|
56
|
+
dest = dest.concat(s.geo.toHiccupPathSegments());
|
|
57
|
+
} else if (s.point) {
|
|
58
|
+
dest.push(["M", s.point]);
|
|
63
59
|
}
|
|
64
|
-
|
|
60
|
+
}
|
|
61
|
+
if (this.closed) {
|
|
62
|
+
dest.push(["Z"]);
|
|
63
|
+
}
|
|
65
64
|
}
|
|
65
|
+
return ["path", this.attribs || {}, dest];
|
|
66
|
+
}
|
|
66
67
|
}
|
|
68
|
+
export {
|
|
69
|
+
Path
|
|
70
|
+
};
|
package/api/plane.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { set3 } from "@thi.ng/vectors/set";
|
|
2
2
|
import { __copyAttribs } from "../internal/copy.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
toHiccup() {
|
|
22
|
-
return ["plane", this.attribs, this.normal, this.w];
|
|
23
|
-
}
|
|
3
|
+
class Plane {
|
|
4
|
+
constructor(normal = [0, 1, 0], w = 0, attribs) {
|
|
5
|
+
this.normal = normal;
|
|
6
|
+
this.w = w;
|
|
7
|
+
this.attribs = attribs;
|
|
8
|
+
}
|
|
9
|
+
get type() {
|
|
10
|
+
return "plane";
|
|
11
|
+
}
|
|
12
|
+
copy() {
|
|
13
|
+
return new Plane(set3([], this.normal), this.w, __copyAttribs(this));
|
|
14
|
+
}
|
|
15
|
+
withAttribs(attribs) {
|
|
16
|
+
return new Plane(this.normal, this.w, attribs);
|
|
17
|
+
}
|
|
18
|
+
toHiccup() {
|
|
19
|
+
return ["plane", this.attribs, this.normal, this.w];
|
|
20
|
+
}
|
|
24
21
|
}
|
|
22
|
+
export {
|
|
23
|
+
Plane
|
|
24
|
+
};
|
package/api/points.js
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import { __copyShape } from "../internal/copy.js";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
class Points extends APC {
|
|
4
|
+
get type() {
|
|
5
|
+
return "points";
|
|
6
|
+
}
|
|
7
|
+
copy() {
|
|
8
|
+
return __copyShape(Points, this);
|
|
9
|
+
}
|
|
10
|
+
withAttribs(attribs) {
|
|
11
|
+
return new Points(this.points, attribs);
|
|
12
|
+
}
|
|
13
|
+
toHiccup() {
|
|
14
|
+
return ["points", this.attribs, this.points];
|
|
15
|
+
}
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
class Points3 extends APC {
|
|
18
|
+
get type() {
|
|
19
|
+
return "points3";
|
|
20
|
+
}
|
|
21
|
+
copy() {
|
|
22
|
+
return __copyShape(Points3, this);
|
|
23
|
+
}
|
|
24
|
+
withAttribs(attribs) {
|
|
25
|
+
return new Points3(this.points, attribs);
|
|
26
|
+
}
|
|
27
|
+
toHiccup() {
|
|
28
|
+
return ["points3", this.attribs, this.points];
|
|
29
|
+
}
|
|
30
30
|
}
|
|
31
|
+
export {
|
|
32
|
+
Points,
|
|
33
|
+
Points3
|
|
34
|
+
};
|
package/api/polygon.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { __copyShape } from "../internal/copy.js";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
class Polygon extends APC {
|
|
4
|
+
get type() {
|
|
5
|
+
return "poly";
|
|
6
|
+
}
|
|
7
|
+
add(...points) {
|
|
8
|
+
this.points.push(...points);
|
|
9
|
+
}
|
|
10
|
+
copy() {
|
|
11
|
+
return __copyShape(Polygon, this);
|
|
12
|
+
}
|
|
13
|
+
withAttribs(attribs) {
|
|
14
|
+
return new Polygon(this.points, attribs);
|
|
15
|
+
}
|
|
16
|
+
toHiccup() {
|
|
17
|
+
return ["polygon", this.attribs, this.points];
|
|
18
|
+
}
|
|
19
19
|
}
|
|
20
|
+
export {
|
|
21
|
+
Polygon
|
|
22
|
+
};
|
package/api/polyline.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { __copyShape } from "../internal/copy.js";
|
|
2
2
|
import { APC } from "./apc.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return res;
|
|
3
|
+
class Polyline extends APC {
|
|
4
|
+
get type() {
|
|
5
|
+
return "polyline";
|
|
6
|
+
}
|
|
7
|
+
add(...points) {
|
|
8
|
+
this.points.push(...points);
|
|
9
|
+
}
|
|
10
|
+
copy() {
|
|
11
|
+
return __copyShape(Polyline, this);
|
|
12
|
+
}
|
|
13
|
+
withAttribs(attribs) {
|
|
14
|
+
return new Polyline(this.points, attribs);
|
|
15
|
+
}
|
|
16
|
+
toHiccup() {
|
|
17
|
+
return ["polyline", { ...this.attribs, fill: "none" }, this.points];
|
|
18
|
+
}
|
|
19
|
+
toHiccupPathSegments() {
|
|
20
|
+
const res = [];
|
|
21
|
+
for (let pts = this.points, n = pts.length, i = 1; i < n; i++) {
|
|
22
|
+
res.push(["L", pts[i]]);
|
|
25
23
|
}
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
26
|
}
|
|
27
|
+
export {
|
|
28
|
+
Polyline
|
|
29
|
+
};
|
package/api/quad.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { __copyShape } from "../internal/copy.js";
|
|
2
2
|
import { __ensureNumVerts } from "../internal/pclike.js";
|
|
3
3
|
import { APC } from "./apc.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
class Quad extends APC {
|
|
5
|
+
constructor(points, attribs) {
|
|
6
|
+
super(points, attribs);
|
|
7
|
+
__ensureNumVerts(this.points.length, 4);
|
|
8
|
+
}
|
|
9
|
+
get type() {
|
|
10
|
+
return "quad";
|
|
11
|
+
}
|
|
12
|
+
copy() {
|
|
13
|
+
return __copyShape(Quad, this);
|
|
14
|
+
}
|
|
15
|
+
withAttribs(attribs) {
|
|
16
|
+
return new Quad(this.points, attribs);
|
|
17
|
+
}
|
|
18
|
+
toHiccup() {
|
|
19
|
+
return ["polygon", this.attribs, this.points];
|
|
20
|
+
}
|
|
21
21
|
}
|
|
22
|
+
export {
|
|
23
|
+
Quad
|
|
24
|
+
};
|
package/api/quad3.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { __copyShape } from "../internal/copy.js";
|
|
2
2
|
import { __ensureNumVerts } from "../internal/pclike.js";
|
|
3
3
|
import { APC } from "./apc.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
class Quad3 extends APC {
|
|
5
|
+
constructor(points, attribs) {
|
|
6
|
+
super(points, attribs);
|
|
7
|
+
__ensureNumVerts(this.points.length, 4);
|
|
8
|
+
}
|
|
9
|
+
get type() {
|
|
10
|
+
return "quad3";
|
|
11
|
+
}
|
|
12
|
+
copy() {
|
|
13
|
+
return __copyShape(Quad3, this);
|
|
14
|
+
}
|
|
15
|
+
withAttribs(attribs) {
|
|
16
|
+
return new Quad3(this.points, attribs);
|
|
17
|
+
}
|
|
18
|
+
toHiccup() {
|
|
19
|
+
return ["polygon", this.attribs, this.points];
|
|
20
|
+
}
|
|
21
21
|
}
|
|
22
|
+
export {
|
|
23
|
+
Quad3
|
|
24
|
+
};
|