@thi.ng/geom 7.0.1 → 8.0.1
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 +196 -1
- package/README.md +357 -114
- 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 +81 -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 +36 -1
- package/index.js +36 -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 189 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,71 @@ 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 2D/3D 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
|
+
> [!IMPORTANT]
|
|
72
|
+
> Support for 3D shapes is WIP and currently limited to the various operations
|
|
73
|
+
> provided by this package, but does not _yet_ find any usage outside (e.g. for
|
|
74
|
+
> visualization). Sill, even the ops supported so far can be useful for many
|
|
75
|
+
> use cases...
|
|
76
|
+
|
|
77
|
+
| Shape/Form | Description | Hiccup support |
|
|
78
|
+
|--------------------------------------------------------------------------------------------------------|---------------------------------------|---------------------|
|
|
79
|
+
| [AABB](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/aabb.ts) | 3D Axis-aligned bounding box | ✅<sup>(1)</sup> |
|
|
80
|
+
| [Arc](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/arc.ts) | 2D elliptic arc | ✅ |
|
|
81
|
+
| [BPatch](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/bpatch.ts) | 2D cubic bezier patch (4x4 points) | ✅ |
|
|
82
|
+
| [Circle](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/circle.ts) | 2D circle | ✅ |
|
|
83
|
+
| [ComplexPolygon](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/complex-polygon.ts) | 2D polygon w/ holes | ✅ |
|
|
84
|
+
| [Cubic](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/cubic.ts) | 2D cubic bezier | ✅ |
|
|
85
|
+
| [Cubic3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/cubic3.ts) | 3D cubic bezier | ✅<sup>(1)</sup> |
|
|
86
|
+
| [Ellipse](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/ellipse.ts) | 2D ellipse | ✅ |
|
|
87
|
+
| [Extra](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/extra.ts) | Custom embedded hiccup/SVG data | ✅ |
|
|
88
|
+
| [Group](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/group.ts) | group of 2D shapes | ✅ |
|
|
89
|
+
| [Group3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/group3.ts) | group of 3D shapes | ✅<sup>(1)</sup> |
|
|
90
|
+
| [Line](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/line.ts) | 2D line segment | ✅ |
|
|
91
|
+
| [Line3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/line3.ts) | 3D line segment | ✅<sup>(1)</sup> |
|
|
92
|
+
| [Path](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/path.ts) | 2D path (w/ optional holes/sub-paths) | ✅ |
|
|
93
|
+
| [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> |
|
|
94
|
+
| [Plane](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/plane.ts) | 3D plane | ✅<sup>(1)</sup> |
|
|
95
|
+
| [Points](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/points.ts) | 2D point cloud | ✅ |
|
|
96
|
+
| [Points3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/points3.ts) | 3D point cloud | ✅<sup>(1)</sup> |
|
|
97
|
+
| [Polygon](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/polygon.ts) | 2D simple polygon (no holes) | ✅ |
|
|
98
|
+
| [Polygon3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/polygon3.ts) | 3D simple polygon (no holes) | ✅ |
|
|
99
|
+
| [Polyline](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/polyline.ts) | 2D polyline | ✅ |
|
|
100
|
+
| [Polyline3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/polyline3.ts) | 3D polyline | ✅<sup>(1)</sup> |
|
|
101
|
+
| [Quad](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/quad.ts) | 2D quad (4-gon) | ✅ |
|
|
102
|
+
| [Quad3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/quad3.ts) | 2D quad (4-gon) | ✅<sup>(1)</sup> |
|
|
103
|
+
| [Quadratic](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/quadratic.ts) | 2D quadratic bezier | ✅ |
|
|
104
|
+
| [Quadratic3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/quadratic3.ts) | 3D quadratic bezier | ✅<sup>(1)</sup> |
|
|
105
|
+
| [Ray](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/ray.ts) | 2D ray | ✅ |
|
|
106
|
+
| [Ray3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/ray3.ts) | 3D ray | ✅<sup>(1)</sup> |
|
|
107
|
+
| [Rectangle](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/rect.ts) | 2D rectangle | ✅ |
|
|
108
|
+
| [Sphere](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/sphere.ts) | 3D sphere | ✅<sup>(1)</sup> |
|
|
109
|
+
| [Text](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/text.ts) | Basic stub for text labels | ✅<sup>(3)</sup> |
|
|
110
|
+
| [Triangle](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/triangle.ts) | 2D triangle | ✅ |
|
|
111
|
+
| [Triangle3](https://github.com/thi-ng/umbrella/blob/develop/packages/geom/src/triangle3.ts) | 3D triangle | ✅<sup>(1)</sup> |
|
|
112
|
+
|
|
113
|
+
- <sup>(1)</sup> valid hiccup format, but currently still missing **external** tool/library support
|
|
114
|
+
- <sup>(2)</sup> only lines, cubic & quadratic curve segments supported
|
|
73
115
|
- <sup>(3)</sup> merely treated as a point in space (e.g. used for placing text labels), no geometry of text itself
|
|
74
116
|
|
|
75
117
|
### Hiccup support
|
|
76
118
|
|
|
119
|
+
> [!NOTE]
|
|
120
|
+
> Sidebar with background information for advanced usage only. Most users can safely ignore this.
|
|
121
|
+
|
|
77
122
|
With very few exceptions these all are implementing the [`IToHiccup`
|
|
78
123
|
interface](https://docs.thi.ng/umbrella/api/interfaces/IToHiccup.html) and so
|
|
79
124
|
can be easily converted (via
|
|
80
125
|
[hiccup](https://github.com/thi-ng/umbrella/tree/develop/packages/hiccup)) to a
|
|
81
126
|
variety of other formats, incl. [conversion to SVG](#svg-support).
|
|
82
127
|
|
|
83
|
-
By design, for
|
|
128
|
+
By design, for more flexibility and for performance reasons, the hiccup flavor
|
|
84
129
|
used by this package is **not** compatible with that used by
|
|
85
130
|
[thi.ng/hiccup-svg](https://github.com/thi-ng/umbrella/tree/develop/packages/hiccup-svg),
|
|
86
131
|
though the latter provides a
|
|
@@ -88,9 +133,36 @@ though the latter provides a
|
|
|
88
133
|
function for that purpose. This is only needed for some cases of dynamic
|
|
89
134
|
in-browser SVG DOM creation...
|
|
90
135
|
|
|
136
|
+
Instead, the hiccup format used here for interim interop is compatible with that
|
|
137
|
+
used by the
|
|
138
|
+
[thi.ng/hiccup-canvas](https://github.com/thi-ng/umbrella/tree/develop/packages/hiccup-canvas)
|
|
139
|
+
package (see its readme for details) and avoids extraneous stringification of
|
|
140
|
+
geometry data and attrib values. A brief example to illustrate some differences:
|
|
141
|
+
|
|
142
|
+
```ts tangle:export/readme-hiccup.ts
|
|
143
|
+
import { circle, asSvg } from "@thi.ng/geom";
|
|
144
|
+
import { convertTree } from "@thi.ng/hiccup-svg";
|
|
145
|
+
|
|
146
|
+
// a circle with RGBA color attrib
|
|
147
|
+
const a = circle([100, 200], 300, { fill: [1, 0.5, 0, 1] });
|
|
148
|
+
|
|
149
|
+
// invocation of the IToHiccup interface (all shapes support it)
|
|
150
|
+
console.log(a.toHiccup());
|
|
151
|
+
// [ "circle", { fill: [ 1, 0, 0, 1 ] }, [ 100, 200 ], 300 ]
|
|
152
|
+
|
|
153
|
+
// convert shape into to a SVG compatible hiccup format
|
|
154
|
+
// (i.e. stringify attributes, convert colors etc.)
|
|
155
|
+
console.log(convertTree(a));
|
|
156
|
+
// [ "circle", { fill: "#ff8000", cx: "100", cy: "200", r: "300" } ]
|
|
157
|
+
|
|
158
|
+
// asSvg() automatically uses convertTree() when serializing shape(s) to SVG
|
|
159
|
+
console.log(asSvg(a));
|
|
160
|
+
// <circle fill="#ff8000" cx="100" cy="200" r="300"/>
|
|
161
|
+
```
|
|
162
|
+
|
|
91
163
|
### SVG support
|
|
92
164
|
|
|
93
|
-
SVG conversion is included via the
|
|
165
|
+
For 2D shape types only, SVG conversion is included via the
|
|
94
166
|
[`asSvg()`](https://docs.thi.ng/umbrella/geom/functions/asSvg.html) and
|
|
95
167
|
[`svgDoc()`](https://docs.thi.ng/umbrella/geom/functions/svgDoc.html) functions.
|
|
96
168
|
|
|
@@ -99,51 +171,217 @@ SVG conversion is included via the
|
|
|
99
171
|
The following operations are provided (many also applicable to shape groups
|
|
100
172
|
directly and/or perform automatic resampling/conversion if needed).
|
|
101
173
|
|
|
102
|
-
| Operation
|
|
103
|
-
|
|
104
|
-
| [`applyTransforms()`](https://docs.thi.ng/umbrella/geom/functions/applyTransforms.html)
|
|
105
|
-
| [`arcLength()`](https://docs.thi.ng/umbrella/geom/functions/arcLength.html)
|
|
106
|
-
| [`area()`](https://docs.thi.ng/umbrella/geom/functions/area.html)
|
|
107
|
-
| [`asCubic()`](https://docs.thi.ng/umbrella/geom/functions/asCubic.html)
|
|
108
|
-
| [`asPath()`](https://docs.thi.ng/umbrella/geom/functions/asPath.html)
|
|
109
|
-
| [`asPolygon()`](https://docs.thi.ng/umbrella/geom/functions/asPolygon.html)
|
|
110
|
-
| [`asPolyline()`](https://docs.thi.ng/umbrella/geom/functions/asPolyline.html)
|
|
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
|
-
| [`
|
|
174
|
+
| Operation | Description |
|
|
175
|
+
|-----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
|
|
176
|
+
| [`applyTransforms()`](https://docs.thi.ng/umbrella/geom/functions/applyTransforms.html) | applies any spatial transformation attributes |
|
|
177
|
+
| [`arcLength()`](https://docs.thi.ng/umbrella/geom/functions/arcLength.html) | compute arc length / perimeter of shape boundary |
|
|
178
|
+
| [`area()`](https://docs.thi.ng/umbrella/geom/functions/area.html) | signed/unsigned surface area |
|
|
179
|
+
| [`asCubic()`](https://docs.thi.ng/umbrella/geom/functions/asCubic.html) | convert shape boundary to cubic bezier segments |
|
|
180
|
+
| [`asPath()`](https://docs.thi.ng/umbrella/geom/functions/asPath.html) | convert shape to path |
|
|
181
|
+
| [`asPolygon()`](https://docs.thi.ng/umbrella/geom/functions/asPolygon.html) | convert shape to polygon(s) |
|
|
182
|
+
| [`asPolyline()`](https://docs.thi.ng/umbrella/geom/functions/asPolyline.html) | convert shape to polyline(s) |
|
|
183
|
+
| [`asSector()`](https://docs.thi.ng/umbrella/geom/functions/asSector.html) | convert arc to sector (path) |
|
|
184
|
+
| [`asSvg()`](https://docs.thi.ng/umbrella/geom/functions/asSvg.html) | serialize shape/group/hierarchy to SVG |
|
|
185
|
+
| [`bounds()`](https://docs.thi.ng/umbrella/geom/functions/bounds.html) | compute bounding box |
|
|
186
|
+
| [`center()`](https://docs.thi.ng/umbrella/geom/functions/center.html) | center shape around origin or point |
|
|
187
|
+
| [`centroid()`](https://docs.thi.ng/umbrella/geom/functions/centroid.html) | compute shape centroid |
|
|
188
|
+
| [`classifyPoint()`](https://docs.thi.ng/umbrella/geom/functions/classifyPoint.html) | classify point in relation to shape boundary (in/out) |
|
|
189
|
+
| [`clipConvex()`](https://docs.thi.ng/umbrella/geom/functions/clipConvex.html) | clip shape against convex boundary |
|
|
190
|
+
| [`closestPoint()`](https://docs.thi.ng/umbrella/geom/functions/closestPoint.html) | compute closest point on shape boundary |
|
|
191
|
+
| [`convexHull()`](https://docs.thi.ng/umbrella/geom/functions/convexHull.html) | compute convex hull (2d only) |
|
|
192
|
+
| [`convolve()`](https://docs.thi.ng/umbrella/geom/functions/convolve.html) | kernel based vertex convolution/filtering |
|
|
193
|
+
| [`edges()`](https://docs.thi.ng/umbrella/geom/functions/edges.html) | extract edges |
|
|
194
|
+
| [`edgesFromTessellation()`](https://docs.thi.ng/umbrella/geom/functions/edgesFromTessellation.html) | extract unique edges from tessellation results |
|
|
195
|
+
| [`fitIntoBounds2()`](https://docs.thi.ng/umbrella/geom/functions/fitIntoBounds2.html) | rescale/reposition a 2D shape into a destination boundary |
|
|
196
|
+
| [`fitIntoBounds3()`](https://docs.thi.ng/umbrella/geom/functions/fitIntoBounds3.html) | rescale/reposition a 3D shape into a destination boundary |
|
|
197
|
+
| [`fitAllIntoBounds2()`](https://docs.thi.ng/umbrella/geom/functions/fitAllIntoBounds2.html) | rescale/reposition multiple 2D shapes into a boundary |
|
|
198
|
+
| [`flip()`](https://docs.thi.ng/umbrella/geom/functions/flip.html) | reverse order (vertices or direction) |
|
|
199
|
+
| [`graphFromTessellation()`](https://docs.thi.ng/umbrella/geom/functions/graphFromTessellation.html) | create graph from tessellation results |
|
|
200
|
+
| [`intersects()`](https://docs.thi.ng/umbrella/geom/functions/intersects.html) | pairwise shape intersection (various types) |
|
|
201
|
+
| [`mapPoint()`](https://docs.thi.ng/umbrella/geom/functions/mapPoint.html) | transform world space point into local shape UV space |
|
|
202
|
+
| [`offset()`](https://docs.thi.ng/umbrella/geom/functions/offset.html) | shape/path offsetting |
|
|
203
|
+
| [`pointAt()`](https://docs.thi.ng/umbrella/geom/functions/pointAt.html) | compute point on shape boundary at parametric position |
|
|
204
|
+
| [`pointInside()`](https://docs.thi.ng/umbrella/geom/functions/pointInside.html) | check if point is inside shape |
|
|
205
|
+
| [`proximity()`](https://docs.thi.ng/umbrella/geom/functions/proximity.html) | distance from point to shape boundary |
|
|
206
|
+
| [`resample()`](https://docs.thi.ng/umbrella/geom/functions/resample.html) | resample/convert shape |
|
|
207
|
+
| [`rotate()`](https://docs.thi.ng/umbrella/geom/functions/rotate.html) | rotate shape (2D only) |
|
|
208
|
+
| [`rotateAroundAxis()`](https://docs.thi.ng/umbrella/geom/functions/rotateAroundAxis.html) | rotate shape (3D only) |
|
|
209
|
+
| [`rotateX()`](https://docs.thi.ng/umbrella/geom/functions/rotateX.html) | rotate shape (3D only) |
|
|
210
|
+
| [`rotateY()`](https://docs.thi.ng/umbrella/geom/functions/rotateY.html) | rotate shape (3D only) |
|
|
211
|
+
| [`rotateZ()`](https://docs.thi.ng/umbrella/geom/functions/rotateZ.html) | rotate shape (3D only) |
|
|
212
|
+
| [`scale()`](https://docs.thi.ng/umbrella/geom/functions/scale.html) | scale shape (uniformly/non-uniformly) |
|
|
213
|
+
| [`scaleWithCenter()`](https://docs.thi.ng/umbrella/geom/functions/scaleWithCenter.html) | scale shape with pivot point |
|
|
214
|
+
| [`scatter()`](https://docs.thi.ng/umbrella/geom/functions/scatter.html) | create random points inside a shape boundary |
|
|
215
|
+
| [`simplify()`](https://docs.thi.ng/umbrella/geom/functions/simplify.html) | simplify shape/boundary (Douglas-Peucker) |
|
|
216
|
+
| [`splitArcLength()`](https://docs.thi.ng/umbrella/geom/functions/splitArcLength.html) | split shapes & groups based on max. arc length |
|
|
217
|
+
| [`splitAt()`](https://docs.thi.ng/umbrella/geom/functions/splitAt.html) | split shape/boundary at parametric position |
|
|
218
|
+
| [`splitNearPoint()`](https://docs.thi.ng/umbrella/geom/functions/splitNearPoint.html) | split shape/boundary near world position |
|
|
219
|
+
| [`subdivCurve()`](https://docs.thi.ng/umbrella/geom/functions/subdivCurve.html) | recursively apply curve subdivision kernel |
|
|
220
|
+
| [`tangentAt()`](https://docs.thi.ng/umbrella/geom/functions/tangentAt.html) | compute tangent at parametric position |
|
|
221
|
+
| [`tessellate()`](https://docs.thi.ng/umbrella/geom/functions/tessellate.html) | (recursively) tessellate shape |
|
|
222
|
+
| [`transformVertices()`](https://docs.thi.ng/umbrella/geom/functions/transformVertices.html) | apply custom function to each vertex |
|
|
223
|
+
| [`transform()`](https://docs.thi.ng/umbrella/geom/functions/transform.html) | apply transformation matrix |
|
|
224
|
+
| [`translate()`](https://docs.thi.ng/umbrella/geom/functions/translate.html) | translate shape |
|
|
225
|
+
| [`union()`](https://docs.thi.ng/umbrella/geom/functions/union.html) | compute shape union |
|
|
226
|
+
| [`unmapPoint()`](https://docs.thi.ng/umbrella/geom/functions/unmapPoint.html) | transform local shape UV point into world space |
|
|
227
|
+
| [`vertices()`](https://docs.thi.ng/umbrella/geom/functions/vertices.html) | extract/sample vertices from shape boundary |
|
|
228
|
+
| [`volume()`](https://docs.thi.ng/umbrella/geom/functions/volume.html) | compute shape volume (3D only) |
|
|
229
|
+
| [`warpPoint()`](https://docs.thi.ng/umbrella/geom/functions/warpPoint.html) | transfer single point between the local spaces defined by 2 shapes |
|
|
230
|
+
| [`warpPoints()`](https://docs.thi.ng/umbrella/geom/functions/warpPoints.html) | transfer points between the local spaces defined by 2 shapes |
|
|
231
|
+
| [`warpPointsBPatch()`](https://docs.thi.ng/umbrella/geom/functions/warpPointsBPatch.html) | transfer points to the local spaces of a bezier patch |
|
|
232
|
+
| [`withAttribs()`](https://docs.thi.ng/umbrella/geom/functions/withAttribs.html) | shallow copy of given shape with new `attribs` assigned |
|
|
233
|
+
|
|
234
|
+
### Shape factory functions
|
|
235
|
+
|
|
236
|
+
In addition to the [above listed direct shape type functions](#shape-types),
|
|
237
|
+
the following additional shape creation helpers are provided:
|
|
238
|
+
|
|
239
|
+
#### AABB
|
|
240
|
+
|
|
241
|
+
- [aabbFromMinMax()](https://docs.thi.ng/umbrella/geom/functions/aabbFromMinMax.html)
|
|
242
|
+
- [aabbFromMinMaxWithMargin()](https://docs.thi.ng/umbrella/geom/functions/aabbFromMinMaxWithMargin.html)
|
|
243
|
+
- [aabbFromCentroid()](https://docs.thi.ng/umbrella/geom/functions/aabbFromCentroid.html)
|
|
244
|
+
- [aabbWithCentroidAndMargin()](https://docs.thi.ng/umbrella/geom/functions/aabbWithCentroidAndMargin.html)
|
|
245
|
+
- [intersectionAABB()](https://docs.thi.ng/umbrella/geom/functions/intersectionAABB.html)
|
|
246
|
+
- [inscribedAABB()](https://docs.thi.ng/umbrella/geom/functions/inscribedAABB.html)
|
|
247
|
+
|
|
248
|
+
#### Arc
|
|
249
|
+
|
|
250
|
+
- [arcFrom2Points()](https://docs.thi.ng/umbrella/geom/functions/arcFrom2Points.html)
|
|
251
|
+
|
|
252
|
+
#### Bezier patch
|
|
253
|
+
|
|
254
|
+
- [bpatchFromQuad()](https://docs.thi.ng/umbrella/geom/functions/bpatchFromQuad.html)
|
|
255
|
+
- [bpatchFromHex()](https://docs.thi.ng/umbrella/geom/functions/bpatchFromHex.html)
|
|
256
|
+
|
|
257
|
+
#### Circle
|
|
258
|
+
|
|
259
|
+
- [circleFrom2Points()](https://docs.thi.ng/umbrella/geom/functions/circleFrom2Points.html)
|
|
260
|
+
- [circleFrom3Points()](https://docs.thi.ng/umbrella/geom/functions/circleFrom3Points.html)
|
|
261
|
+
|
|
262
|
+
#### Cubic
|
|
263
|
+
|
|
264
|
+
- [cubicFromArc()](https://docs.thi.ng/umbrella/geom/functions/cubicFromArc.html)
|
|
265
|
+
- [cubicFromLine()](https://docs.thi.ng/umbrella/geom/functions/cubicFromLine.html)
|
|
266
|
+
- [cubicFromLine3()](https://docs.thi.ng/umbrella/geom/functions/cubicFromLine3.html)
|
|
267
|
+
- [cubicFromQuadratic()](https://docs.thi.ng/umbrella/geom/functions/cubicFromQuadratic.html)
|
|
268
|
+
- [cubicFromQuadratic3()](https://docs.thi.ng/umbrella/geom/functions/cubicFromQuadratic3.html)
|
|
269
|
+
|
|
270
|
+
#### Group
|
|
271
|
+
|
|
272
|
+
- [groupFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/groupFromTessellation.html)
|
|
273
|
+
|
|
274
|
+
#### Line
|
|
275
|
+
|
|
276
|
+
- [clippedLine()](https://docs.thi.ng/umbrella/geom/functions/clippedLine.html)
|
|
277
|
+
|
|
278
|
+
#### Path
|
|
279
|
+
|
|
280
|
+
- [pathBuilder()](https://docs.thi.ng/umbrella/geom/functions/pathBuilder-1.html)
|
|
281
|
+
- [pathBuilder3()](https://docs.thi.ng/umbrella/geom/functions/pathBuilder3.html)
|
|
282
|
+
- [pathFromSvg()](https://docs.thi.ng/umbrella/geom/functions/pathFromSvg.html)
|
|
283
|
+
- [pathFromCubics()](https://docs.thi.ng/umbrella/geom/functions/pathFromCubics.html)
|
|
284
|
+
- [normalizedPath()](https://docs.thi.ng/umbrella/geom/functions/normalizedPath.html)
|
|
285
|
+
- [roundedRect()](https://docs.thi.ng/umbrella/geom/functions/roundedRect.html)
|
|
286
|
+
|
|
287
|
+
#### Plane
|
|
288
|
+
|
|
289
|
+
- [planeWithPoint()](https://docs.thi.ng/umbrella/geom/functions/planeWithPoint.html)
|
|
290
|
+
- [planeFrom3Points()](https://docs.thi.ng/umbrella/geom/functions/planeFrom3Points.html)
|
|
291
|
+
- [planeFromRay()](https://docs.thi.ng/umbrella/geom/functions/planeFromRay.html)
|
|
292
|
+
|
|
293
|
+
#### Polygon
|
|
294
|
+
|
|
295
|
+
- [smoothPolygon()](https://docs.thi.ng/umbrella/geom/functions/smoothPolygon.html)
|
|
296
|
+
- [star()](https://docs.thi.ng/umbrella/geom/functions/star.html)
|
|
297
|
+
- [starWithCentroid()](https://docs.thi.ng/umbrella/geom/functions/starWithCentroid.html)
|
|
298
|
+
|
|
299
|
+
#### Polyline
|
|
300
|
+
|
|
301
|
+
- [smoothPolyline()](https://docs.thi.ng/umbrella/geom/functions/smoothPolyline.html)
|
|
302
|
+
- [spiral()](https://docs.thi.ng/umbrella/geom/functions/spiral.html)
|
|
303
|
+
|
|
304
|
+
#### Quad
|
|
305
|
+
|
|
306
|
+
- [quadOnPlane()](https://docs.thi.ng/umbrella/geom/functions/quadOnPlane.html)
|
|
307
|
+
|
|
308
|
+
#### Rect
|
|
309
|
+
|
|
310
|
+
- [rectFromMinMax()](https://docs.thi.ng/umbrella/geom/functions/rectFromMinMax.html)
|
|
311
|
+
- [rectFromMinMaxWithMargin()](https://docs.thi.ng/umbrella/geom/functions/rectFromMinMaxWithMargin.html)
|
|
312
|
+
- [rectWithCentroid()](https://docs.thi.ng/umbrella/geom/functions/rectWithCentroid.html)
|
|
313
|
+
- [rectWithCentroidAndMargin()](https://docs.thi.ng/umbrella/geom/functions/rectWithCentroidAndMargin.html)
|
|
314
|
+
- [intersectionRect()](https://docs.thi.ng/umbrella/geom/functions/intersectionRect.html)
|
|
315
|
+
- [inscribedSquare()](https://docs.thi.ng/umbrella/geom/functions/inscribedSquare.html)
|
|
316
|
+
- [inscribedSquareHex()](https://docs.thi.ng/umbrella/geom/functions/inscribedSquareHex.html)
|
|
317
|
+
|
|
318
|
+
#### Sphere
|
|
319
|
+
|
|
320
|
+
- [sphereFrom2Points()](https://docs.thi.ng/umbrella/geom/functions/sphereFrom2Points.html)
|
|
321
|
+
|
|
322
|
+
#### Triangle
|
|
323
|
+
|
|
324
|
+
- [equilateralTriangle()](https://docs.thi.ng/umbrella/geom/functions/equilateralTriangle.html)
|
|
325
|
+
|
|
326
|
+
### Constants & presets
|
|
327
|
+
|
|
328
|
+
Some of the shape operations require configuration with specific algorithms
|
|
329
|
+
and/or constants. In all cases this relies on a completely extensible mechanism,
|
|
330
|
+
but the package provides presets for common options/implementations:
|
|
331
|
+
|
|
332
|
+
#### Curve subdivision kernels
|
|
333
|
+
|
|
334
|
+
To be used with [`subdivideCurve()`](https://docs.thi.ng/umbrella/geom/functions/subdivCurve.html):
|
|
335
|
+
|
|
336
|
+
- [SUBDIV_CHAIKIN_CLOSED](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_CHAIKIN_CLOSED.html)
|
|
337
|
+
- [SUBDIV_CHAIKIN_OPEN](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_CHAIKIN_OPEN.html)
|
|
338
|
+
- [SUBDIV_CUBIC_CLOSED](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_CUBIC_CLOSED.html)
|
|
339
|
+
- [SUBDIV_DISPLACE](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_DISPLACE.html)
|
|
340
|
+
- [SUBDIV_MID_CLOSED](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_MID_CLOSED.html)
|
|
341
|
+
- [SUBDIV_MID_OPEN](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_MID_OPEN.html)
|
|
342
|
+
- [SUBDIV_THIRDS_CLOSED](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_THIRDS_CLOSED.html)
|
|
343
|
+
- [SUBDIV_THIRDS_OPEN](https://docs.thi.ng/umbrella/geom/variables/SUBDIV_THIRDS_OPEN.html)
|
|
344
|
+
|
|
345
|
+
#### Polygon tessellation algorithms
|
|
346
|
+
|
|
347
|
+
To be used with [`tessellate()`](https://docs.thi.ng/umbrella/geom/functions/tessellate.html):
|
|
348
|
+
|
|
349
|
+
See [thi.ng/geom-tessellate
|
|
350
|
+
readme](https://github.com/thi-ng/umbrella/blob/develop/packages/geom-tessellate/README.md#tessellators)
|
|
351
|
+
for diagrams/illustrations of each algorithm!
|
|
352
|
+
|
|
353
|
+
- [TESSELLATE_EARCUT](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_EARCUT.html)
|
|
354
|
+
- [TESSELLATE_EARCUT_COMPLEX](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_EARCUT_COMPLEX.html)
|
|
355
|
+
- [TESSELLATE_EDGE_SPLIT](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_EDGE_SPLIT.html)
|
|
356
|
+
- [TESSELLATE_INSET](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_INSET.html)
|
|
357
|
+
- [TESSELLATE_QUAD_FAN](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_QUAD_FAN.html)
|
|
358
|
+
- [TESSELLATE_RIM_TRIS](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_RIM_TRIS.html)
|
|
359
|
+
- [TESSELLATE_TRI_FAN](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_TRI_FAN.html)
|
|
360
|
+
- [TESSELLATE_TRI_FAN_BOUNDARY](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_TRI_FAN_BOUNDARY.html)
|
|
361
|
+
- [TESSELLATE_TRI_FAN_SPLIT](https://docs.thi.ng/umbrella/geom/variables/TESSELLATE_TRI_FAN_SPLIT.html)
|
|
362
|
+
|
|
363
|
+
Tessellation behaviors:
|
|
364
|
+
|
|
365
|
+
- [`basicTessellation()`](https://docs.thi.ng/umbrella/geom/functions/basicTessellation.html):
|
|
366
|
+
default impl
|
|
367
|
+
- [`meshTessellation()`](https://docs.thi.ng/umbrella/geom/functions/meshTessellation.html):
|
|
368
|
+
uses kD-tree to deduplicate result points
|
|
369
|
+
|
|
370
|
+
Tessellation post-processing:
|
|
371
|
+
|
|
372
|
+
- [edgesFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/edgesFromTessellation.html)
|
|
373
|
+
- [edgePointsFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/edgePointsFromTessellation.html)
|
|
374
|
+
- [graphFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/graphFromTessellation.html)
|
|
375
|
+
- [groupFromTessellation()](https://docs.thi.ng/umbrella/geom/functions/groupFromTessellation.html)
|
|
376
|
+
|
|
377
|
+
#### Vertex convolution kernels
|
|
378
|
+
|
|
379
|
+
To be used with [`convolve()`](https://docs.thi.ng/umbrella/geom/functions/convolve.html):
|
|
380
|
+
|
|
381
|
+
- [KERNEL_BOX](https://docs.thi.ng/umbrella/geom/functions/KERNEL_BOX.html)
|
|
382
|
+
- [KERNEL_GAUSSIAN](https://docs.thi.ng/umbrella/geom/functions/KERNEL_GAUSSIAN.html)
|
|
383
|
+
- [KERNEL_TRIANGLE](https://docs.thi.ng/umbrella/geom/functions/KERNEL_TRIANGLE.html)
|
|
384
|
+
---
|
|
147
385
|
|
|
148
386
|
This package acts as a higher-level frontend for most of the following related
|
|
149
387
|
packages (which are more low-level, lightweight and usable by themselves too):
|
|
@@ -151,7 +389,6 @@ packages (which are more low-level, lightweight and usable by themselves too):
|
|
|
151
389
|
## Support packages
|
|
152
390
|
|
|
153
391
|
- [@thi.ng/geom-accel](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-accel) - n-D spatial indexing data structures with a shared ES6 Map/Set-like API
|
|
154
|
-
- [@thi.ng/geom-api](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-api) - Shared type & interface declarations for [@thi.ng/geom](https://github.com/thi-ng/umbrella/tree/develop/packages/geom) packages
|
|
155
392
|
- [@thi.ng/geom-arc](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-arc) - 2D circular / elliptic arc operations
|
|
156
393
|
- [@thi.ng/geom-axidraw](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-axidraw) - Conversion and preparation of thi.ng/geom shapes & shape groups to/from AxiDraw pen plotter draw commands
|
|
157
394
|
- [@thi.ng/geom-clip-line](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-clip-line) - 2D line clipping (Liang-Barsky)
|
|
@@ -170,6 +407,7 @@ packages (which are more low-level, lightweight and usable by themselves too):
|
|
|
170
407
|
- [@thi.ng/geom-tessellate](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-tessellate) - 2D/3D convex polygon tessellators
|
|
171
408
|
- [@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
409
|
- [@thi.ng/geom-voronoi](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-voronoi) - Fast, incremental 2D Delaunay & Voronoi mesh implementation
|
|
410
|
+
- [@thi.ng/geom-webgl](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-webgl) - WebGL geometry/shape conversion & interop
|
|
173
411
|
|
|
174
412
|
## Related packages
|
|
175
413
|
|
|
@@ -213,10 +451,11 @@ For Node.js REPL:
|
|
|
213
451
|
const geom = await import("@thi.ng/geom");
|
|
214
452
|
```
|
|
215
453
|
|
|
216
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
454
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 17.37 KB
|
|
217
455
|
|
|
218
456
|
## Dependencies
|
|
219
457
|
|
|
458
|
+
- [@thi.ng/adjacency](https://github.com/thi-ng/umbrella/tree/develop/packages/adjacency)
|
|
220
459
|
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/develop/packages/api)
|
|
221
460
|
- [@thi.ng/arrays](https://github.com/thi-ng/umbrella/tree/develop/packages/arrays)
|
|
222
461
|
- [@thi.ng/associative](https://github.com/thi-ng/umbrella/tree/develop/packages/associative)
|
|
@@ -224,7 +463,6 @@ Package sizes (brotli'd, pre-treeshake): ESM: 14.61 KB
|
|
|
224
463
|
- [@thi.ng/defmulti](https://github.com/thi-ng/umbrella/tree/develop/packages/defmulti)
|
|
225
464
|
- [@thi.ng/equiv](https://github.com/thi-ng/umbrella/tree/develop/packages/equiv)
|
|
226
465
|
- [@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
466
|
- [@thi.ng/geom-arc](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-arc)
|
|
229
467
|
- [@thi.ng/geom-clip-line](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-clip-line)
|
|
230
468
|
- [@thi.ng/geom-clip-poly](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-clip-poly)
|
|
@@ -251,45 +489,50 @@ Several projects in this repo's
|
|
|
251
489
|
[/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
|
|
252
490
|
directory are using this package:
|
|
253
491
|
|
|
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/
|
|
492
|
+
| Screenshot | Description | Live demo | Source |
|
|
493
|
+
|:------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:-------------------------------------------------------------|:------------------------------------------------------------------------------------------|
|
|
494
|
+
| <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) |
|
|
495
|
+
| <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) |
|
|
496
|
+
| <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) |
|
|
497
|
+
| <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) |
|
|
498
|
+
| <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) |
|
|
499
|
+
| <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) |
|
|
500
|
+
| <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) |
|
|
501
|
+
| <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) |
|
|
502
|
+
| <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) |
|
|
503
|
+
| <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) |
|
|
504
|
+
| <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) |
|
|
505
|
+
| <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) |
|
|
506
|
+
| <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) |
|
|
507
|
+
| <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) |
|
|
508
|
+
| <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) |
|
|
509
|
+
| <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) |
|
|
510
|
+
| <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) |
|
|
511
|
+
| <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) |
|
|
512
|
+
| <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) |
|
|
513
|
+
| <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) |
|
|
514
|
+
| <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) |
|
|
515
|
+
| <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) |
|
|
516
|
+
| <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) |
|
|
517
|
+
| <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) |
|
|
518
|
+
| <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) |
|
|
519
|
+
| <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) |
|
|
520
|
+
| <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) |
|
|
521
|
+
| <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) |
|
|
522
|
+
| <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) |
|
|
523
|
+
| <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) |
|
|
524
|
+
| <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) |
|
|
525
|
+
| <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) |
|
|
526
|
+
| <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) |
|
|
527
|
+
| <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) |
|
|
528
|
+
| <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) |
|
|
529
|
+
| <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) |
|
|
530
|
+
| <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
531
|
|
|
287
532
|
## API
|
|
288
533
|
|
|
289
534
|
[Generated API docs](https://docs.thi.ng/umbrella/geom/)
|
|
290
535
|
|
|
291
|
-
TODO
|
|
292
|
-
|
|
293
536
|
## Authors
|
|
294
537
|
|
|
295
538
|
- [Karsten Schmidt](https://thi.ng)
|