@thi.ng/math 5.9.0 → 5.10.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 +7 -1
- package/README.md +11 -1
- package/angle.d.ts +26 -0
- package/angle.js +12 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-02-
|
|
3
|
+
- **Last updated**: 2024-02-16T20:01:44Z
|
|
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
|
+
## [5.10.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.10.0) (2024-02-16)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add fromDMS()/toDMS() conversions ([1714067](https://github.com/thi-ng/umbrella/commit/1714067))
|
|
17
|
+
|
|
12
18
|
## [5.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.9.0) (2024-02-06)
|
|
13
19
|
|
|
14
20
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
<!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> ‼️ Announcing the thi.ng user survey 2024 📋
|
|
5
|
+
>
|
|
6
|
+
> [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
|
|
7
|
+
> (open until end of February)
|
|
8
|
+
>
|
|
9
|
+
> **To achieve a better sample size, I'd highly appreciate if you could
|
|
10
|
+
> circulate the link to this survey in your own networks.**
|
|
11
|
+
>
|
|
12
|
+
> [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
|
|
3
13
|
|
|
4
14
|
# 
|
|
5
15
|
|
|
@@ -72,7 +82,7 @@ For Node.js REPL:
|
|
|
72
82
|
const math = await import("@thi.ng/math");
|
|
73
83
|
```
|
|
74
84
|
|
|
75
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 4.
|
|
85
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 4.70 KB
|
|
76
86
|
|
|
77
87
|
## Dependencies
|
|
78
88
|
|
package/angle.d.ts
CHANGED
|
@@ -101,4 +101,30 @@ export declare const fastCos: FnN;
|
|
|
101
101
|
* @param theta - in radians
|
|
102
102
|
*/
|
|
103
103
|
export declare const fastSin: FnN;
|
|
104
|
+
/**
|
|
105
|
+
* Converts angle from DMS to decimal.
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* See {@link toDMS} for reverse op.
|
|
109
|
+
*
|
|
110
|
+
* Reference:
|
|
111
|
+
* https://en.wikipedia.org/wiki/Decimal_degrees
|
|
112
|
+
*
|
|
113
|
+
* @param deg
|
|
114
|
+
* @param min
|
|
115
|
+
* @param sec
|
|
116
|
+
*/
|
|
117
|
+
export declare const fromDMS: (deg: number, min: number, sec: number) => number;
|
|
118
|
+
/**
|
|
119
|
+
* Converts decimal angle to DMS. Returns result as 3-tuple with the first item
|
|
120
|
+
* (degrees) having the same sign as the input.
|
|
121
|
+
*
|
|
122
|
+
* @remarks
|
|
123
|
+
* See {@link fromDMS} for reverse op.
|
|
124
|
+
*
|
|
125
|
+
* Reference: https://en.wikipedia.org/wiki/Decimal_degrees
|
|
126
|
+
*
|
|
127
|
+
* @param theta
|
|
128
|
+
*/
|
|
129
|
+
export declare const toDMS: (theta: number) => number[];
|
|
104
130
|
//# sourceMappingURL=angle.d.ts.map
|
package/angle.js
CHANGED
|
@@ -41,6 +41,15 @@ const fastCos = (theta) => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
const fastSin = (theta) => fastCos(HALF_PI - theta);
|
|
44
|
+
const fromDMS = (deg2, min, sec2) => deg2 + min / 60 + sec2 / 3600;
|
|
45
|
+
const toDMS = (theta) => {
|
|
46
|
+
const sign = Math.sign(theta);
|
|
47
|
+
theta = Math.abs(theta);
|
|
48
|
+
const deg2 = Math.trunc(theta);
|
|
49
|
+
theta = (theta - deg2) * 60;
|
|
50
|
+
const min = Math.trunc(theta);
|
|
51
|
+
return [deg2 * sign, min, (theta - min) * 60];
|
|
52
|
+
};
|
|
44
53
|
export {
|
|
45
54
|
absInnerAngle,
|
|
46
55
|
absTheta,
|
|
@@ -52,10 +61,12 @@ export {
|
|
|
52
61
|
deg,
|
|
53
62
|
fastCos,
|
|
54
63
|
fastSin,
|
|
64
|
+
fromDMS,
|
|
55
65
|
loc,
|
|
56
66
|
normCos,
|
|
57
67
|
quadrant,
|
|
58
68
|
rad,
|
|
59
69
|
sec,
|
|
60
|
-
sincos
|
|
70
|
+
sincos,
|
|
71
|
+
toDMS
|
|
61
72
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/math",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.0",
|
|
4
4
|
"description": "Assorted common math functions & utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"test": "bun test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^8.9.
|
|
41
|
+
"@thi.ng/api": "^8.9.23"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@microsoft/api-extractor": "^7.
|
|
45
|
-
"esbuild": "^0.
|
|
44
|
+
"@microsoft/api-extractor": "^7.40.1",
|
|
45
|
+
"esbuild": "^0.20.0",
|
|
46
46
|
"rimraf": "^5.0.5",
|
|
47
|
-
"typedoc": "^0.25.
|
|
47
|
+
"typedoc": "^0.25.7",
|
|
48
48
|
"typescript": "^5.3.3"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
@@ -142,5 +142,5 @@
|
|
|
142
142
|
"thi.ng": {
|
|
143
143
|
"year": 2013
|
|
144
144
|
},
|
|
145
|
-
"gitHead": "
|
|
145
|
+
"gitHead": "25ee18f7db6d03f0b76787267ab071d16df94888\n"
|
|
146
146
|
}
|