Fix what the review of this branch found, starting with the pick rule it only claimed
The off-screen rule for clicks was described in 3f0abf8 and in the pull request, but only its
comment was committed: pickAt still let the slop reach past the frame. The mutant that was said
to catch it matched nothing, and an unrelated flaky test failed instead. The frame test is now in
pickAt, before the slop, and its test fails without it (star at NDC 1.01, click at 0.995).
Venus, Uranus and Pluto turned forwards: Horizons states a retrograde spin twice, by a negative
rate and by an obliquity over 90 degrees, and both were applied. The period's sign is now used
only when no obliquity is known. Measured on the live markers, spin axis against orbit normal is
cos(obliquity) for each: Venus -0.999, Uranus -0.135, Pluto -0.494, Earth 0.917.
Moons listed as rates rather than "Synchronous" drifted about 5 degrees an orbit and Titan did not
turn: every moon is now locked at its Kepler period. Pluto's obliquity comes from IAU WGCCRE 2015,
Horizons gives none.
Also:
- the star's light is white at pi, not a warm 2.2 that left the photographs dim;
- procedural textures are 128x64, not 512x256 that froze the main thread ~60 ms a body;
- Io, Pluto, Titan and Deimos lose their "maps", which were disc photographs with black sky;
- an exoplanet with only a mass gets a radius from it (M^0.55, capped at Jupiter), not Earth's;
- the clock knows when it has left the present even once back at real time, so the date and
"Back to now" stay up.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -409,12 +409,32 @@ describe('rotation', () => {
|
||||
expect(Math.abs(turnedDegrees(spinning(), 23.934 / 96))).toBeCloseTo(90, 1);
|
||||
});
|
||||
|
||||
it('turns a retrograde body the other way', () => {
|
||||
// Venus: its day runs backwards, which the catalogue carries as a negative period.
|
||||
const forward = turnedDegrees(spinning(), 23.934 / 96);
|
||||
const backward = turnedDegrees(spinning({ rotationPeriodHours: -23.934 }), 23.934 / 96);
|
||||
/**
|
||||
* Which way a body spins in the world: its angular velocity projected on its orbit's normal.
|
||||
* Positive is prograde, turning the same way it goes round; negative is retrograde.
|
||||
*/
|
||||
function spinSense(body: BodyRecord): number {
|
||||
const renderer = new SystemOrbitsRenderer([body], [], undefined, 1);
|
||||
renderer.update(DEFAULT_EPOCH_JD);
|
||||
const start = renderer.members[0].marker.quaternion.clone();
|
||||
renderer.update(DEFAULT_EPOCH_JD + 0.01);
|
||||
const turn = renderer.members[0].marker.quaternion.clone().multiply(start.invert());
|
||||
const axis = new THREE.Vector3(turn.x, turn.y, turn.z).multiplyScalar(Math.sign(turn.w));
|
||||
return axis.normalize().dot(new THREE.Vector3(0, 0, 1).applyQuaternion(renderer.referenceFrame));
|
||||
}
|
||||
|
||||
expect(Math.sign(backward)).toBe(-Math.sign(forward));
|
||||
it('turns Venus backwards, as Horizons gives it: a negative rate and an obliquity past 90', () => {
|
||||
// Both say retrograde, in two conventions. Applied together they cancelled into a forward
|
||||
// turn, which is how Venus and Uranus used to be drawn.
|
||||
const venus = spinning({ id: 'venus', rotationPeriodHours: -5832.54, obliquityDeg: 177.3 });
|
||||
|
||||
expect(spinSense(spinning())).toBeGreaterThan(0.9);
|
||||
expect(spinSense(venus)).toBeLessThan(-0.9);
|
||||
});
|
||||
|
||||
it('reads the sign of the period only where no obliquity says which way the pole points', () => {
|
||||
expect(spinSense(spinning({ rotationPeriodHours: -23.934, obliquityDeg: undefined }))).toBeLessThan(-0.9);
|
||||
expect(spinSense(spinning({ rotationPeriodHours: 23.934, obliquityDeg: undefined }))).toBeGreaterThan(0.9);
|
||||
});
|
||||
|
||||
it('leaves a body with no published rotation still', () => {
|
||||
@@ -427,3 +447,20 @@ describe('rotation', () => {
|
||||
expect(renderer.members[0].marker.quaternion.angleTo(start)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('exoplanet size without a measured radius', () => {
|
||||
const radiusOf = (overrides: Partial<ExoplanetRecord>): number => {
|
||||
const renderer = new SystemOrbitsRenderer([], [exoplanet(overrides)], undefined, 1);
|
||||
return ((renderer.members[0].marker as THREE.Mesh).geometry as THREE.SphereGeometry).parameters.radius;
|
||||
};
|
||||
const EARTH_AU = 6371 / 149597870.7;
|
||||
|
||||
it('draws a giant known only by its mass at about Jupiter’s size, not at an Earth', () => {
|
||||
// 14 Her b: 2 829 Earth masses, no radius. It used to come out the size of the Earth.
|
||||
expect(radiusOf({ radiusEarth: undefined, massEarth: 2829 }) / EARTH_AU).toBeCloseTo(11.2, 1);
|
||||
});
|
||||
|
||||
it('keeps a measured radius over any estimate', () => {
|
||||
expect(radiusOf({ radiusEarth: 1.88, massEarth: 2829 }) / EARTH_AU).toBeCloseTo(1.88, 2);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user