@thi.ng/geom 7.0.1 → 8.0.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 +190 -1
- package/README.md +349 -112
- package/aabb.d.ts +26 -1
- package/api/aabb.d.ts +5 -4
- package/api/aabb.js +10 -7
- package/api/apc.d.ts +5 -3
- package/api/arc.d.ts +6 -5
- package/api/arc.js +3 -4
- package/api/bpatch.d.ts +6 -3
- package/api/bpatch.js +5 -3
- package/api/circle.d.ts +4 -3
- package/api/circle.js +9 -6
- package/api/complex-polygon.d.ts +7 -3
- package/api/complex-polygon.js +14 -4
- package/api/cubic.d.ts +8 -5
- package/api/cubic.js +12 -6
- package/api/cubic3.d.ts +15 -0
- package/api/cubic3.js +38 -0
- package/api/ellipse.d.ts +4 -3
- package/api/ellipse.js +7 -8
- package/api/extra.d.ts +15 -0
- package/api/extra.js +19 -0
- package/api/group.d.ts +12 -11
- package/api/group.js +4 -5
- package/api/group3.d.ts +30 -0
- package/api/group3.js +48 -0
- package/api/line.d.ts +8 -5
- package/api/line.js +8 -8
- package/api/line3.d.ts +15 -0
- package/api/line3.js +29 -0
- package/api/path.d.ts +14 -11
- package/api/path.js +17 -12
- package/api/path3.d.ts +28 -0
- package/api/path3.js +91 -0
- package/api/plane.d.ts +4 -3
- package/api/plane.js +7 -4
- package/api/points.d.ts +8 -10
- package/api/points.js +7 -20
- package/api/points3.d.ts +13 -0
- package/api/points3.js +21 -0
- package/api/polygon.d.ts +7 -4
- package/api/polygon.js +5 -3
- package/api/polygon3.d.ts +14 -0
- package/api/polygon3.js +24 -0
- package/api/polyline.d.ts +18 -4
- package/api/polyline.js +8 -5
- package/api/polyline3.d.ts +28 -0
- package/api/polyline3.js +31 -0
- package/api/quad.d.ts +7 -4
- package/api/quad.js +5 -3
- package/api/quad3.d.ts +7 -4
- package/api/quad3.js +6 -4
- package/api/quadratic.d.ts +8 -5
- package/api/quadratic.js +12 -6
- package/api/quadratic3.d.ts +15 -0
- package/api/quadratic3.js +38 -0
- package/api/ray.d.ts +4 -3
- package/api/ray.js +6 -7
- package/api/ray3.d.ts +14 -0
- package/api/ray3.js +33 -0
- package/api/rect.d.ts +5 -3
- package/api/rect.js +11 -8
- package/api/sphere.d.ts +4 -3
- package/api/sphere.js +8 -5
- package/api/text.d.ts +4 -3
- package/api/text.js +8 -5
- package/api/triangle.d.ts +7 -4
- package/api/triangle.js +5 -3
- package/api/triangle3.d.ts +14 -0
- package/api/triangle3.js +26 -0
- package/api.d.ts +193 -0
- package/api.js +10 -0
- package/apply-transforms.d.ts +33 -11
- package/apply-transforms.js +24 -4
- package/arc-length.d.ts +18 -4
- package/arc-length.js +18 -3
- package/arc.d.ts +1 -1
- package/area.d.ts +6 -10
- package/area.js +3 -3
- package/as-cubic.d.ts +31 -5
- package/as-cubic.js +86 -24
- package/as-path.d.ts +14 -7
- package/as-path.js +49 -24
- package/as-polygon.d.ts +20 -5
- package/as-polygon.js +46 -12
- package/as-polyline.d.ts +18 -5
- package/as-polyline.js +29 -23
- package/as-sector.d.ts +13 -0
- package/as-sector.js +18 -0
- package/as-svg.d.ts +31 -9
- package/as-svg.js +21 -18
- package/bounds.d.ts +12 -2
- package/bounds.js +15 -0
- package/bpatch.d.ts +26 -1
- package/center-of-weight.d.ts +22 -0
- package/center-of-weight.js +23 -0
- package/center.d.ts +11 -5
- package/center.js +9 -4
- package/centroid-of-bounds.d.ts +12 -0
- package/centroid-of-bounds.js +9 -0
- package/centroid.d.ts +14 -4
- package/centroid.js +16 -17
- package/circle.d.ts +1 -1
- package/classify-point.d.ts +3 -1
- package/classify-point.js +7 -4
- package/clip-convex.d.ts +27 -8
- package/clip-convex.js +52 -17
- package/closest-point.d.ts +1 -1
- package/complex-polygon-from-path.d.ts +1 -1
- package/complex-polygon.d.ts +1 -1
- package/convex-hull.d.ts +9 -2
- package/convex-hull.js +3 -3
- package/convolve.d.ts +72 -0
- package/convolve.js +33 -0
- package/cubic.d.ts +1 -1
- package/cubic.js +7 -7
- package/cubic3.d.ts +8 -0
- package/cubic3.js +14 -0
- package/edges.d.ts +2 -2
- package/ellipse.d.ts +1 -1
- package/extra.d.ts +14 -0
- package/extra.js +5 -0
- package/fit-into-bounds.d.ts +14 -4
- package/fit-into-bounds.js +6 -6
- package/flip.d.ts +21 -5
- package/flip.js +19 -12
- package/from-tessellation.d.ts +54 -0
- package/from-tessellation.js +27 -0
- package/group.d.ts +2 -2
- package/group3.d.ts +16 -0
- package/group3.js +5 -0
- package/index.d.ts +35 -1
- package/index.js +35 -1
- package/internal/bounds.d.ts +3 -4
- package/internal/copy.d.ts +8 -7
- package/internal/copy.js +3 -7
- package/internal/dispatch.d.ts +1 -1
- package/internal/error.d.ts +3 -0
- package/internal/error.js +6 -0
- package/internal/pclike.d.ts +3 -2
- package/internal/pclike.js +6 -0
- package/internal/points-as-shape.d.ts +11 -2
- package/internal/points-as-shape.js +10 -1
- package/internal/split.d.ts +2 -2
- package/internal/split.js +13 -8
- package/internal/transform.d.ts +6 -22
- package/internal/transform.js +2 -21
- package/internal/vertices.d.ts +3 -2
- package/internal/vertices.js +3 -1
- package/intersects.d.ts +5 -4
- package/intersects.js +6 -4
- package/line.d.ts +1 -1
- package/line3.d.ts +6 -0
- package/line3.js +9 -0
- package/map-point.d.ts +1 -1
- package/normalized-path.d.ts +17 -0
- package/normalized-path.js +23 -0
- package/offset.d.ts +16 -2
- package/offset.js +2 -2
- package/package.json +149 -35
- package/path-builder.d.ts +42 -13
- package/path-builder.js +68 -42
- package/path-from-cubics.d.ts +26 -0
- package/path-from-cubics.js +39 -0
- package/path-from-svg.d.ts +1 -1
- package/path-from-svg.js +29 -29
- package/path.d.ts +2 -52
- package/path.js +1 -58
- package/path3.d.ts +16 -0
- package/path3.js +5 -0
- package/plane.d.ts +11 -1
- package/plane.js +3 -0
- package/point-at.d.ts +1 -1
- package/point-inside.d.ts +3 -1
- package/point-inside.js +4 -1
- package/points.d.ts +2 -3
- package/points.js +2 -4
- package/points3.d.ts +5 -0
- package/points3.js +5 -0
- package/polygon.d.ts +5 -5
- package/polygon3.d.ts +5 -0
- package/polygon3.js +5 -0
- package/polyline.d.ts +2 -2
- package/polyline3.d.ts +5 -0
- package/polyline3.js +5 -0
- package/proximity.d.ts +5 -3
- package/proximity.js +2 -2
- package/quad.d.ts +2 -7
- package/quad.js +1 -29
- package/quad3.d.ts +8 -0
- package/quad3.js +30 -0
- package/quadratic.d.ts +1 -1
- package/quadratic3.d.ts +7 -0
- package/quadratic3.js +11 -0
- package/ray.d.ts +1 -1
- package/ray.js +2 -2
- package/ray3.d.ts +5 -0
- package/ray3.js +6 -0
- package/rect.d.ts +1 -1
- package/resample.d.ts +45 -4
- package/resample.js +26 -16
- package/rotate-around-axis.d.ts +33 -0
- package/rotate-around-axis.js +57 -0
- package/rotate.d.ts +15 -2
- package/rotate.js +47 -45
- package/rounded-rect.d.ts +25 -0
- package/rounded-rect.js +18 -0
- package/scale-with-center.d.ts +2 -2
- package/scale.d.ts +24 -2
- package/scale.js +59 -43
- package/scatter.d.ts +1 -1
- package/simplify.d.ts +8 -2
- package/simplify.js +7 -4
- package/smooth-poly.d.ts +27 -0
- package/smooth-poly.js +11 -0
- package/sphere.d.ts +1 -1
- package/split-arclength.d.ts +6 -2
- package/split-at.d.ts +18 -2
- package/split-at.js +66 -34
- package/split-near.d.ts +13 -2
- package/split-near.js +23 -27
- package/subdiv-curve.d.ts +81 -27
- package/subdiv-curve.js +44 -28
- package/tangent-at.d.ts +1 -1
- package/tessellate.d.ts +72 -18
- package/tessellate.js +53 -8
- package/text.d.ts +1 -1
- package/transform-vertices.d.ts +30 -6
- package/transform-vertices.js +36 -38
- package/transform.d.ts +30 -2
- package/transform.js +54 -40
- package/translate.d.ts +12 -2
- package/translate.js +42 -43
- package/triangle.d.ts +1 -1
- package/triangle3.d.ts +6 -0
- package/triangle3.js +8 -0
- package/union.d.ts +11 -2
- package/union.js +6 -7
- package/unmap-point.d.ts +1 -1
- package/vertices.d.ts +3 -3
- package/vertices.js +14 -4
- package/volume.d.ts +1 -1
- package/warp-points.d.ts +35 -4
- package/warp-points.js +2 -0
- package/with-attribs.d.ts +4 -5
- package/internal/rotate.d.ts +0 -5
- package/internal/rotate.js +0 -8
- package/internal/scale.d.ts +0 -5
- package/internal/scale.js +0 -12
- package/internal/translate.d.ts +0 -5
- package/internal/translate.js +0 -8
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -21,6 +21,26 @@ For the Clojure version, please visit: [thi.ng/geom-clj](https://thi.ng/geom-clj
|
|
|
21
21
|
- [Hiccup support](#hiccup-support)
|
|
22
22
|
- [SVG support](#svg-support)
|
|
23
23
|
- [Polymorphic operations](#polymorphic-operations)
|
|
24
|
+
- [Shape factory functions](#shape-factory-functions)
|
|
25
|
+
- [AABB](#aabb)
|
|
26
|
+
- [Arc](#arc)
|
|
27
|
+
- [Bezier patch](#bezier-patch)
|
|
28
|
+
- [Circle](#circle)
|
|
29
|
+
- [Cubic](#cubic)
|
|
30
|
+
- [Group](#group)
|
|
31
|
+
- [Line](#line)
|
|
32
|
+
- [Path](#path)
|
|
33
|
+
- [Plane](#plane)
|
|
34
|
+
- [Polygon](#polygon)
|
|
35
|
+
- [Polyline](#polyline)
|
|
36
|
+
- [Quad](#quad)
|
|
37
|
+
- [Rect](#rect)
|
|
38
|
+
- [Sphere](#sphere)
|
|
39
|
+
- [Triangle](#triangle)
|
|
40
|
+
- [Constants & presets](#constants--presets)
|
|
41
|
+
- [Curve subdivision kernels](#curve-subdivision-kernels)
|
|
42
|
+
- [Polygon tessellation algorithms](#polygon-tessellation-algorithms)
|
|
43
|
+
- [Vertex convolution kernels](#vertex-convolution-kernels)
|
|
24
44
|
- [Support packages](#support-packages)
|
|
25
45
|
- [Related packages](#related-packages)
|
|
26
46
|
- [Status](#status)
|
|
@@ -41,46 +61,65 @@ name](http://thi.ng/geom-clj). All polymorphic operations built on
|
|
|
41
61
|
|
|
42
62
|
### Shape types
|
|
43
63
|
|
|
44
|
-
The following shape primitives are provided.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
|
52
|
-
|
|
53
|
-
| [
|
|
54
|
-
| [
|
|
55
|
-
| [
|
|
56
|
-
| [
|
|
57
|
-
| [
|
|
58
|
-
| [
|
|
59
|
-
| [
|
|
60
|
-
| [
|
|
61
|
-
| [
|
|
62
|
-
| [
|
|
63
|
-
| [
|
|
64
|
-
| [
|
|
65
|
-
| [
|
|
66
|
-
| [
|
|
67
|
-
| [
|
|
68
|
-
| [
|
|
69
|
-
| [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
The following shape primitives are provided. All these types are implemented as
|
|
65
|
+
basic data container classes with additional eponymous factory functions (e.g.
|
|
66
|
+
`Circle` (class) => `circle()` (function)), which are encouraged to be used
|
|
67
|
+
instead of calling class constructors directly. For many shapes there're
|
|
68
|
+
[multiple ways to create them](#shape-factory-functions), please also check
|
|
69
|
+
linked sources and/or docs.
|
|
70
|
+
|
|
71
|
+
| Shape/Form | Description | Hiccup support |
|
|
72
|
+
|--------------------------------------------------------------------------------------------------------|---------------------------------------|---------------------|
|
|
73
|
+
| [AABB](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/aabb.ts) | 3D Axis-aligned bounding box | ✅<sup>(1)</sup> |
|
|
74
|
+
| [Arc](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/arc.ts) | 2D elliptic arc | ✅ |
|
|
75
|
+
| [BPatch](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/bpatch.ts) | 2D cubic bezier patch (4x4 points) | ✅ |
|
|
76
|
+
| [Circle](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/circle.ts) | 2D circle | ✅ |
|
|
77
|
+
| [ComplexPolygon](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/complex-polygon.ts) | 2D polygon w/ holes | ✅ |
|
|
78
|
+
| [Cubic](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/cubic.ts) | 2D cubic bezier | ✅ |
|
|
79
|
+
| [Cubic3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/cubic3.ts) | 3D cubic bezier | ✅<sup>(1)</sup> |
|
|
80
|
+
| [Ellipse](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/ellipse.ts) | 2D ellipse | ✅ |
|
|
81
|
+
| [Extra](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/extra.ts) | Custom embedded hiccup/SVG data | ✅ |
|
|
82
|
+
| [Group](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/group.ts) | group of 2D shapes | ✅ |
|
|
83
|
+
| [Group3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/group3.ts) | group of 3D shapes | ✅<sup>(1)</sup> |
|
|
84
|
+
| [Line](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/line.ts) | 2D line segment | ✅ |
|
|
85
|
+
| [Line3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/line3.ts) | 3D line segment | ✅<sup>(1)</sup> |
|
|
86
|
+
| [Path](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/path.ts) | 2D path (w/ optional holes/sub-paths) | ✅ |
|
|
87
|
+
| [Path3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/path3.ts) | 3D path (w/ optional holes/sub-paths) | ✅<sup>(1),(2)</sup> |
|
|
88
|
+
| [Plane](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/plane.ts) | 3D plane | ✅<sup>(1)</sup> |
|
|
89
|
+
| [Points](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/points.ts) | 2D point cloud | ✅ |
|
|
90
|
+
| [Points3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/points3.ts) | 3D point cloud | ✅<sup>(1)</sup> |
|
|
91
|
+
| [Polygon](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/polygon.ts) | 2D simple polygon (no holes) | ✅ |
|
|
92
|
+
| [Polygon3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/polygon3.ts) | 3D simple polygon (no holes) | ✅ |
|
|
93
|
+
| [Polyline](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/polyline.ts) | 2D polyline | ✅ |
|
|
94
|
+
| [Polyline3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/polyline3.ts) | 3D polyline | ✅<sup>(1)</sup> |
|
|
95
|
+
| [Quad](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/quad.ts) | 2D quad (4-gon) | ✅ |
|
|
96
|
+
| [Quad3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/quad3.ts) | 2D quad (4-gon) | ✅<sup>(1)</sup> |
|
|
97
|
+
| [Quadratic](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/quadratic.ts) | 2D quadratic bezier | ✅ |
|
|
98
|
+
| [Quadratic3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/quadratic3.ts) | 3D quadratic bezier | ✅<sup>(1)</sup> |
|
|
99
|
+
| [Ray](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/ray.ts) | 2D ray | ✅ |
|
|
100
|
+
| [Ray3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/ray3.ts) | 3D ray | ✅<sup>(1)</sup> |
|
|
101
|
+
| [Rectangle](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/rect.ts) | 2D rectangle | ✅ |
|
|
102
|
+
| [Sphere](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/sphere.ts) | 3D sphere | ✅<sup>(1)</sup> |
|
|
103
|
+
| [Text](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/text.ts) | Basic stub for text labels | ✅<sup>(3)</sup> |
|
|
104
|
+
| [Triangle](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/triangle.ts) | 2D triangle | ✅ |
|
|
105
|
+
| [Triangle3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/triangle3.ts) | 3D triangle | ✅<sup>(1)</sup> |
|
|
106
|
+
|
|
107
|
+
- <sup>(1)</sup> valid hiccup format, but currently still missing **external** tool/library support
|
|
108
|
+
- <sup>(2)</sup> only lines, cubic & quadratic curve segments supported
|
|
73
109
|
- <sup>(3)</sup> merely treated as a point in space (e.g. used for placing text labels), no geometry of text itself
|
|
74
110
|
|
|
75
111
|
### Hiccup support
|
|
76
112
|
|
|
113
|
+
> [!NOTE]
|
|
114
|
+
> Sidebar with background information for advanced usage only. Most users can safely ignore this.
|
|
115
|
+
|
|
77
116
|
With very few exceptions these all are implementing the [`IToHiccup`
|
|
78
117
|
interface](https://docs.thi.ng/umbrella/api/interfaces/IToHiccup.html) and so
|
|
79
118
|
can be easily converted (via
|
|
80
119
|
[hiccup](https://github.com/thi-ng/umbrella/tree/develop/packages/hiccup)) to a
|
|
81
120
|
variety of other formats, incl. [conversion to SVG](#svg-support).
|
|
82
121
|
|
|
83
|
-
By design, for
|
|
122
|
+
By design, for more flexibility and for performance reasons, the hiccup flavor
|
|
84
123
|
used by this package is **not** compatible with that used by
|
|
85
124
|
[thi.ng/hiccup-svg](https://github.com/thi-ng/umbrella/tree/develop/packages/hiccup-svg),
|
|
86
125
|
though the latter provides a
|
|
@@ -88,6 +127,33 @@ though the latter provides a
|
|
|
88
127
|
function for that purpose. This is only needed for some cases of dynamic
|
|
89
128
|
in-browser SVG DOM creation...
|
|
90
129
|
|
|
130
|
+
Instead, the hiccup format used here for interim interop is compatible with that
|
|
131
|
+
used by the
|
|
132
|
+
[thi.ng/hiccup-canvas](https://github.com/thi-ng/umbrella/tree/develop/packages/hiccup-canvas)
|
|
133
|
+
package (see its readme for details) and avoids extraneous stringification of
|
|
134
|
+
geometry data and attrib values. A brief example to illustrate some differences:
|
|
135
|
+
|
|
136
|
+
```ts tangle:export/readme-hiccup.ts
|
|
137
|
+
import { circle, asSvg } from "@thi.ng/geom";
|
|
138
|
+
import { convertTree } from "@thi.ng/hiccup-svg";
|
|
139
|
+
|
|
140
|
+
// a circle with RGBA color attrib
|
|
141
|
+
const a = circle([100, 200], 300, { fill: [1, 0.5, 0, 1] });
|
|
142
|
+
|
|
143
|
+
// invocation of the IToHiccup interface (all shapes support it)
|
|
144
|
+
console.log(a.toHiccup());
|
|
145
|
+
// [ "circle", { fill: [ 1, 0, 0, 1 ] }, [ 100, 200 ], 300 ]
|
|
146
|
+
|
|
147
|
+
// convert shape into to a SVG compatible hiccup format
|
|
148
|
+
// (i.e. stringify attributes, convert colors etc.)
|
|
149
|
+
console.log(convertTree(a));
|
|
150
|
+
// [ "circle", { fill: "#ff8000", cx: "100", cy: "200", r: "300" } ]
|
|
151
|
+
|
|
152
|
+
// asSvg() automatically uses convertTree() when serializing shape(s) to SVG
|
|
153
|
+
console.log(asSvg(a));
|
|
154
|
+
// <circle fill="#ff8000" cx="100" cy="200" r="300"/>
|
|
155
|
+
```
|
|
156
|
+
|
|
91
157
|
### SVG support
|
|
92
158
|
|
|
93
159
|
SVG conversion is included via the
|
|
@@ -99,51 +165,216 @@ SVG conversion is included via the
|
|
|
99
165
|
The following operations are provided (many also applicable to shape groups
|
|
100
166
|
directly and/or perform automatic resampling/conversion if needed).
|
|
101
167
|
|
|
102
|
-
| Operation | Description
|
|
103
|
-
|
|
104
|
-
| [`applyTransforms()`](https://docs.thi.ng/umbrella/geom/functions/applyTransforms.html) | applies any spatial transformation attributes
|
|
105
|
-
| [`arcLength()`](https://docs.thi.ng/umbrella/geom/functions/arcLength.html) | compute arc length / perimeter of shape boundary
|
|
106
|
-
| [`area()`](https://docs.thi.ng/umbrella/geom/functions/area.html) | signed/unsigned surface area
|
|
107
|
-
| [`asCubic()`](https://docs.thi.ng/umbrella/geom/functions/asCubic.html) | convert shape boundary to cubic bezier segments
|
|
108
|
-
| [`asPath()`](https://docs.thi.ng/umbrella/geom/functions/asPath.html) | convert shape to path
|
|
109
|
-
| [`asPolygon()`](https://docs.thi.ng/umbrella/geom/functions/asPolygon.html) | convert shape to polygon(s)
|
|
110
|
-
| [`asPolyline()`](https://docs.thi.ng/umbrella/geom/functions/asPolyline.html) | convert shape to polyline(s)
|
|
111
|
-
| [`
|
|
112
|
-
| [`
|
|
113
|
-
| [`
|
|
114
|
-
| [`
|
|
115
|
-
| [`
|
|
116
|
-
| [`
|
|
117
|
-
| [`
|
|
118
|
-
| [`
|
|
119
|
-
| [`
|
|
120
|
-
| [`
|
|
121
|
-
| [`
|
|
122
|
-
| [`
|
|
123
|
-
| [`
|
|
124
|
-
| [`
|
|
125
|
-
| [`
|
|
126
|
-
| [`
|
|
127
|
-
| [`
|
|
128
|
-
| [`
|
|
129
|
-
| [`
|
|
130
|
-
| [`
|
|
131
|
-
| [`
|
|
132
|
-
| [`
|
|
133
|
-
| [`
|
|
134
|
-
| [`
|
|
135
|
-
| [`
|
|
136
|
-
| [`
|
|
137
|
-
| [`
|
|
138
|
-
| [`
|
|
139
|
-
| [`
|
|
140
|
-
| [`
|
|
141
|
-
| [`
|
|
142
|
-
| [`
|
|
143
|
-
| [`
|
|
144
|
-
| [`
|
|
145
|
-
| [`
|
|
146
|
-
| [`
|
|
168
|
+
| Operation | Description |
|
|
169
|
+
|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
|
|
170
|
+
| [`applyTransforms()`](https://docs.thi.ng/umbrella/geom/functions/applyTransforms.html) | applies any spatial transformation attributes |
|
|
171
|
+
| [`arcLength()`](https://docs.thi.ng/umbrella/geom/functions/arcLength.html) | compute arc length / perimeter of shape boundary |
|
|
172
|
+
| [`area()`](https://docs.thi.ng/umbrella/geom/functions/area.html) | signed/unsigned surface area |
|
|
173
|
+
| [`asCubic()`](https://docs.thi.ng/umbrella/geom/functions/asCubic.html) | convert shape boundary to cubic bezier segments |
|
|
174
|
+
| [`asPath()`](https://docs.thi.ng/umbrella/geom/functions/asPath.html) | convert shape to path |
|
|
175
|
+
| [`asPolygon()`](https://docs.thi.ng/umbrella/geom/functions/asPolygon.html) | convert shape to polygon(s) |
|
|
176
|
+
| [`asPolyline()`](https://docs.thi.ng/umbrella/geom/functions/asPolyline.html) | convert shape to polyline(s) |
|
|
177
|
+
| [`asSector()`](https://docs.thi.ng/umbrella/geom/functions/asSector.html) | convert arc to sector (path) |
|
|
178
|
+
| [`asSvg()`](https://docs.thi.ng/umbrella/geom/functions/asSvg.html) | serialize shape/group/hierarchy to SVG |
|
|
179
|
+
| [`bounds()`](https://docs.thi.ng/umbrella/geom/functions/bounds.html) | compute bounding box |
|
|
180
|
+
| [`center()`](https://docs.thi.ng/umbrella/geom/functions/center.html) | center shape around origin or point |
|
|
181
|
+
| [`centroid()`](https://docs.thi.ng/umbrella/geom/functions/centroid.html) | compute shape centroid |
|
|
182
|
+
| [`classifyPoint()`](https://docs.thi.ng/umbrella/geom/functions/classifyPoint.html) | classify point in relation to shape boundary (in/out) |
|
|
183
|
+
| [`clipConvex()`](https://docs.thi.ng/umbrella/geom/functions/clipConvex.html) | clip shape against convex boundary |
|
|
184
|
+
| [`closestPoint()`](https://docs.thi.ng/umbrella/geom/functions/closestPoint.html) | compute closest point on shape boundary |
|
|
185
|
+
| [`convexHull()`](https://docs.thi.ng/umbrella/geom/functions/convexHull.html) | compute convex hull (2d only) |
|
|
186
|
+
| [`convolve()`](https://docs.thi.ng/umbrella/geom/functions/convolve.html) | kernel based vertex convolution/filtering |
|
|
187
|
+
| [`edges()`](https://docs.thi.ng/umbrella/geom/functions/edges.html) | extract edges |
|
|
188
|
+
| [`fitIntoBounds2()`](https://docs.thi.ng/umbrella/geom/functions/fitIntoBounds2.html) | rescale/reposition a 2D shape into a destination boundary |
|
|
189
|
+
| [`fitIntoBounds3()`](https://docs.thi.ng/umbrella/geom/functions/fitIntoBounds3.html) | rescale/reposition a 3D shape into a destination boundary |
|
|
190
|
+
| [`fitAllIntoBounds2()`](https://docs.thi.ng/umbrella/geom/functions/fitAllIntoBounds2.html) | rescale/reposition multiple 2D shapes into a boundary |
|
|
191
|
+
| [`flip()`](https://docs.thi.ng/umbrella/geom/functions/flip.html) | reverse order (vertices or direction) |
|
|
192
|
+
| [`intersects()`](https://docs.thi.ng/umbrella/geom/functions/intersects.html) | pairwise shape intersection (various types) |
|
|
193
|
+
| [`mapPoint()`](https://docs.thi.ng/umbrella/geom/functions/mapPoint.html) | transform world space point into local shape UV space |
|
|
194
|
+
| [`offset()`](https://docs.thi.ng/umbrella/geom/functions/offset.html) | shape/path offsetting |
|
|
195
|
+
| [`pointAt()`](https://docs.thi.ng/umbrella/geom/functions/pointAt.html) | compute point on shape boundary at parametric position |
|
|
196
|
+
| [`pointInside()`](https://docs.thi.ng/umbrella/geom/functions/pointInside.html) | check if point is inside shape |
|
|
197
|
+
| [`proximity()`](https://docs.thi.ng/umbrella/geom/functions/proximity.html) | distance from point to shape boundary |
|
|
198
|
+
| [`resample()`](https://docs.thi.ng/umbrella/geom/functions/resample.html) | resample/convert shape |
|
|
199
|
+
| [`rotate()`](https://docs.thi.ng/umbrella/geom/functions/rotate.html) | rotate shape (2D only) |
|
|
200
|
+
| [`rotateAroundAxis()`](https://docs.thi.ng/umbrella/geom/functions/rotateAroundAxis.html) | rotate shape (3D only) |
|
|
201
|
+
| [`rotateX()`](https://docs.thi.ng/umbrella/geom/functions/rotateX.html) | rotate shape (3D only) |
|
|
202
|
+
| [`rotateY()`](https://docs.thi.ng/umbrella/geom/functions/rotateY.html) | rotate shape (3D only) |
|
|
203
|
+
| [`rotateZ()`](https://docs.thi.ng/umbrella/geom/functions/rotateZ.html) | rotate shape (3D only) |
|
|
204
|
+
| [`scale()`](https://docs.thi.ng/umbrella/geom/functions/scale.html) | scale shape (uniformly/non-uniformly) |
|
|
205
|
+
| [`scaleWithCenter()`](https://docs.thi.ng/umbrella/geom/functions/scaleWithCenter.html) | scale shape with pivot point |
|
|
206
|
+
| [`scatter()`](https://docs.thi.ng/umbrella/geom/functions/scatter.html) | create random points inside a shape boundary |
|
|
207
|
+
| [`simplify()`](https://docs.thi.ng/umbrella/geom/functions/simplify.html) | simplify shape/boundary (Douglas-Peucker) |
|
|
208
|
+
| [`splitArcLength()`](https://docs.thi.ng/umbrella/geom/functions/splitArcLength.html) | split shapes & groups based on max. arc length |
|
|
209
|
+
| [`splitAt()`](https://docs.thi.ng/umbrella/geom/functions/splitAt.html) | split shape/boundary at parametric position |
|
|
210
|
+
| [`splitNearPoint()`](https://docs.thi.ng/umbrella/geom/functions/splitNearPoint.html) | split shape/boundary near world position |
|
|
211
|
+
| [`subdivCurve()`](https://docs.thi.ng/umbrella/geom/functions/subdivCurve.html) | recursively apply curve subdivision kernel |
|
|
212
|
+
| [`tangentAt()`](https://docs.thi.ng/umbrella/geom/functions/tangentAt.html) | compute tangent at parametric position |
|
|
213
|
+
| [`tessellate()`](https://docs.thi.ng/umbrella/geom/functions/tessellate.html) | (recursively) tessellate shape |
|
|
214
|
+
| [`transformVertices()`](https://docs.thi.ng/umbrella/geom/functions/transformVertices.html) | apply custom function to each vertex |
|
|
215
|
+
| [`transform()`](https://docs.thi.ng/umbrella/geom/functions/transform.html) | apply transformation matrix |
|
|
216
|
+
| [`translate()`](https://docs.thi.ng/umbrella/geom/functions/translate.html) | translate shape |
|
|
217
|
+
| [`union()`](https://docs.thi.ng/umbrella/geom/functions/union.html) | compute shape union |
|
|
218
|
+
| [`unmapPoint()`](https://docs.thi.ng/umbrella/geom/functions/unmapPoint.html) | transform local shape UV point into world space |
|
|
219
|
+
| [`vertices()`](https://docs.thi.ng/umbrella/geom/functions/vertices.html) | extract/sample vertices from shape boundary |
|
|
220
|
+
| [`volume()`](https://docs.thi.ng/umbrella/geom/functions/volume.html) | compute shape volume (3D only) |
|
|
221
|
+
| [`warpPoint()`](https://docs.thi.ng/umbrella/geom/functions/warpPoint.html) | transfer single point between the local spaces defined by 2 shapes |
|
|
222
|
+
| [`warpPoints()`](https://docs.thi.ng/umbrella/geom/functions/warpPoints.html) | transfer points between the local spaces defined by 2 shapes |
|
|
223
|
+
| [`warpPointsBPatch()`](https://docs.thi.ng/umbrella/geom/functions/warpPointsBPatch.html) | transfer points to the local spaces of a bezier patch |
|
|
224
|
+
| [`withAttribs()`](https://docs.thi.ng/umbrella/geom/functions/withAttribs.html) | shallow copy of given shape with new `attribs` assigned |
|
|
225
|
+
|
|
226
|
+
### Shape factory functions
|
|
227
|
+
|
|
228
|
+
In addition to the [above listed direct shape type functions](#shape-types),
|
|
229
|
+
the following additional shape creation helpers are provided:
|
|
230
|
+
|
|
231
|
+
#### AABB
|
|
232
|
+
|
|
233
|
+
- [aabbFromMinMax()](https://docs.thi.ng/umbrella/geom/functions/.html)
|
|
234
|
+
- [aabbFromMinMaxWithMargin()](https://docs.thi.ng/umbrella/geom/functions/aabbFromMinMaxWithMargin.html)
|
|
235
|
+
- [aabbFromCentroid()](https://docs.thi.ng/umbrella/geom/functions/aabbFromCentroid.html)
|
|
236
|
+
- [aabbWithCentroidAndMargin()](https://docs.thi.ng/umbrella/geom/functions/aabbWithCentroidAndMargin.html)
|
|
237
|
+
- [intersectionAABB()](https://docs.thi.ng/umbrella/geom/functions/intersectionAABB.html)
|
|
238
|
+
- [inscribedAABB()](https://docs.thi.ng/umbrella/geom/functions/inscribedAABB.html)
|
|
239
|
+
|
|
240
|
+
#### Arc
|
|
241
|
+
|
|
242
|
+
- [arcFrom2Points()](https://docs.thi.ng/umbrella/geom/functions/arcFrom2Points.html)
|
|
243
|
+
|
|
244
|
+
#### Bezier patch
|
|
245
|
+
|
|
246
|
+
- [bpatchFromQuad()](https://docs.thi.ng/umbrella/geom/functions/bpatchFromQuad.html)
|
|
247
|
+
- [bpatchFromHex()](https://docs.thi.ng/umbrella/geom/functions/bpatchFromHex.html)
|
|
248
|
+
|
|
249
|
+
#### Circle
|
|
250
|
+
|
|
251
|
+
- [circleFrom2Points()](https://docs.thi.ng/umbrella/geom/functions/circleFrom2Points.html)
|
|
252
|
+
- [circleFrom3Points()](https://docs.thi.ng/umbrella/geom/functions/circleFrom3Points.html)
|
|
253
|
+
|
|
254
|
+
#### Cubic
|
|
255
|
+
|
|
256
|
+
- [cubicFromArc()](https://docs.thi.ng/umbrella/geom/functions/cubicFromArc.html)
|
|
257
|
+
- [cubicFromLine()](https://docs.thi.ng/umbrella/geom/functions/cubicFromLine.html)
|
|
258
|
+
- [cubicFromLine3()](https://docs.thi.ng/umbrella/geom/functions/cubicFromLine3.html)
|
|
259
|
+
- [cubicFromQuadratic()](https://docs.thi.ng/umbrella/geom/functions/cubicFromQuadratic.html)
|
|
260
|
+
- [cubicFromQuadratic3()](https://docs.thi.ng/umbrella/geom/functions/cubicFromQuadratic3.html)
|
|
261
|
+
|
|
262
|
+
#### Group
|
|
263
|
+
|
|
264
|
+
- [groupFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/groupFromTessellation.html)
|
|
265
|
+
|
|
266
|
+
#### Line
|
|
267
|
+
|
|
268
|
+
- [clippedLine()](https://docs.thi.ng/umbrella/geom/functions/clippedLine.html)
|
|
269
|
+
|
|
270
|
+
#### Path
|
|
271
|
+
|
|
272
|
+
- [pathBuilder()](https://docs.thi.ng/umbrella/geom/functions/pathBuilder.html)
|
|
273
|
+
- [pathFromSvg()](https://docs.thi.ng/umbrella/geom/functions/pathFromSvg.html)
|
|
274
|
+
- [pathFromCubics()](https://docs.thi.ng/umbrella/geom/functions/pathFromCubics.html)
|
|
275
|
+
- [pathFromCubics3()](https://docs.thi.ng/umbrella/geom/functions/pathFromCubics3.html)
|
|
276
|
+
- [normalizedPath()](https://docs.thi.ng/umbrella/geom/functions/normalizedPath.html)
|
|
277
|
+
- [normalizedPath3()](https://docs.thi.ng/umbrella/geom/functions/normalizedPath3.html)
|
|
278
|
+
- [roundedRect()](https://docs.thi.ng/umbrella/geom/functions/roundedRect.html)
|
|
279
|
+
|
|
280
|
+
#### Plane
|
|
281
|
+
|
|
282
|
+
- [planeWithPoint()](https://docs.thi.ng/umbrella/geom/functions/planeWithPoint.html)
|
|
283
|
+
- [planeFrom3Points()](https://docs.thi.ng/umbrella/geom/functions/planeFrom3Points.html)
|
|
284
|
+
- [planeFromRay()](https://docs.thi.ng/umbrella/geom/functions/planeFromRay.html)
|
|
285
|
+
|
|
286
|
+
#### Polygon
|
|
287
|
+
|
|
288
|
+
- [smoothPolygon()](https://docs.thi.ng/umbrella/geom/functions/smoothPolygon.html)
|
|
289
|
+
- [star()](https://docs.thi.ng/umbrella/geom/functions/star.html)
|
|
290
|
+
- [starWithCentroid()](https://docs.thi.ng/umbrella/geom/functions/starWithCentroid.html)
|
|
291
|
+
|
|
292
|
+
#### Polyline
|
|
293
|
+
|
|
294
|
+
- [smoothPolyline()](https://docs.thi.ng/umbrella/geom/functions/smoothPolyline.html)
|
|
295
|
+
- [spiral()](https://docs.thi.ng/umbrella/geom/functions/spiral.html)
|
|
296
|
+
|
|
297
|
+
#### Quad
|
|
298
|
+
|
|
299
|
+
- [quadOnPlane()](https://docs.thi.ng/umbrella/geom/functions/quadOnPlane.html)
|
|
300
|
+
|
|
301
|
+
#### Rect
|
|
302
|
+
|
|
303
|
+
- [rectFromMinMax()](https://docs.thi.ng/umbrella/geom/functions/rectFromMinMax.html)
|
|
304
|
+
- [rectFromMinMaxWithMargin()](https://docs.thi.ng/umbrella/geom/functions/rectFromMinMaxWithMargin.html)
|
|
305
|
+
- [rectWithCentroid()](https://docs.thi.ng/umbrella/geom/functions/rectWithCentroid.html)
|
|
306
|
+
- [rectWithCentroidAndMargin()](https://docs.thi.ng/umbrella/geom/functions/rectWithCentroidAndMargin.html)
|
|
307
|
+
- [intersectionRect()](https://docs.thi.ng/umbrella/geom/functions/intersectionRect.html)
|
|
308
|
+
- [inscribedSquare()](https://docs.thi.ng/umbrella/geom/functions/inscribedSquare.html)
|
|
309
|
+
- [inscribedSquareHex()](https://docs.thi.ng/umbrella/geom/functions/inscribedSquareHex.html)
|
|
310
|
+
|
|
311
|
+
#### Sphere
|
|
312
|
+
|
|
313
|
+
- [sphereFrom2Points()](https://docs.thi.ng/umbrella/geom/functions/sphereFrom2Points.html)
|
|
314
|
+
|
|
315
|
+
#### Triangle
|
|
316
|
+
|
|
317
|
+
- [equilateralTriangle()](https://docs.thi.ng/umbrella/geom/functions/equilateralTriangle.html)
|
|
318
|
+
|
|
319
|
+
### Constants & presets
|
|
320
|
+
|
|
321
|
+
Some of the shape operations require configuration with specific algorithms
|
|
322
|
+
and/or constants. In all cases this relies on a completely extensible mechanism,
|
|
323
|
+
but the package provides presets for common options/implementations:
|
|
324
|
+
|
|
325
|
+
#### Curve subdivision kernels
|
|
326
|
+
|
|
327
|
+
To be used with [`subdivideCurve()`](https://docs.thi.ng/umbrella/geom/functions/subdivCurve.html):
|
|
328
|
+
|
|
329
|
+
- [`SUBDIV_CHAIKIN_CLOSED`](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_CHAIKIN_CLOSED.html)
|
|
330
|
+
- [`SUBDIV_CHAIKIN_OPEN`](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_CHAIKIN_OPEN.html)
|
|
331
|
+
- [`SUBDIV_CUBIC_CLOSED`](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_CUBIC_CLOSED.html)
|
|
332
|
+
- [`SUBDIV_DISPLACE`](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_DISPLACE.html)
|
|
333
|
+
- [`SUBDIV_MID_CLOSED`](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_MID_CLOSED.html)
|
|
334
|
+
- [`SUBDIV_MID_OPEN`](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_MID_OPEN.html)
|
|
335
|
+
- [`SUBDIV_THIRDS_CLOSED`](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_THIRDS_CLOSED.html)
|
|
336
|
+
- [`SUBDIV_THIRDS_OPEN`](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_THIRDS_OPEN.html)
|
|
337
|
+
|
|
338
|
+
#### Polygon tessellation algorithms
|
|
339
|
+
|
|
340
|
+
To be used with [`tessellate()`](https://docs.thi.ng/umbrella/geom/functions/tessellate.html):
|
|
341
|
+
|
|
342
|
+
See [thi.ng/geom-tessellate
|
|
343
|
+
readme](https://github.com/thi-ng/umbrella/blob/develop/packages/geom-tessellate/README.md#tessellators)
|
|
344
|
+
for diagrams/illustrations of each algorithm!
|
|
345
|
+
|
|
346
|
+
- [`TESSELLATE_EARCUT`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_EARCUT.html)
|
|
347
|
+
- [`TESSELLATE_EARCUT_COMPLEX`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_EARCUT_COMPLEX.html)
|
|
348
|
+
- [`TESSELLATE_EDGE_SPLIT`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_EDGE_SPLIT.html)
|
|
349
|
+
- [`TESSELLATE_INSET`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_INSET.html)
|
|
350
|
+
- [`TESSELLATE_QUAD_FAN`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_QUAD_FAN.html)
|
|
351
|
+
- [`TESSELLATE_RIM_TRIS`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_RIM_TRIS.html)
|
|
352
|
+
- [`TESSELLATE_TRI_FAN`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_TRI_FAN.html)
|
|
353
|
+
- [`TESSELLATE_TRI_FAN_BOUNDARY`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_TRI_FAN_BOUNDARY.html)
|
|
354
|
+
- [`TESSELLATE_TRI_FAN_SPLIT`](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_TRI_FAN_SPLIT.html)
|
|
355
|
+
|
|
356
|
+
Tessellation behaviors:
|
|
357
|
+
|
|
358
|
+
- [`basicTessellation()`](https://docs.thi.ng/umbrella/geom/functions/basicTessellation.html):
|
|
359
|
+
default impl
|
|
360
|
+
- [`meshTessellation()`](https://docs.thi.ng/umbrella/geom/functions/meshTessellation.html):
|
|
361
|
+
uses kD-tree to deduplicate result points
|
|
362
|
+
|
|
363
|
+
Tessellation post-processing:
|
|
364
|
+
|
|
365
|
+
- [edgesFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/edgesFromTessellation.html)
|
|
366
|
+
- [edgePointsFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/edgePointsFromTessellation.html)
|
|
367
|
+
- [graphFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/graphFromTessellation.html)
|
|
368
|
+
- [groupFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/groupFromTessellation.html)
|
|
369
|
+
|
|
370
|
+
#### Vertex convolution kernels
|
|
371
|
+
|
|
372
|
+
To be used with [`convolve()`](https://docs.thi.ng/umbrella/geom/functions/convolve.html):
|
|
373
|
+
|
|
374
|
+
- [`KERNEL_BOX`](https://docs.thi.ng/umbrella/geom/variables/KERNEL_BOX.html)
|
|
375
|
+
- [`KERNEL_GAUSSIAN`](https://docs.thi.ng/umbrella/geom/variables/KERNEL_GAUSSIAN.html)
|
|
376
|
+
- [`KERNEL_TRI`](https://docs.thi.ng/umbrella/geom/variables/KERNEL_TRI.html)
|
|
377
|
+
---
|
|
147
378
|
|
|
148
379
|
This package acts as a higher-level frontend for most of the following related
|
|
149
380
|
packages (which are more low-level, lightweight and usable by themselves too):
|
|
@@ -170,6 +401,7 @@ packages (which are more low-level, lightweight and usable by themselves too):
|
|
|
170
401
|
- [@thi.ng/geom-tessellate](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-tessellate) - 2D/3D convex polygon tessellators
|
|
171
402
|
- [@thi.ng/geom-trace-bitmap](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-trace-bitmap) - Bitmap image to hairline vector and point cloud conversions
|
|
172
403
|
- [@thi.ng/geom-voronoi](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-voronoi) - Fast, incremental 2D Delaunay & Voronoi mesh implementation
|
|
404
|
+
- [@thi.ng/geom-webgl](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-webgl) - WebGL geometry/shape conversion & interop
|
|
173
405
|
|
|
174
406
|
## Related packages
|
|
175
407
|
|
|
@@ -213,10 +445,11 @@ For Node.js REPL:
|
|
|
213
445
|
const geom = await import("@thi.ng/geom");
|
|
214
446
|
```
|
|
215
447
|
|
|
216
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
448
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 17.20 KB
|
|
217
449
|
|
|
218
450
|
## Dependencies
|
|
219
451
|
|
|
452
|
+
- [@thi.ng/adjacency](https://github.com/thi-ng/umbrella/tree/develop/packages/adjacency)
|
|
220
453
|
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/develop/packages/api)
|
|
221
454
|
- [@thi.ng/arrays](https://github.com/thi-ng/umbrella/tree/develop/packages/arrays)
|
|
222
455
|
- [@thi.ng/associative](https://github.com/thi-ng/umbrella/tree/develop/packages/associative)
|
|
@@ -224,7 +457,6 @@ Package sizes (brotli'd, pre-treeshake): ESM: 14.61 KB
|
|
|
224
457
|
- [@thi.ng/defmulti](https://github.com/thi-ng/umbrella/tree/develop/packages/defmulti)
|
|
225
458
|
- [@thi.ng/equiv](https://github.com/thi-ng/umbrella/tree/develop/packages/equiv)
|
|
226
459
|
- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/develop/packages/errors)
|
|
227
|
-
- [@thi.ng/geom-api](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-api)
|
|
228
460
|
- [@thi.ng/geom-arc](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-arc)
|
|
229
461
|
- [@thi.ng/geom-clip-line](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-clip-line)
|
|
230
462
|
- [@thi.ng/geom-clip-poly](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-clip-poly)
|
|
@@ -251,45 +483,50 @@ Several projects in this repo's
|
|
|
251
483
|
[/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
|
|
252
484
|
directory are using this package:
|
|
253
485
|
|
|
254
|
-
| Screenshot
|
|
255
|
-
|
|
256
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/boid-basics.png" width="240"/>
|
|
257
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/canvas-recorder.png" width="240"/>
|
|
258
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fiber-basics.png" width="240"/>
|
|
259
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-
|
|
260
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-
|
|
261
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
262
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-
|
|
263
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-
|
|
264
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
265
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/geom
|
|
266
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-
|
|
267
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
268
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
269
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
270
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
271
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
272
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
273
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
274
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
275
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
276
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
277
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
278
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
279
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
280
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
281
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/
|
|
282
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/spline
|
|
283
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
284
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
285
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/
|
|
486
|
+
| Screenshot | Description | Live demo | Source |
|
|
487
|
+
|:------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:-------------------------------------------------------------|:------------------------------------------------------------------------------------------|
|
|
488
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/boid-basics.png" width="240"/> | Basic 2D boid simulation and spatial indexing neighbor lookups | [Demo](https://demo.thi.ng/umbrella/boid-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/boid-basics) |
|
|
489
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/canvas-recorder.png" width="240"/> | Self-modifying, animated typographic grid with emergent complex patterns | [Demo](https://demo.thi.ng/umbrella/canvas-recorder/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/canvas-recorder) |
|
|
490
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fiber-basics.png" width="240"/> | Fiber-based cooperative multitasking basics | [Demo](https://demo.thi.ng/umbrella/fiber-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/fiber-basics) |
|
|
491
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-classify-point.png" width="240"/> | Polygon point classification (inside/boundary/outside) | [Demo](https://demo.thi.ng/umbrella/geom-classify-point/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-classify-point) |
|
|
492
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-complex-poly.png" width="240"/> | Shape conversions & operations using polygons with holes | [Demo](https://demo.thi.ng/umbrella/geom-complex-poly/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-complex-poly) |
|
|
493
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-convex-hull.png" width="240"/> | Convex hull & shape clipping of 2D polygons | [Demo](https://demo.thi.ng/umbrella/geom-convex-hull/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-convex-hull) |
|
|
494
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-csv-piechart.png" width="240"/> | Piechart visualization of CSV data | [Demo](https://demo.thi.ng/umbrella/geom-csv-piechart/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-csv-piechart) |
|
|
495
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-extra-hiccup.jpg" width="240"/> | Embedding thi.ng/hiccup data/elements in thi.ng/geom shape hierarchies | [Demo](https://demo.thi.ng/umbrella/geom-extra-hiccup/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-extra-hiccup) |
|
|
496
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/geom/geom-fuzz.png" width="240"/> | geom-fuzz basic shape & fill examples | [Demo](https://demo.thi.ng/umbrella/geom-fuzz-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-fuzz-basics) |
|
|
497
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-hexgrid.png" width="240"/> | Hex grid generation & tessellations | [Demo](https://demo.thi.ng/umbrella/geom-hexgrid/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-hexgrid) |
|
|
498
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-sdf-logo.jpg" width="240"/> | (Re)Constructing the thi.ng logo using a 2D signed-distance field | [Demo](https://demo.thi.ng/umbrella/geom-sdf-logo/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-sdf-logo) |
|
|
499
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-sdf-path.png" width="240"/> | SVG path to SDF, applying deformation and converting back to SVG | [Demo](https://demo.thi.ng/umbrella/geom-sdf-path/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-sdf-path) |
|
|
500
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-terrain-viz.jpg" width="240"/> | 2.5D hidden line visualization of digital elevation files (DEM) | [Demo](https://demo.thi.ng/umbrella/geom-terrain-viz/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-terrain-viz) |
|
|
501
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/geom/tessel.png" width="240"/> | Animated, recursive polygon tessellations | [Demo](https://demo.thi.ng/umbrella/geom-tessel/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-tessel) |
|
|
502
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-unique-edges.png" width="240"/> | Iterating the unique edges of a tessellation | [Demo](https://demo.thi.ng/umbrella/geom-unique-edges/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-unique-edges) |
|
|
503
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-voronoi-mst.jpg" width="240"/> | Poisson-disk shape-aware sampling, Voronoi & Minimum Spanning Tree visualization | [Demo](https://demo.thi.ng/umbrella/geom-voronoi-mst/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-voronoi-mst) |
|
|
504
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-webgl-attrib-pool.jpg" width="240"/> | Augmenting thi.ng/geom shapes for WebGL, using instancing & attribute buffers | [Demo](https://demo.thi.ng/umbrella/geom-webgl-attrib-pool/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-webgl-attrib-pool) |
|
|
505
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-webgl-basics.jpg" width="240"/> | Converting thi.ng/geom shape types for WebGL | [Demo](https://demo.thi.ng/umbrella/geom-webgl-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-webgl-basics) |
|
|
506
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/gesture-analysis.png" width="240"/> | Mouse gesture / stroke analysis, simplification, corner detection | [Demo](https://demo.thi.ng/umbrella/gesture-analysis/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/gesture-analysis) |
|
|
507
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hdom-canvas-particles.jpg" width="240"/> | 2D Bezier curve-guided particle system | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-particles/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-particles) |
|
|
508
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hiccup-canvas-arcs.jpg" width="240"/> | Animated arcs & drawing using hiccup-canvas | [Demo](https://demo.thi.ng/umbrella/hiccup-canvas-arcs/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hiccup-canvas-arcs) |
|
|
509
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/imgui/imgui-all.png" width="240"/> | Canvas based Immediate Mode GUI components | [Demo](https://demo.thi.ng/umbrella/imgui/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/imgui) |
|
|
510
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/geom/geom-isoline.png" width="240"/> | Animated sine plasma effect visualized using contour lines | [Demo](https://demo.thi.ng/umbrella/iso-plasma/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/iso-plasma) |
|
|
511
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/kmeans-viz.jpg" width="240"/> | k-means clustering visualization | [Demo](https://demo.thi.ng/umbrella/kmeans-viz/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/kmeans-viz) |
|
|
512
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pointfree-geom.jpg" width="240"/> | Live coding playground for 2D geometry generation using @thi.ng/pointfree-lang | [Demo](https://demo.thi.ng/umbrella/pointfree-geom/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pointfree-geom) |
|
|
513
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/poisson/poisson.jpg" width="240"/> | 2D Poisson-disc sampler with procedural gradient map | [Demo](https://demo.thi.ng/umbrella/poisson-circles/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poisson-circles) |
|
|
514
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-spline.png" width="240"/> | Polygon to cubic curve conversion & visualization | [Demo](https://demo.thi.ng/umbrella/poly-spline/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-spline) |
|
|
515
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-subdiv.jpg" width="240"/> | Animated, iterative polygon subdivisions & visualization | [Demo](https://demo.thi.ng/umbrella/poly-subdiv/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-subdiv) |
|
|
516
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/quasi-lattice.png" width="240"/> | Quasi-random lattice generator | [Demo](https://demo.thi.ng/umbrella/quasi-lattice/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/quasi-lattice) |
|
|
517
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-canvas-basics.jpg" width="240"/> | Minimal rdom-canvas animation | [Demo](https://demo.thi.ng/umbrella/rdom-canvas-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-canvas-basics) |
|
|
518
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rotating-voronoi.jpg" width="240"/> | Animated Voronoi diagram, cubic splines & SVG download | [Demo](https://demo.thi.ng/umbrella/rotating-voronoi/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rotating-voronoi) |
|
|
519
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/scenegraph.png" width="240"/> | 2D scenegraph & shape picking | [Demo](https://demo.thi.ng/umbrella/scenegraph/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/scenegraph) |
|
|
520
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/scenegraph-image.png" width="240"/> | 2D scenegraph & image map based geometry manipulation | [Demo](https://demo.thi.ng/umbrella/scenegraph-image/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/scenegraph-image) |
|
|
521
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/spline-tangent.png" width="240"/> | Compute cubic spline position & tangent using Dual Numbers | [Demo](https://demo.thi.ng/umbrella/spline-tangent/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/spline-tangent) |
|
|
522
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/svg-resample.png" width="240"/> | SVG path parsing & dynamic resampling | [Demo](https://demo.thi.ng/umbrella/svg-resample/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/svg-resample) |
|
|
523
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/text-canvas.png" width="240"/> | 3D wireframe textmode demo | [Demo](https://demo.thi.ng/umbrella/text-canvas/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/text-canvas) |
|
|
524
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/trace-bitmap.jpg" width="240"/> | Multi-layer vectorization & dithering of bitmap images | [Demo](https://demo.thi.ng/umbrella/trace-bitmap/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/trace-bitmap) |
|
|
286
525
|
|
|
287
526
|
## API
|
|
288
527
|
|
|
289
528
|
[Generated API docs](https://docs.thi.ng/umbrella/geom/)
|
|
290
529
|
|
|
291
|
-
TODO
|
|
292
|
-
|
|
293
530
|
## Authors
|
|
294
531
|
|
|
295
532
|
- [Karsten Schmidt](https://thi.ng)
|