Repository navigation
Draw the Sun and the planets - #18
Merged
Merged
Conversation
Planets are sized like stars, so the sizing moves to StarSize.for to be shared by both layers.
The fixture keeps the barycenters of Mercury to Neptune besides the Sun, the Moon and the Earth, still from 2025 to 2030. Its comment area is laid out in DAF records, as in the original kernel.
Adds the Sun and Planets layers, drawn from an ephemeris like the Moon, and shows Saturn on the map of the README.
There was a problem hiding this comment.
🟡 Changes recommended
Bright magnitude cutoffs reverse the planet-sizing interval, incorrectly shrinking all accepted planets to the minimum radius.
1 open issue
What changed in this PR
Adds Sun and planet layers to Skymap’s existing sky-map rendering, using ephemerides to position bodies and omit those below the horizon.
Changes:
- Adds Sun discs and magnitude-sized, warm-tinted planets.
- Shares sizing logic between stars and planets without changing existing star sizing.
- Adds rendering tests and updates documentation, the sample map, and the test ephemeris reference.
| File | Description |
|---|---|
| spec/support/astronomy_helpers.rb | Uses the renamed ephemeris fixture. |
| spec/skymap/star_size_spec.rb | Tests the shared sizing factory. |
| spec/skymap/renderer/svg_spec.rb | Tests Sun and planet SVG output. |
| spec/skymap/layers/sun_spec.rb | Tests Sun placement, sizing, and visibility. |
| spec/skymap/layers/planets_spec.rb | Tests planet placement, filtering, and sizing. |
| sky_map.svg | Adds Saturn to the sample map. |
| README.md | Documents the new layers and updated fixture. |
| lib/skymap/star_size.rb | Extracts shared sizing defaults and factory. |
| lib/skymap/renderer/svg.rb | Draws Sun and planet elements. |
| lib/skymap/renderer/sun.rb | Defines the Sun render element. |
| lib/skymap/renderer/planet.rb | Defines the planet render element. |
| lib/skymap/layers/sun.rb | Projects and sizes the visible Sun. |
| lib/skymap/layers/stars.rb | Uses the shared sizing factory. |
| lib/skymap/layers/planets.rb | Projects, filters, and sizes planets. |
| lib/skymap.rb | Loads the new layers and render elements. |
| CHANGELOG.md | Records the Sun and planet features. |
Review effort: Balanced
A magnitude limit brighter than -1.5 made the brightest end of the scale fainter than its faintest end, which shrank every object to the minimum radius. The scale now starts one magnitude brighter than the limit when it needs to.
rhannequin
force-pushed
the
draw-the-planets
branch
from
October 28, 2026 09:59
ee55cf2 to
5a0b865
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds two layers that draw the Sun and the planets where they are in the sky:
Like the Moon, they need an ephemeris, and they are left out when below the horizon.
Planetsdraws Mercury to Neptune as a star would be, using the apparent magnitude from Astronoby, with the same sizes as the stars and a warm tint. It has amagnitude_limit:that defaults to 5 as for the stars, so Uranus (5.7) and Neptune (7.7) are out unless it is raised. Planets are not labeled yetSunis a disc at 3% of the radius of the sky, the same size as the Moon, as the Sun and the Moon look about the same size from the groundStarSize.fortakes the sizing of the stars out of theStarslayer, so both layers share it. Stars are sized exactly as beforede440s_2025_2030_excerpt.bspsince it is not only about the Moon anymore. It goes from 508 KB to 710 KB, and is cut withruby-ephem excerptfrom DE440s. While at it, its comment area now follows the DAF layout (1,000 characters per record), which the previous one did not, so tools that read the comments now show it correctly