@thi.ng/math
Advanced tools
Comparing version 5.9.1 to 5.10.0
@@ -104,2 +104,28 @@ import type { FnN, FnN2, FnN3 } from "@thi.ng/api"; | ||
export declare const fastSin: FnN; | ||
/** | ||
* Converts angle from DMS to decimal. | ||
* | ||
* @remarks | ||
* See {@link toDMS} for reverse op. | ||
* | ||
* Reference: | ||
* https://en.wikipedia.org/wiki/Decimal_degrees | ||
* | ||
* @param deg | ||
* @param min | ||
* @param sec | ||
*/ | ||
export declare const fromDMS: (deg: number, min: number, sec: number) => number; | ||
/** | ||
* Converts decimal angle to DMS. Returns result as 3-tuple with the first item | ||
* (degrees) having the same sign as the input. | ||
* | ||
* @remarks | ||
* See {@link fromDMS} for reverse op. | ||
* | ||
* Reference: https://en.wikipedia.org/wiki/Decimal_degrees | ||
* | ||
* @param theta | ||
*/ | ||
export declare const toDMS: (theta: number) => number[]; | ||
//# sourceMappingURL=angle.d.ts.map |
13
angle.js
@@ -44,2 +44,11 @@ import { DEG2RAD, HALF_PI, INV_HALF_PI, PI, RAD2DEG, TAU } from "./api.js"; | ||
const fastSin = (theta) => fastCos(HALF_PI - theta); | ||
const fromDMS = (deg2, min, sec2) => deg2 + min / 60 + sec2 / 3600; | ||
const toDMS = (theta) => { | ||
const sign = Math.sign(theta); | ||
theta = Math.abs(theta); | ||
const deg2 = Math.trunc(theta); | ||
theta = (theta - deg2) * 60; | ||
const min = Math.trunc(theta); | ||
return [deg2 * sign, min, (theta - min) * 60]; | ||
}; | ||
export { | ||
@@ -56,2 +65,3 @@ absInnerAngle, | ||
fastSin, | ||
fromDMS, | ||
loc, | ||
@@ -62,3 +72,4 @@ normCos, | ||
sec, | ||
sincos | ||
sincos, | ||
toDMS | ||
}; |
# Change Log | ||
- **Last updated**: 2024-02-10T08:59:56Z | ||
- **Last updated**: 2024-02-16T20:01:44Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,8 @@ | ||
## [5.10.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.10.0) (2024-02-16) | ||
#### 🚀 Features | ||
- add fromDMS()/toDMS() conversions ([1714067](https://github.com/thi-ng/umbrella/commit/1714067)) | ||
## [5.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.9.0) (2024-02-06) | ||
@@ -14,0 +20,0 @@ |
{ | ||
"name": "@thi.ng/math", | ||
"version": "5.9.1", | ||
"version": "5.10.0", | ||
"description": "Assorted common math functions & utilities", | ||
@@ -145,3 +145,3 @@ "type": "module", | ||
}, | ||
"gitHead": "e5e7d5c6ed2eadee7a91d59cbd0c86ce880ab1c5\n" | ||
"gitHead": "25ee18f7db6d03f0b76787267ab071d16df94888\n" | ||
} |
@@ -85,3 +85,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
Package sizes (brotli'd, pre-treeshake): ESM: 4.63 KB | ||
Package sizes (brotli'd, pre-treeshake): ESM: 4.70 KB | ||
@@ -88,0 +88,0 @@ ## Dependencies |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97515
2177