Repository navigation
Draw the ecliptic - #20
Merged
Merged
Conversation
Add a layer that draws the line the Sun follows in the sky, stopping at the horizon. The clipping at the horizon that the constellation boundaries use now lives in Horizon, so both layers share it.
Join the two pieces of the ecliptic at the seam so it is one line, compute the obliquity once, and keep the Horizon helpers private. Move distance_from_center to the spec helpers and add specs for Horizon.visible_runs.
There was a problem hiding this comment.
🟢 Approval recommended
The review identifies no active issues in the optional ecliptic layer or shared horizon-clipping changes.
No open issues 🎉
What changed in this PR
Adds an optional ecliptic layer to Skymap, using the existing coordinate conversion and SVG rendering pipeline to draw the Sun’s annual path across the sky.
Changes:
- Samples the J2000 ecliptic at one-degree intervals and renders it as a thin, solid gold line.
- Shares horizon clipping between the ecliptic and constellation boundaries.
- Adds geometry and rendering specs, documents the layer, and updates the sample map.
| File | Description |
|---|---|
spec/support/geometry_helpers.rb |
Extracts a shared distance helper for geometry specs. |
spec/skymap/renderer/svg_spec.rb |
Checks ecliptic polyline formatting and styling. |
spec/skymap/layers/ecliptic_spec.rb |
Covers Sun alignment, continuity, horizon clipping, and width scaling. |
spec/skymap/layers/constellation_boundaries_spec.rb |
Uses the shared geometry helper. |
spec/skymap/horizon_spec.rb |
Covers visible runs and horizon crossings. |
sky_map.svg |
Adds the ecliptic to the sample map. |
README.md |
Documents the layer and updates the sample image description. |
lib/skymap/renderer/svg.rb |
Adds solid gold ecliptic rendering. |
lib/skymap/renderer/ecliptic.rb |
Defines the ecliptic rendering data object. |
lib/skymap/layers/ecliptic.rb |
Generates, clips, and joins sampled ecliptic points. |
lib/skymap/layers/constellation_boundaries.rb |
Delegates horizon clipping to the shared helper. |
lib/skymap/horizon.rb |
Extracts reusable visible-run clipping logic. |
lib/skymap.rb |
Loads the new layer and rendering object. |
CHANGELOG.md |
Records the new ecliptic layer. |
Review effort: Balanced
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
Skymap::Layers::Ecliptic, which draws the line the Sun follows in the sky. It stops at the horizon, like the constellation boundaries.The line is the great circle of the J2000 ecliptic, sampled every degree and run through Astronoby like the other J2000 points, so it is precessed to the date of the map. It is drawn in a muted gold, thin and solid, so it stays behind the stars.
The code that cuts a line at the horizon moved from
ConstellationBoundariestoHorizon.visible_runs, so both layers use it. The boundaries behave as before.On a map the line starts and ends at the same point of the circle, so when that point is above the horizon, the line can come as two pieces that touch. They look like one line.
The sample map in the README now shows it.