@thi.ng/geom 7.0.0 → 7.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 +7 -1
- package/README.md +2 -2
- package/arc.d.ts +51 -1
- package/arc.js +12 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-05-
|
|
3
|
+
- **Last updated**: 2024-05-09T14:25:15Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [7.0.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@7.0.1) (2024-05-09)
|
|
13
|
+
|
|
14
|
+
#### 🩹 Bug fixes
|
|
15
|
+
|
|
16
|
+
- update arc() arg defaults, add docs ([cc57a57](https://github.com/thi-ng/umbrella/commit/cc57a57))
|
|
17
|
+
|
|
12
18
|
# [7.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@7.0.0) (2024-05-08)
|
|
13
19
|
|
|
14
20
|
#### 🛑 Breaking changes
|
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ For Node.js REPL:
|
|
|
213
213
|
const geom = await import("@thi.ng/geom");
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 14.
|
|
216
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 14.61 KB
|
|
217
217
|
|
|
218
218
|
## Dependencies
|
|
219
219
|
|
|
@@ -266,7 +266,7 @@ directory are using this package:
|
|
|
266
266
|
| <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) |
|
|
267
267
|
| <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) |
|
|
268
268
|
| <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) |
|
|
269
|
-
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hiccup-canvas-arcs.
|
|
269
|
+
| <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) |
|
|
270
270
|
| <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) |
|
|
271
271
|
| <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) |
|
|
272
272
|
| <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) |
|
package/arc.d.ts
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
import type { Attribs } from "@thi.ng/geom-api";
|
|
2
2
|
import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
|
|
3
3
|
import { Arc } from "./api/arc.js";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new elliptic {@link Arc} from given `center`, `radii`, `axis`
|
|
6
|
+
* rotation, `start` and `end` angles (in radians).
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The `xl` (large arc) and `clockwise` params are defaulting to:
|
|
10
|
+
*
|
|
11
|
+
* - xl = true if |start-end| > PI
|
|
12
|
+
* - clockwise = true if end > start
|
|
13
|
+
*
|
|
14
|
+
* Reference:
|
|
15
|
+
* - https://svgwg.org/svg2-draft/paths.html#PathDataEllipticalArcCommands
|
|
16
|
+
* - https://svgwg.org/svg2-draft/images/paths/arcs02.svg
|
|
17
|
+
*
|
|
18
|
+
* Also see {@link arcFrom2Points}, {@link pathFromSvg} for an alternative construction.
|
|
19
|
+
*
|
|
20
|
+
* @param center
|
|
21
|
+
* @param radii
|
|
22
|
+
* @param axis
|
|
23
|
+
* @param start
|
|
24
|
+
* @param end
|
|
25
|
+
* @param xl
|
|
26
|
+
* @param clockwise
|
|
27
|
+
* @param attribs
|
|
28
|
+
*/
|
|
29
|
+
export declare const arc: (center: Vec, radii: number | Vec, axis: number, start: number, end: number, xl?: boolean, clockwise?: boolean, attribs?: Attribs) => Arc;
|
|
30
|
+
/**
|
|
31
|
+
* Constructs a new {@link Arc} between the two given points `a` and `b` using
|
|
32
|
+
* `radii`, `axis` rotation (in radians) and `xl`, `clockwise` params to
|
|
33
|
+
* configure which of 4 possible arcs will be chosen.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* This function returns `undefined` if it's mathematically impossible to create
|
|
37
|
+
* an arc with the given parameters.
|
|
38
|
+
*
|
|
39
|
+
* Reference:
|
|
40
|
+
* - https://svgwg.org/svg2-draft/paths.html#PathDataEllipticalArcCommands
|
|
41
|
+
* - https://svgwg.org/svg2-draft/images/paths/arcs02.svg
|
|
42
|
+
* - https://svgwg.org/svg2-draft/implnote.html#ArcConversionEndpointToCenter
|
|
43
|
+
* - https://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
|
44
|
+
*
|
|
45
|
+
* Also see {@link arc}, {@link pathFromSvg} for an alternative construction.
|
|
46
|
+
*
|
|
47
|
+
* @param a
|
|
48
|
+
* @param b
|
|
49
|
+
* @param radii
|
|
50
|
+
* @param axis
|
|
51
|
+
* @param xl
|
|
52
|
+
* @param cw
|
|
53
|
+
* @param attribs
|
|
54
|
+
*/
|
|
5
55
|
export declare const arcFrom2Points: (a: ReadonlyVec, b: ReadonlyVec, radii: ReadonlyVec, axis?: number, xl?: boolean, cw?: boolean, attribs?: Attribs) => Arc | undefined;
|
|
6
56
|
//# sourceMappingURL=arc.d.ts.map
|
package/arc.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { isNumber } from "@thi.ng/checks/is-number";
|
|
2
2
|
import { fromEndPoints } from "@thi.ng/geom-arc/from-endpoints";
|
|
3
3
|
import { Arc } from "./api/arc.js";
|
|
4
|
-
|
|
4
|
+
import { absDiff } from "@thi.ng/math/abs";
|
|
5
|
+
import { PI } from "@thi.ng/math/api";
|
|
6
|
+
const arc = (center, radii, axis, start, end, xl = absDiff(start, end) > PI, clockwise = end > start, attribs) => new Arc(
|
|
7
|
+
center,
|
|
8
|
+
isNumber(radii) ? [radii, radii] : radii,
|
|
9
|
+
axis,
|
|
10
|
+
start,
|
|
11
|
+
end,
|
|
12
|
+
xl,
|
|
13
|
+
clockwise,
|
|
14
|
+
attribs
|
|
15
|
+
);
|
|
5
16
|
const arcFrom2Points = (a, b, radii, axis = 0, xl = false, cw = false, attribs) => {
|
|
6
17
|
const res = fromEndPoints(a, b, radii, axis, xl, cw);
|
|
7
18
|
return res ? new Arc(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Functional, polymorphic API for 2D geometry types & SVG generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -413,5 +413,5 @@
|
|
|
413
413
|
],
|
|
414
414
|
"year": 2013
|
|
415
415
|
},
|
|
416
|
-
"gitHead": "
|
|
416
|
+
"gitHead": "41bd769068da804eeace622ec7db50e4d48f1dc9\n"
|
|
417
417
|
}
|