Closed eheitfield closed 1 year ago
Hi. Thanks for your message. Indeed, this could be added.
I've spent so much time trying to factor out everything, and play with this powerful Swift pattern which is protocol-oriented programming. But sometimes, I missed a few details in the global view.
I am glad it helped you in different ways. Don't hesitate to support it on patreon, it if you wish. ;-)
I am currently moving the func makeHorizontalCoordinates(with geographicCoordinates: GeographicCoordinates) -> HorizontalCoordinates
function from the Sun
class to the CelestialBody
protocol.
The little change is that it now uses self.equatorialCoordinates
and not self.apparentEquatorialCoordinates
as it was in the Sun class.
Hence to be consistent, I kept the method in the Sun
class, with the existing implementation, but renaming it more correctly makeApparentHorizontalCoordinates(with geographicCoordinates: GeographicCoordinates) -> HorizontalCoordinates
Consequently: the Sun class has hence both methods: the standard one from the CelestialBody
protocol, and the "apparent" one as a specific implementation.
I'll wait for closing #100 and #101 before making a patch release.
Already done.
A very small API suggestion...
The Sun object includes the function
makeHorizontalCoordinates(with:)
which is convenient for folks wanting to plot the location of the sun in the sky. The CelestialBody protocol already has all the information one needs to compute rectangular coordinates (RA and HA), so why not add a default implementation of the function to that protocol so all objects (not just the Sun) get access to it?While I'm here, I'd just like to say that this library is AWESOME! It's already saved me tons of time and has taught me a lot about celestial coordinates as well. I'm looking forward to using it in my next app. Thanks!!!