siderust-js 0.1.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/.github/workflows/ci.yml +166 -0
- package/.gitmodules +9 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +661 -0
- package/README.md +138 -0
- package/package.json +12 -0
- package/qtty-js/.github/workflows/ci.yml +151 -0
- package/qtty-js/.gitmodules +3 -0
- package/qtty-js/CHANGELOG.md +31 -0
- package/qtty-js/LICENSE +661 -0
- package/qtty-js/README.md +132 -0
- package/qtty-js/package.json +20 -0
- package/qtty-js/qtty/.github/workflows/ci.yml +155 -0
- package/qtty-js/qtty/CHANGELOG.md +120 -0
- package/qtty-js/qtty/Cargo.lock +1462 -0
- package/qtty-js/qtty/Cargo.toml +12 -0
- package/qtty-js/qtty/LICENSE +661 -0
- package/qtty-js/qtty/README.md +9 -0
- package/qtty-js/qtty/qtty/Cargo.toml +41 -0
- package/qtty-js/qtty/qtty/README.md +8 -0
- package/qtty-js/qtty/qtty/examples/angles.rs +14 -0
- package/qtty-js/qtty/qtty/examples/astronomy.rs +17 -0
- package/qtty-js/qtty/qtty/examples/dimensional_arithmetic.rs +83 -0
- package/qtty-js/qtty/qtty/examples/python_integration.rs +61 -0
- package/qtty-js/qtty/qtty/examples/quickstart.rs +15 -0
- package/qtty-js/qtty/qtty/examples/ratios.rs +12 -0
- package/qtty-js/qtty/qtty/examples/serde_with_unit.rs +234 -0
- package/qtty-js/qtty/qtty/examples/serialization.rs +141 -0
- package/qtty-js/qtty/qtty/examples/serialization_advanced.rs +155 -0
- package/qtty-js/qtty/qtty/src/f32.rs +108 -0
- package/qtty-js/qtty/qtty/src/f64.rs +30 -0
- package/qtty-js/qtty/qtty/src/i128.rs +111 -0
- package/qtty-js/qtty/qtty/src/i16.rs +111 -0
- package/qtty-js/qtty/qtty/src/i32.rs +111 -0
- package/qtty-js/qtty/qtty/src/i64.rs +111 -0
- package/qtty-js/qtty/qtty/src/i8.rs +111 -0
- package/qtty-js/qtty/qtty/src/lib.rs +238 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/src/lib.rs +7 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/src/lib.rs +7 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/src/lib.rs +5 -0
- package/qtty-js/qtty/qtty/tests/integration_tests.rs +529 -0
- package/qtty-js/qtty/qtty/tests/qtty_vec_feature_matrix.rs +58 -0
- package/qtty-js/qtty/qtty-core/Cargo.toml +41 -0
- package/qtty-js/qtty/qtty-core/README.md +8 -0
- package/qtty-js/qtty/qtty-core/examples/diesel_integration.rs +145 -0
- package/qtty-js/qtty/qtty-core/examples/quantity_db_serde.rs +215 -0
- package/qtty-js/qtty/qtty-core/src/dimension.rs +249 -0
- package/qtty-js/qtty/qtty-core/src/feature_diesel.rs +318 -0
- package/qtty-js/qtty/qtty-core/src/feature_pyo3.rs +27 -0
- package/qtty-js/qtty/qtty-core/src/feature_serde.rs +203 -0
- package/qtty-js/qtty/qtty-core/src/feature_tiberius.rs +28 -0
- package/qtty-js/qtty/qtty-core/src/lib.rs +744 -0
- package/qtty-js/qtty/qtty-core/src/macros.rs +93 -0
- package/qtty-js/qtty/qtty-core/src/quantity.rs +810 -0
- package/qtty-js/qtty/qtty-core/src/scalar.rs +1742 -0
- package/qtty-js/qtty/qtty-core/src/unit.rs +332 -0
- package/qtty-js/qtty/qtty-core/src/units/angular.rs +1228 -0
- package/qtty-js/qtty/qtty-core/src/units/area.rs +243 -0
- package/qtty-js/qtty/qtty-core/src/units/frequency.rs +179 -0
- package/qtty-js/qtty/qtty-core/src/units/length.rs +1270 -0
- package/qtty-js/qtty/qtty-core/src/units/mass.rs +488 -0
- package/qtty-js/qtty/qtty-core/src/units/mod.rs +26 -0
- package/qtty-js/qtty/qtty-core/src/units/power.rs +324 -0
- package/qtty-js/qtty/qtty-core/src/units/time.rs +667 -0
- package/qtty-js/qtty/qtty-core/src/units/unitless.rs +212 -0
- package/qtty-js/qtty/qtty-core/src/units/velocity.rs +210 -0
- package/qtty-js/qtty/qtty-core/src/units/volume.rs +269 -0
- package/qtty-js/qtty/qtty-core/tests/core.rs +628 -0
- package/qtty-js/qtty/qtty-core/tests/diesel.rs +461 -0
- package/qtty-js/qtty/qtty-core/tests/integers.rs +632 -0
- package/qtty-js/qtty/qtty-core/tests/no_cross_unit_ops.rs +35 -0
- package/qtty-js/qtty/qtty-core/tests/pyo3.rs +334 -0
- package/qtty-js/qtty/qtty-core/tests/quantity_f32.rs +276 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_decimal.rs +258 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_f32.rs +286 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_f64_real.rs +287 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_rational.rs +260 -0
- package/qtty-js/qtty/qtty-core/tests/serde.rs +256 -0
- package/qtty-js/qtty/qtty-core/tests/tiberius.rs +208 -0
- package/qtty-js/qtty/qtty-derive/Cargo.toml +23 -0
- package/qtty-js/qtty/qtty-derive/README.md +8 -0
- package/qtty-js/qtty/qtty-derive/src/lib.rs +340 -0
- package/qtty-js/qtty/qtty-ffi/ARCHITECTURE.md +3 -0
- package/qtty-js/qtty/qtty-ffi/Cargo.toml +31 -0
- package/qtty-js/qtty/qtty-ffi/README.md +9 -0
- package/qtty-js/qtty/qtty-ffi/build.rs +326 -0
- package/qtty-js/qtty/qtty-ffi/cbindgen.toml +105 -0
- package/qtty-js/qtty/qtty-ffi/include/qtty_ffi.h +1126 -0
- package/qtty-js/qtty/qtty-ffi/src/ffi.rs +1251 -0
- package/qtty-js/qtty/qtty-ffi/src/ffi_serde.rs +294 -0
- package/qtty-js/qtty/qtty-ffi/src/helpers.rs +310 -0
- package/qtty-js/qtty/qtty-ffi/src/lib.rs +229 -0
- package/qtty-js/qtty/qtty-ffi/src/macros.rs +121 -0
- package/qtty-js/qtty/qtty-ffi/src/registry.rs +274 -0
- package/qtty-js/qtty/qtty-ffi/src/types.rs +620 -0
- package/qtty-js/qtty/qtty-ffi/tests/integration_tests.rs +842 -0
- package/qtty-js/qtty/qtty-ffi/units.csv +156 -0
- package/qtty-js/qtty/qtty-ffi/units.csv.md +3 -0
- package/qtty-js/qtty-node/.prettierignore +6 -0
- package/qtty-js/qtty-node/.prettierrc.json +6 -0
- package/qtty-js/qtty-node/README.md +250 -0
- package/qtty-js/qtty-node/c8.config.json +11 -0
- package/qtty-js/qtty-node/eslint.config.js +31 -0
- package/qtty-js/qtty-node/examples/arithmetic.mjs +64 -0
- package/qtty-js/qtty-node/examples/astronomy.mjs +90 -0
- package/qtty-js/qtty-node/examples/quickstart.mjs +36 -0
- package/qtty-js/qtty-node/examples/serialization.mjs +125 -0
- package/qtty-js/qtty-node/examples/unit_factories.mjs +74 -0
- package/qtty-js/qtty-node/index.d.ts +219 -0
- package/qtty-js/qtty-node/index.js +323 -0
- package/qtty-js/qtty-node/lib/DerivedQuantity.js +122 -0
- package/qtty-js/qtty-node/lib/Quantity.js +151 -0
- package/qtty-js/qtty-node/lib/backend.js +25 -0
- package/qtty-js/qtty-node/native.cjs +306 -0
- package/qtty-js/qtty-node/package-lock.json +3223 -0
- package/qtty-js/qtty-node/package.json +70 -0
- package/qtty-js/qtty-node/units.d.ts +299 -0
- package/qtty-js/qtty-node/units.js +210 -0
- package/qtty-js/qtty-web/Cargo.lock +767 -0
- package/qtty-js/qtty-web/Cargo.toml +21 -0
- package/qtty-js/qtty-web/index.d.ts +140 -0
- package/qtty-js/qtty-web/index.js +20 -0
- package/qtty-js/qtty-web/lib/DerivedQuantity.js +58 -0
- package/qtty-js/qtty-web/lib/Quantity.js +75 -0
- package/qtty-js/qtty-web/lib/backend.js +80 -0
- package/qtty-js/qtty-web/package.json +45 -0
- package/qtty-js/qtty-web/src/lib.rs +111 -0
- package/qtty-js/scripts/ci.sh +73 -0
- package/scripts/ci.sh +123 -0
- package/siderust-core/Cargo.lock +787 -0
- package/siderust-core/Cargo.toml +18 -0
- package/siderust-core/DEDUPLICATION.md +124 -0
- package/siderust-core/src/body.rs +120 -0
- package/siderust-core/src/events.rs +184 -0
- package/siderust-core/src/lib.rs +20 -0
- package/siderust-core/src/observer.rs +55 -0
- package/siderust-core/src/position.rs +213 -0
- package/siderust-node/.prettierignore +7 -0
- package/siderust-node/.prettierrc.json +6 -0
- package/siderust-node/Cargo.lock +906 -0
- package/siderust-node/Cargo.toml +29 -0
- package/siderust-node/README.md +109 -0
- package/siderust-node/__test__/index.test.mjs +248 -0
- package/siderust-node/build.rs +5 -0
- package/siderust-node/c8.config.json +3 -0
- package/siderust-node/eslint.config.js +31 -0
- package/siderust-node/examples/01_basic_coordinates.mjs +24 -0
- package/siderust-node/examples/02_coordinate_transformations.mjs +25 -0
- package/siderust-node/examples/03_all_frames_conversions.mjs +26 -0
- package/siderust-node/examples/04_all_center_conversions.mjs +24 -0
- package/siderust-node/examples/05_target_tracking.mjs +22 -0
- package/siderust-node/examples/06_night_events.mjs +18 -0
- package/siderust-node/examples/07_moon_properties.mjs +21 -0
- package/siderust-node/examples/08_solar_system.mjs +19 -0
- package/siderust-node/examples/09_star_observability.mjs +22 -0
- package/siderust-node/examples/10_time_periods.mjs +9 -0
- package/siderust-node/examples/11_serialization.mjs +31 -0
- package/siderust-node/examples/12_runtime_ephemeris.mjs +27 -0
- package/siderust-node/examples/13_coordinate_operations.mjs +20 -0
- package/siderust-node/index.d.ts +623 -0
- package/siderust-node/index.js +79 -0
- package/siderust-node/lib/Observer.js +112 -0
- package/siderust-node/lib/Star.js +118 -0
- package/siderust-node/lib/backend.js +63 -0
- package/siderust-node/lib/wrappers.js +566 -0
- package/siderust-node/main.js +20 -0
- package/siderust-node/native.cjs +360 -0
- package/siderust-node/package-lock.json +3261 -0
- package/siderust-node/package.json +71 -0
- package/siderust-node/src/body.rs +74 -0
- package/siderust-node/src/coordinates.rs +372 -0
- package/siderust-node/src/ephemeris.rs +462 -0
- package/siderust-node/src/events.rs +577 -0
- package/siderust-node/src/lib.rs +43 -0
- package/siderust-node/src/observer.rs +132 -0
- package/siderust-node/src/phase.rs +218 -0
- package/siderust-node/src/position.rs +292 -0
- package/siderust-node/src/star.rs +200 -0
- package/siderust-web/Cargo.lock +855 -0
- package/siderust-web/Cargo.toml +34 -0
- package/siderust-web/README.md +100 -0
- package/siderust-web/__test__/index.test.mjs +118 -0
- package/siderust-web/examples/github-pages/README.md +31 -0
- package/siderust-web/examples/github-pages/index.html +135 -0
- package/siderust-web/index.d.ts +311 -0
- package/siderust-web/index.js +66 -0
- package/siderust-web/lib/Observer.js +103 -0
- package/siderust-web/lib/Star.js +116 -0
- package/siderust-web/lib/backend.js +400 -0
- package/siderust-web/lib/wrappers.js +512 -0
- package/siderust-web/package.json +55 -0
- package/siderust-web/src/body.rs +69 -0
- package/siderust-web/src/coordinates.rs +302 -0
- package/siderust-web/src/ephemeris.rs +456 -0
- package/siderust-web/src/events.rs +520 -0
- package/siderust-web/src/lib.rs +51 -0
- package/siderust-web/src/observer.rs +117 -0
- package/siderust-web/src/phase.rs +190 -0
- package/siderust-web/src/position.rs +291 -0
- package/siderust-web/src/star.rs +178 -0
- package/tempoch-js/.github/workflows/ci.yml +142 -0
- package/tempoch-js/.gitmodules +3 -0
- package/tempoch-js/CHANGELOG.md +25 -0
- package/tempoch-js/LICENSE +661 -0
- package/tempoch-js/README.md +126 -0
- package/tempoch-js/package.json +20 -0
- package/tempoch-js/scripts/ci.sh +73 -0
- package/tempoch-js/tempoch/.github/workflows/ci.yml +113 -0
- package/tempoch-js/tempoch/CHANGELOG.md +82 -0
- package/tempoch-js/tempoch/Cargo.lock +947 -0
- package/tempoch-js/tempoch/Cargo.toml +3 -0
- package/tempoch-js/tempoch/LICENSE +661 -0
- package/tempoch-js/tempoch/README.md +76 -0
- package/tempoch-js/tempoch/tempoch/Cargo.toml +27 -0
- package/tempoch-js/tempoch/tempoch/examples/periods.rs +45 -0
- package/tempoch-js/tempoch/tempoch/examples/quickstart.rs +13 -0
- package/tempoch-js/tempoch/tempoch/src/lib.rs +49 -0
- package/tempoch-js/tempoch/tempoch/tests/integration.rs +57 -0
- package/tempoch-js/tempoch/tempoch-core/Cargo.toml +24 -0
- package/tempoch-js/tempoch/tempoch-core/src/delta_t.rs +345 -0
- package/tempoch-js/tempoch/tempoch-core/src/instant.rs +811 -0
- package/tempoch-js/tempoch/tempoch-core/src/julian_date_ext.rs +142 -0
- package/tempoch-js/tempoch/tempoch-core/src/lib.rs +81 -0
- package/tempoch-js/tempoch/tempoch-core/src/period.rs +1168 -0
- package/tempoch-js/tempoch/tempoch-core/src/scales.rs +779 -0
- package/tempoch-js/tempoch/tempoch-ffi/Cargo.lock +889 -0
- package/tempoch-js/tempoch/tempoch-ffi/Cargo.toml +26 -0
- package/tempoch-js/tempoch/tempoch-ffi/build.rs +24 -0
- package/tempoch-js/tempoch/tempoch-ffi/cbindgen.toml +30 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/error.rs +19 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/lib.rs +82 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/period.rs +101 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/time.rs +711 -0
- package/tempoch-js/tempoch/tempoch-ffi/tests/ffi.rs +265 -0
- package/tempoch-js/tempoch-node/.prettierignore +6 -0
- package/tempoch-js/tempoch-node/.prettierrc.json +6 -0
- package/tempoch-js/tempoch-node/Cargo.lock +496 -0
- package/tempoch-js/tempoch-node/Cargo.toml +29 -0
- package/tempoch-js/tempoch-node/README.md +265 -0
- package/tempoch-js/tempoch-node/__test__/index.test.mjs +598 -0
- package/tempoch-js/tempoch-node/build.rs +5 -0
- package/tempoch-js/tempoch-node/c8.config.json +3 -0
- package/tempoch-js/tempoch-node/eslint.config.js +31 -0
- package/tempoch-js/tempoch-node/examples/periods.mjs +79 -0
- package/tempoch-js/tempoch-node/examples/quickstart.mjs +71 -0
- package/tempoch-js/tempoch-node/examples/timescales.mjs +92 -0
- package/tempoch-js/tempoch-node/index.d.ts +280 -0
- package/tempoch-js/tempoch-node/index.js +32 -0
- package/tempoch-js/tempoch-node/lib/JulianDate.js +176 -0
- package/tempoch-js/tempoch-node/lib/ModifiedJulianDate.js +156 -0
- package/tempoch-js/tempoch-node/lib/Period.js +133 -0
- package/tempoch-js/tempoch-node/lib/backend.js +38 -0
- package/tempoch-js/tempoch-node/lib/qttyCompat.js +92 -0
- package/tempoch-js/tempoch-node/native.cjs +317 -0
- package/tempoch-js/tempoch-node/package-lock.json +3223 -0
- package/tempoch-js/tempoch-node/package.json +56 -0
- package/tempoch-js/tempoch-node/src/lib.rs +573 -0
- package/tempoch-js/tempoch-web/Cargo.toml +23 -0
- package/tempoch-js/tempoch-web/index.d.ts +95 -0
- package/tempoch-js/tempoch-web/index.js +27 -0
- package/tempoch-js/tempoch-web/lib/JulianDate.js +170 -0
- package/tempoch-js/tempoch-web/lib/ModifiedJulianDate.js +145 -0
- package/tempoch-js/tempoch-web/lib/Period.js +121 -0
- package/tempoch-js/tempoch-web/lib/backend.js +118 -0
- package/tempoch-js/tempoch-web/package.json +46 -0
- package/tempoch-js/tempoch-web/src/lib.rs +184 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
import { Quantity } from '@siderust/qtty-web'
|
|
4
|
+
import { JulianDate, ModifiedJulianDate, Period } from '@siderust/tempoch-web'
|
|
5
|
+
|
|
6
|
+
export function init(
|
|
7
|
+
module_or_path?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module
|
|
8
|
+
): Promise<void>
|
|
9
|
+
|
|
10
|
+
export interface PlanetInfo {
|
|
11
|
+
name: string
|
|
12
|
+
mass: Quantity
|
|
13
|
+
radius: Quantity
|
|
14
|
+
semiMajorAxis: Quantity
|
|
15
|
+
eccentricity: number
|
|
16
|
+
inclination: Quantity
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface SphericalDirection {
|
|
20
|
+
polar: Quantity
|
|
21
|
+
azimuth: Quantity
|
|
22
|
+
frame: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CartesianEcef {
|
|
26
|
+
x: Quantity
|
|
27
|
+
y: Quantity
|
|
28
|
+
z: Quantity
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CartesianUnitVector {
|
|
32
|
+
x: number
|
|
33
|
+
y: number
|
|
34
|
+
z: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CartesianPosition {
|
|
38
|
+
x: Quantity
|
|
39
|
+
y: Quantity
|
|
40
|
+
z: Quantity
|
|
41
|
+
frame: string
|
|
42
|
+
center: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CrossingEvent {
|
|
46
|
+
mjd: ModifiedJulianDate
|
|
47
|
+
direction: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface CulminationEvent {
|
|
51
|
+
mjd: ModifiedJulianDate
|
|
52
|
+
altitude: Quantity
|
|
53
|
+
kind: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface AzimuthCrossingEvent {
|
|
57
|
+
mjd: ModifiedJulianDate
|
|
58
|
+
direction: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface AzimuthExtremum {
|
|
62
|
+
mjd: ModifiedJulianDate
|
|
63
|
+
azimuth: Quantity
|
|
64
|
+
kind: string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface MoonPhase {
|
|
68
|
+
phaseAngle: Quantity
|
|
69
|
+
illuminatedFraction: number
|
|
70
|
+
elongation: Quantity
|
|
71
|
+
waxing: boolean
|
|
72
|
+
label: string
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface PhaseEvent {
|
|
76
|
+
mjd: ModifiedJulianDate
|
|
77
|
+
kind: string
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class Observer {
|
|
81
|
+
constructor(lon: Quantity, lat: Quantity, height: Quantity)
|
|
82
|
+
static roqueDeLasMuchachos(): Observer
|
|
83
|
+
static elParanal(): Observer
|
|
84
|
+
static maunaKea(): Observer
|
|
85
|
+
static laSilla(): Observer
|
|
86
|
+
get lon(): Quantity
|
|
87
|
+
get lat(): Quantity
|
|
88
|
+
get height(): Quantity
|
|
89
|
+
format(): string
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export class Star {
|
|
93
|
+
constructor(
|
|
94
|
+
name: string,
|
|
95
|
+
distance: Quantity,
|
|
96
|
+
mass: Quantity,
|
|
97
|
+
radius: Quantity,
|
|
98
|
+
luminosity: Quantity,
|
|
99
|
+
ra: Quantity,
|
|
100
|
+
dec: Quantity
|
|
101
|
+
)
|
|
102
|
+
static catalog(name: string): Star
|
|
103
|
+
get name(): string
|
|
104
|
+
get distance(): Quantity
|
|
105
|
+
get mass(): Quantity
|
|
106
|
+
get radius(): Quantity
|
|
107
|
+
get luminosity(): Quantity
|
|
108
|
+
get ra(): Quantity
|
|
109
|
+
get dec(): Quantity
|
|
110
|
+
format(): string
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function getPlanet(name: string): PlanetInfo
|
|
114
|
+
export function listBodies(): Array<string>
|
|
115
|
+
export function listCatalogStars(): Array<string>
|
|
116
|
+
|
|
117
|
+
export function transformDirection(
|
|
118
|
+
polar: Quantity,
|
|
119
|
+
azimuth: Quantity,
|
|
120
|
+
srcFrame: string,
|
|
121
|
+
dstFrame: string,
|
|
122
|
+
jd: JulianDate
|
|
123
|
+
): SphericalDirection
|
|
124
|
+
|
|
125
|
+
export function directionToHorizontal(
|
|
126
|
+
polar: Quantity,
|
|
127
|
+
azimuth: Quantity,
|
|
128
|
+
srcFrame: string,
|
|
129
|
+
jd: JulianDate,
|
|
130
|
+
observer: Observer
|
|
131
|
+
): SphericalDirection
|
|
132
|
+
|
|
133
|
+
export function geodeticToEcef(observer: Observer): CartesianEcef
|
|
134
|
+
|
|
135
|
+
export function angularSeparation(
|
|
136
|
+
polar1: Quantity,
|
|
137
|
+
azimuth1: Quantity,
|
|
138
|
+
polar2: Quantity,
|
|
139
|
+
azimuth2: Quantity,
|
|
140
|
+
frame: string
|
|
141
|
+
): Quantity
|
|
142
|
+
|
|
143
|
+
export function cartesianDistance(
|
|
144
|
+
x1: Quantity,
|
|
145
|
+
y1: Quantity,
|
|
146
|
+
z1: Quantity,
|
|
147
|
+
x2: Quantity,
|
|
148
|
+
y2: Quantity,
|
|
149
|
+
z2: Quantity
|
|
150
|
+
): Quantity
|
|
151
|
+
|
|
152
|
+
export function cartesianMagnitude(x: Quantity, y: Quantity, z: Quantity): Quantity
|
|
153
|
+
|
|
154
|
+
export function dotProduct(
|
|
155
|
+
x1: number,
|
|
156
|
+
y1: number,
|
|
157
|
+
z1: number,
|
|
158
|
+
x2: number,
|
|
159
|
+
y2: number,
|
|
160
|
+
z2: number
|
|
161
|
+
): number
|
|
162
|
+
|
|
163
|
+
export function directionToCartesian(
|
|
164
|
+
polar: Quantity,
|
|
165
|
+
azimuth: Quantity
|
|
166
|
+
): CartesianUnitVector
|
|
167
|
+
|
|
168
|
+
export function vsop87Heliocentric(body: string, jd: JulianDate): CartesianPosition
|
|
169
|
+
export function vsop87Barycentric(body: string, jd: JulianDate): CartesianPosition
|
|
170
|
+
export function vsop87SunBarycentric(jd: JulianDate): CartesianPosition
|
|
171
|
+
export function vsop87EarthBarycentric(jd: JulianDate): CartesianPosition
|
|
172
|
+
export function vsop87EarthHeliocentric(jd: JulianDate): CartesianPosition
|
|
173
|
+
export function vsop87MoonGeocentric(jd: JulianDate): CartesianPosition
|
|
174
|
+
|
|
175
|
+
export function transformPositionCenter(
|
|
176
|
+
x: Quantity,
|
|
177
|
+
y: Quantity,
|
|
178
|
+
z: Quantity,
|
|
179
|
+
srcCenter: string,
|
|
180
|
+
dstCenter: string,
|
|
181
|
+
jd: JulianDate
|
|
182
|
+
): CartesianPosition
|
|
183
|
+
|
|
184
|
+
export function transformPositionFrame(
|
|
185
|
+
x: Quantity,
|
|
186
|
+
y: Quantity,
|
|
187
|
+
z: Quantity,
|
|
188
|
+
srcFrame: string,
|
|
189
|
+
dstFrame: string,
|
|
190
|
+
jd: JulianDate
|
|
191
|
+
): CartesianPosition
|
|
192
|
+
|
|
193
|
+
export function orbitalPeriod(name: string): Quantity
|
|
194
|
+
|
|
195
|
+
export function bodyAltitudeAt(
|
|
196
|
+
body: string,
|
|
197
|
+
observer: Observer,
|
|
198
|
+
mjd: ModifiedJulianDate
|
|
199
|
+
): Quantity
|
|
200
|
+
|
|
201
|
+
export function bodyAzimuthAt(
|
|
202
|
+
body: string,
|
|
203
|
+
observer: Observer,
|
|
204
|
+
mjd: ModifiedJulianDate
|
|
205
|
+
): Quantity
|
|
206
|
+
|
|
207
|
+
export function bodyCrossings(
|
|
208
|
+
body: string,
|
|
209
|
+
observer: Observer,
|
|
210
|
+
window: Period,
|
|
211
|
+
threshold: Quantity
|
|
212
|
+
): Array<CrossingEvent>
|
|
213
|
+
|
|
214
|
+
export function bodyCulminations(
|
|
215
|
+
body: string,
|
|
216
|
+
observer: Observer,
|
|
217
|
+
window: Period
|
|
218
|
+
): Array<CulminationEvent>
|
|
219
|
+
|
|
220
|
+
export function bodyAboveThreshold(
|
|
221
|
+
body: string,
|
|
222
|
+
observer: Observer,
|
|
223
|
+
window: Period,
|
|
224
|
+
threshold: Quantity
|
|
225
|
+
): Array<Period>
|
|
226
|
+
|
|
227
|
+
export function bodyBelowThreshold(
|
|
228
|
+
body: string,
|
|
229
|
+
observer: Observer,
|
|
230
|
+
window: Period,
|
|
231
|
+
threshold: Quantity
|
|
232
|
+
): Array<Period>
|
|
233
|
+
|
|
234
|
+
export function bodyAzimuthCrossings(
|
|
235
|
+
body: string,
|
|
236
|
+
observer: Observer,
|
|
237
|
+
window: Period,
|
|
238
|
+
bearing: Quantity
|
|
239
|
+
): Array<AzimuthCrossingEvent>
|
|
240
|
+
|
|
241
|
+
export function bodyAzimuthExtrema(
|
|
242
|
+
body: string,
|
|
243
|
+
observer: Observer,
|
|
244
|
+
window: Period
|
|
245
|
+
): Array<AzimuthExtremum>
|
|
246
|
+
|
|
247
|
+
export function starAltitudeAt(
|
|
248
|
+
star: Star,
|
|
249
|
+
observer: Observer,
|
|
250
|
+
mjd: ModifiedJulianDate
|
|
251
|
+
): Quantity
|
|
252
|
+
|
|
253
|
+
export function starAzimuthAt(
|
|
254
|
+
star: Star,
|
|
255
|
+
observer: Observer,
|
|
256
|
+
mjd: ModifiedJulianDate
|
|
257
|
+
): Quantity
|
|
258
|
+
|
|
259
|
+
export function starCrossings(
|
|
260
|
+
star: Star,
|
|
261
|
+
observer: Observer,
|
|
262
|
+
window: Period,
|
|
263
|
+
threshold: Quantity
|
|
264
|
+
): Array<CrossingEvent>
|
|
265
|
+
|
|
266
|
+
export function starCulminations(
|
|
267
|
+
star: Star,
|
|
268
|
+
observer: Observer,
|
|
269
|
+
window: Period
|
|
270
|
+
): Array<CulminationEvent>
|
|
271
|
+
|
|
272
|
+
export function starAboveThreshold(
|
|
273
|
+
star: Star,
|
|
274
|
+
observer: Observer,
|
|
275
|
+
window: Period,
|
|
276
|
+
threshold: Quantity
|
|
277
|
+
): Array<Period>
|
|
278
|
+
|
|
279
|
+
export function starBelowThreshold(
|
|
280
|
+
star: Star,
|
|
281
|
+
observer: Observer,
|
|
282
|
+
window: Period,
|
|
283
|
+
threshold: Quantity
|
|
284
|
+
): Array<Period>
|
|
285
|
+
|
|
286
|
+
export function starAzimuthCrossings(
|
|
287
|
+
star: Star,
|
|
288
|
+
observer: Observer,
|
|
289
|
+
window: Period,
|
|
290
|
+
bearing: Quantity
|
|
291
|
+
): Array<AzimuthCrossingEvent>
|
|
292
|
+
|
|
293
|
+
export function starAzimuthExtrema(
|
|
294
|
+
star: Star,
|
|
295
|
+
observer: Observer,
|
|
296
|
+
window: Period
|
|
297
|
+
): Array<AzimuthExtremum>
|
|
298
|
+
|
|
299
|
+
export function intersectPeriods(
|
|
300
|
+
periods1: Array<Period>,
|
|
301
|
+
periods2: Array<Period>
|
|
302
|
+
): Array<Period>
|
|
303
|
+
|
|
304
|
+
export function moonPhase(jd: JulianDate): MoonPhase
|
|
305
|
+
export function moonPhaseTopocentric(jd: JulianDate, observer: Observer): MoonPhase
|
|
306
|
+
export function findPhaseEvents(window: Period): Array<PhaseEvent>
|
|
307
|
+
export function moonIlluminationAbove(window: Period, kMin: number): Array<Period>
|
|
308
|
+
export function moonIlluminationBelow(window: Period, kMax: number): Array<Period>
|
|
309
|
+
export function moonIlluminationRange(window: Period, kMin: number, kMax: number): Array<Period>
|
|
310
|
+
|
|
311
|
+
export function version(): string
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @siderust/siderust-web — High-precision astronomy for the browser.
|
|
3
|
+
*
|
|
4
|
+
* Call `init()` (and `await` it) before using any other export.
|
|
5
|
+
*
|
|
6
|
+
* @module @siderust/siderust-web
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export { init } from './lib/backend.js';
|
|
10
|
+
export { Observer } from './lib/Observer.js';
|
|
11
|
+
export { Star } from './lib/Star.js';
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
// Bodies / Stars
|
|
15
|
+
getPlanet,
|
|
16
|
+
listBodies,
|
|
17
|
+
listCatalogStars,
|
|
18
|
+
// Coordinates
|
|
19
|
+
transformDirection,
|
|
20
|
+
directionToHorizontal,
|
|
21
|
+
geodeticToEcef,
|
|
22
|
+
angularSeparation,
|
|
23
|
+
cartesianDistance,
|
|
24
|
+
cartesianMagnitude,
|
|
25
|
+
dotProduct,
|
|
26
|
+
directionToCartesian,
|
|
27
|
+
// Ephemeris
|
|
28
|
+
vsop87Heliocentric,
|
|
29
|
+
vsop87Barycentric,
|
|
30
|
+
vsop87SunBarycentric,
|
|
31
|
+
vsop87EarthBarycentric,
|
|
32
|
+
vsop87EarthHeliocentric,
|
|
33
|
+
vsop87MoonGeocentric,
|
|
34
|
+
transformPositionCenter,
|
|
35
|
+
transformPositionFrame,
|
|
36
|
+
orbitalPeriod,
|
|
37
|
+
// Body events
|
|
38
|
+
bodyAltitudeAt,
|
|
39
|
+
bodyAzimuthAt,
|
|
40
|
+
bodyCrossings,
|
|
41
|
+
bodyCulminations,
|
|
42
|
+
bodyAboveThreshold,
|
|
43
|
+
bodyBelowThreshold,
|
|
44
|
+
bodyAzimuthCrossings,
|
|
45
|
+
bodyAzimuthExtrema,
|
|
46
|
+
// Star events
|
|
47
|
+
starAltitudeAt,
|
|
48
|
+
starAzimuthAt,
|
|
49
|
+
starCrossings,
|
|
50
|
+
starCulminations,
|
|
51
|
+
starAboveThreshold,
|
|
52
|
+
starBelowThreshold,
|
|
53
|
+
starAzimuthCrossings,
|
|
54
|
+
starAzimuthExtrema,
|
|
55
|
+
// Periods
|
|
56
|
+
intersectPeriods,
|
|
57
|
+
// Moon
|
|
58
|
+
moonPhase,
|
|
59
|
+
moonPhaseTopocentric,
|
|
60
|
+
findPhaseEvents,
|
|
61
|
+
moonIlluminationAbove,
|
|
62
|
+
moonIlluminationBelow,
|
|
63
|
+
moonIlluminationRange,
|
|
64
|
+
// Meta
|
|
65
|
+
version,
|
|
66
|
+
} from './lib/wrappers.js';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @siderust/siderust-web — Observer façade class.
|
|
3
|
+
*
|
|
4
|
+
* A geodetic observer location on the Earth's surface (WGS84 ellipsoid).
|
|
5
|
+
* This is a plain JS class; the WASM Observer is only used internally.
|
|
6
|
+
*
|
|
7
|
+
* @module @siderust/siderust-web/lib/Observer
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Quantity, convert } from '@siderust/qtty-web';
|
|
11
|
+
|
|
12
|
+
export class Observer {
|
|
13
|
+
/**
|
|
14
|
+
* Create an observer at a geodetic position.
|
|
15
|
+
*
|
|
16
|
+
* @param {Quantity} lon Longitude, convertible to Degree.
|
|
17
|
+
* @param {Quantity} lat Latitude, convertible to Degree.
|
|
18
|
+
* @param {Quantity} height Height, convertible to Meter.
|
|
19
|
+
*/
|
|
20
|
+
constructor(lon, lat, height) {
|
|
21
|
+
this._lonDeg = _extractQuantityValue(lon, 'Degree', 'lon');
|
|
22
|
+
this._latDeg = _extractQuantityValue(lat, 'Degree', 'lat');
|
|
23
|
+
this._heightM = _extractQuantityValue(height, 'Meter', 'height');
|
|
24
|
+
|
|
25
|
+
if (!Number.isFinite(this._lonDeg) || !Number.isFinite(this._latDeg) || !Number.isFinite(this._heightM)) {
|
|
26
|
+
throw new Error('Observer coordinates must be finite (not NaN or ±infinity)');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// ── preset observatories ───────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
/** Roque de los Muchachos Observatory (La Palma, Spain). */
|
|
33
|
+
static roqueDeLasMuchachos() {
|
|
34
|
+
return new Observer(
|
|
35
|
+
new Quantity(-17.8925, 'Degree'),
|
|
36
|
+
new Quantity(28.7543, 'Degree'),
|
|
37
|
+
new Quantity(2396, 'Meter'),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Paranal Observatory (ESO, Chile). */
|
|
42
|
+
static elParanal() {
|
|
43
|
+
return new Observer(
|
|
44
|
+
new Quantity(-70.4043, 'Degree'),
|
|
45
|
+
new Quantity(-24.6272, 'Degree'),
|
|
46
|
+
new Quantity(2635, 'Meter'),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Mauna Kea Observatory (Hawaiʻi, USA). */
|
|
51
|
+
static maunaKea() {
|
|
52
|
+
return new Observer(
|
|
53
|
+
new Quantity(-155.4681, 'Degree'),
|
|
54
|
+
new Quantity(19.8207, 'Degree'),
|
|
55
|
+
new Quantity(4207, 'Meter'),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** La Silla Observatory (ESO, Chile). */
|
|
60
|
+
static laSilla() {
|
|
61
|
+
return new Observer(
|
|
62
|
+
new Quantity(-70.7346, 'Degree'),
|
|
63
|
+
new Quantity(-29.2584, 'Degree'),
|
|
64
|
+
new Quantity(2400, 'Meter'),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ── typed accessors ────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
/** Longitude as a `Quantity` in Degree. */
|
|
71
|
+
get lon() {
|
|
72
|
+
return new Quantity(this._lonDeg, 'Degree');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Latitude as a `Quantity` in Degree. */
|
|
76
|
+
get lat() {
|
|
77
|
+
return new Quantity(this._latDeg, 'Degree');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Height as a `Quantity` in Meter. */
|
|
81
|
+
get height() {
|
|
82
|
+
return new Quantity(this._heightM, 'Meter');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Human-readable string representation. */
|
|
86
|
+
format() {
|
|
87
|
+
return `Observer(lon=${this._lonDeg.toFixed(4)}°, lat=${this._latDeg.toFixed(4)}°, h=${this._heightM.toFixed(1)} m)`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Extract a canonical scalar value from a `Quantity`.
|
|
93
|
+
* @param {unknown} val
|
|
94
|
+
* @param {string} expectedUnit
|
|
95
|
+
* @param {string} label
|
|
96
|
+
* @returns {number}
|
|
97
|
+
*/
|
|
98
|
+
function _extractQuantityValue(val, expectedUnit, label) {
|
|
99
|
+
if (!(val instanceof Quantity)) {
|
|
100
|
+
throw new Error(`${label}: expected a Quantity`);
|
|
101
|
+
}
|
|
102
|
+
return convert(val.value, val.unit, expectedUnit);
|
|
103
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @siderust/siderust-web — Star façade class.
|
|
3
|
+
*
|
|
4
|
+
* A star with physical parameters and sky coordinates.
|
|
5
|
+
* This is a plain JS class; the WASM Star is only used internally.
|
|
6
|
+
*
|
|
7
|
+
* @module @siderust/siderust-web/lib/Star
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Quantity } from "@siderust/qtty-web";
|
|
11
|
+
import * as backend from "./backend.js";
|
|
12
|
+
|
|
13
|
+
export class Star {
|
|
14
|
+
/**
|
|
15
|
+
* Create a custom star.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} name Display name
|
|
18
|
+
* @param {Quantity} distance Distance, convertible to LightYear
|
|
19
|
+
* @param {Quantity} mass Mass, convertible to SolarMass
|
|
20
|
+
* @param {Quantity} radius Radius, convertible to NominalSolarRadius
|
|
21
|
+
* @param {Quantity} luminosity Luminosity, convertible to SolarLuminosity
|
|
22
|
+
* @param {Quantity} ra Right ascension, convertible to Degree
|
|
23
|
+
* @param {Quantity} dec Declination, convertible to Degree
|
|
24
|
+
*/
|
|
25
|
+
constructor(name, distance, mass, radius, luminosity, ra, dec) {
|
|
26
|
+
this._distanceLy = _extractQuantityValue(distance, "LightYear", "distance");
|
|
27
|
+
this._massSolar = _extractQuantityValue(mass, "SolarMass", "mass");
|
|
28
|
+
this._radiusSolar = _extractQuantityValue(
|
|
29
|
+
radius,
|
|
30
|
+
"NominalSolarRadius",
|
|
31
|
+
"radius",
|
|
32
|
+
);
|
|
33
|
+
this._luminositySolar = _extractQuantityValue(
|
|
34
|
+
luminosity,
|
|
35
|
+
"SolarLuminosity",
|
|
36
|
+
"luminosity",
|
|
37
|
+
);
|
|
38
|
+
this._raDeg = _extractQuantityValue(ra, "Degree", "ra");
|
|
39
|
+
this._decDeg = _extractQuantityValue(dec, "Degree", "dec");
|
|
40
|
+
|
|
41
|
+
this._name = name;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Look up a star from the built-in catalog by name.
|
|
46
|
+
* @param {string} name
|
|
47
|
+
* @returns {Star}
|
|
48
|
+
*/
|
|
49
|
+
static catalog(name) {
|
|
50
|
+
const native = backend.NativeStar.catalog(name);
|
|
51
|
+
return new Star(
|
|
52
|
+
native.name,
|
|
53
|
+
new Quantity(native.distanceLy, "LightYear"),
|
|
54
|
+
new Quantity(native.massSolar, "SolarMass"),
|
|
55
|
+
new Quantity(native.radiusSolar, "NominalSolarRadius"),
|
|
56
|
+
new Quantity(native.luminositySolar, "SolarLuminosity"),
|
|
57
|
+
new Quantity(native.raDeg, "Degree"),
|
|
58
|
+
new Quantity(native.decDeg, "Degree"),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Star name. */
|
|
63
|
+
get name() {
|
|
64
|
+
return this._name;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ── typed accessors ────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
/** Distance as a `Quantity` in LightYear. */
|
|
70
|
+
get distance() {
|
|
71
|
+
return new Quantity(this._distanceLy, "LightYear");
|
|
72
|
+
}
|
|
73
|
+
/** Mass as a `Quantity` in SolarMass. */
|
|
74
|
+
get mass() {
|
|
75
|
+
return new Quantity(this._massSolar, "SolarMass");
|
|
76
|
+
}
|
|
77
|
+
/** Radius as a `Quantity` in NominalSolarRadius. */
|
|
78
|
+
get radius() {
|
|
79
|
+
return new Quantity(this._radiusSolar, "NominalSolarRadius");
|
|
80
|
+
}
|
|
81
|
+
/** Luminosity as a `Quantity` in SolarLuminosity. */
|
|
82
|
+
get luminosity() {
|
|
83
|
+
return new Quantity(this._luminositySolar, "SolarLuminosity");
|
|
84
|
+
}
|
|
85
|
+
/** Right ascension as a `Quantity` in Degree. */
|
|
86
|
+
get ra() {
|
|
87
|
+
return new Quantity(this._raDeg, "Degree");
|
|
88
|
+
}
|
|
89
|
+
/** Declination as a `Quantity` in Degree. */
|
|
90
|
+
get dec() {
|
|
91
|
+
return new Quantity(this._decDeg, "Degree");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Human-readable representation. */
|
|
95
|
+
format() {
|
|
96
|
+
return `Star(${this._name}, d=${this._distanceLy.toFixed(1)} ly, RA=${this._raDeg.toFixed(4)}°, Dec=${this._decDeg.toFixed(4)}°)`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Extract a canonical scalar value from a `Quantity`.
|
|
102
|
+
* @param {unknown} value
|
|
103
|
+
* @param {string} unit
|
|
104
|
+
* @param {string} label
|
|
105
|
+
* @returns {number}
|
|
106
|
+
*/
|
|
107
|
+
function _extractQuantityValue(value, unit, label) {
|
|
108
|
+
if (!(value instanceof Quantity)) {
|
|
109
|
+
throw new Error(`${label}: expected a Quantity`);
|
|
110
|
+
}
|
|
111
|
+
const converted = value.to(unit).value;
|
|
112
|
+
if (!Number.isFinite(converted)) {
|
|
113
|
+
throw new Error(`${label} must be finite (not NaN or ±infinity)`);
|
|
114
|
+
}
|
|
115
|
+
return converted;
|
|
116
|
+
}
|