diff --git a/src/app/features/galaxy-system/galaxy-system-scene.component.spec.ts b/src/app/features/galaxy-system/galaxy-system-scene.component.spec.ts index ada7a27..743de04 100644 --- a/src/app/features/galaxy-system/galaxy-system-scene.component.spec.ts +++ b/src/app/features/galaxy-system/galaxy-system-scene.component.spec.ts @@ -1132,6 +1132,18 @@ describe('GalaxySystemSceneComponent camera-flight transitions', () => { expect(engine.getCamera().position.length()).toBeCloseTo(onPhone, 6); }); + it('frames it by the shorter side on a phone held sideways too', async () => { + // 844x390: framed by the width, the disc took the desktop's half again, 8.49 AU out, not 14.97. + const canvas = (fixture.nativeElement as HTMLElement).querySelector('canvas')!; + Object.defineProperty(canvas, 'clientWidth', { value: 844 }); + Object.defineProperty(canvas, 'clientHeight', { value: 390 }); + const scene = await enter(ANTARES); + const camera = engine.getPerspectiveCamera(); + const gridOuterRadiusAu = (scene.systemRenderer as unknown as { gridOuterRadiusAu: number }).gridOuterRadiusAu; + const radius = scene.starMarkerGeometry.parameters.radius; + expect(engine.getCamera().position.length()).toBeCloseTo(systemFramingDistanceAu(gridOuterRadiusAu, { fovDegrees: camera.fov, aspect: camera.aspect, shorterSidePx: 390 }, radius), 6); + }); + it('draws a star nothing gives a size or temperature for as a grey point, not as the Sun', async () => { const scene = await enter(PROCYON_B); expect(scene.starMarkerGeometry.parameters.radius).toBeLessThan(SUN_RADIUS_AU / 1000); diff --git a/src/app/features/galaxy-system/star-readouts.spec.ts b/src/app/features/galaxy-system/star-readouts.spec.ts index e514e77..96aa49b 100644 --- a/src/app/features/galaxy-system/star-readouts.spec.ts +++ b/src/app/features/galaxy-system/star-readouts.spec.ts @@ -93,6 +93,9 @@ describe('starReadouts', () => { expect(value(starReadouts(betelgeuse, { radiusSolar: 584.3, radiusDerived: true, temperatureK: 3590, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('~580 solar radii, from its type and brightness'); const gj3655 = { ...HYG_STAR, name: 'GJ 3655', spectralType: 'M8', colorIndex: null, colorSystem: undefined }; expect(value(starReadouts(gj3655, { radiusSolar: 0.106, radiusDerived: true, temperatureK: 2570, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('~0.11 solar radii, from its type and brightness'); + // Nor a dwarf's whose colour is off the table: HD 49748, G5 V at B−V −0.32. + const hd49748 = { ...HYG_STAR, name: 'HD 49748', spectralType: 'G5V', colorIndex: -0.32 }; + expect(value(starReadouts(hd49748, { radiusSolar: 1.2, radiusDerived: true, temperatureK: 5660, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('~1.2 solar radii, from its type and brightness'); const kepler445 = { ...HYG_STAR, spectralType: 'M4', colorIndex: 1.66, colorFromTemperature: true, source: 'exoplanet-archive' }; expect(value(starReadouts(kepler445, { radiusSolar: 0.21, radiusDerived: true, temperatureK: 3157, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('~0.21 solar radii, from its temperature and brightness'); expect(value(starReadouts(HYG_STAR, { radiusSolar: 1, radiusDerived: false, temperatureK: 5772, luminositySolar: null, luminosityDerived: true }), 'Radius')).toBe('1.00 solar radii'); diff --git a/src/app/shared/astro/stellar.spec.ts b/src/app/shared/astro/stellar.spec.ts index eb255e2..aa23ee0 100644 --- a/src/app/shared/astro/stellar.spec.ts +++ b/src/app/shared/astro/stellar.spec.ts @@ -5,6 +5,7 @@ import { blackbodyColor, bolometricCorrection, effectiveTemperatureK, + giantSurface, luminositySolar, radiusFromLuminositySolar, SOLAR_ABSOLUTE_MAGNITUDE_V, @@ -161,6 +162,25 @@ describe('luminositySolar', () => { } }); + it("draws van Belle's own M4, M5 and M7 giants at their measured radii, and holds the correction past M7.5", () => { + // Median Johnson V, parallax and radius from van Belle et al. (2021) tables 6 and 4, none behind + // more than 0.02 mag of dust: 103.1, 103.2 and 173.3 R☉, drawn at 1.00, 1.00 and 0.91 of that. + // A dwarf's correction draws M4 18 % smaller and M5 26 %, and M6's −3.94 draws M7 25 % smaller; + // hence 15 %, not the M6 case's 20 %. + const giants = [ + [{ magnitude: 7.72, distancePc: 1000 / 1.87, spectralType: 'M4III', magnitudeBand: 'V' }, 103.11], // HD 118669 + [{ magnitude: 6.97, distancePc: 1000 / 3.45, spectralType: 'M5III', magnitudeBand: 'V' }, 103.15], // HD 104207 + [{ magnitude: 9.29, distancePc: 1000 / 2.17, spectralType: 'M7III', magnitudeBand: 'V' }, 173.31] // HIP 68357 + ] as const; + for (const [star, measured] of giants) { + const radius = radiusFromLuminositySolar(luminositySolar(star)!, effectiveTemperatureK(star)!); + expect(radius / measured).toBeGreaterThan(1 / 1.15); + expect(radius / measured).toBeLessThan(1.15); + } + // Six M8 III stars in the catalogue, past the table's last type, take its −4.86, not its first. + expect(giantSurface('M8III')!.bolometricCorrectionV).toBe(giantSurface('M7.5III')!.bolometricCorrectionV); + }); + it('reads a hot giant reddened by dust at its type, not at the cool star its colour reads as', () => { // Menkib, O7.5 Iab at B−V 0.02: 14 R☉ (Krtička & Kubát 2010). At its colour's 9 517 K and its // type's correction it was drawn at 95; the dust it is behind still leaves it dimmer than it is.