Simple way to obtain Moon Angles in Kotlin. #298
-
Hello, I'm looking for the best performance oriented way to obtain these statistics for the Moon based on observers location and time:
These are used to draw a bitmap of the moon: DrawMoonBitmap.kt I'm currently using SunMoonCalculator from http://conga.oan.es/~alonso/doku.php?id=blog:sun_moon_position Is it possible to obtain these values with Astronomy Engine in the quick and easy way? Thanks for your answers! Tomas |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello @amoledwatchfaces and welcome to the project! Most of this will be easy in Astronomy Engine. You can start with the illumination function. It returns an Illumination object, which tells you illumination phase angle (the angle in degrees between the Sun and the Earth, as seen from the body), and the illuminated phase fraction (from 0.0 to 1.0). It is possible to calculate the Moon's axis using the function rotationAxis. It gives you the direction of the axis in space as both a vector and as equatorial angles (right ascension and declination). Do you have a sense of what a "position angle" means in the context you need? That part may take some research. About the bright limb angle and parallactic angle: I have had requests for these angles before, and generally they are both used as a means to find what the person really wants, which is the orientation of the lit side of the Moon as seen by an observer on the Earth, with respect to the observer's local horizon. In other words, you want to draw the way the Moon looks to a person standing at a given latitude and longitude at a given time. I approached this problem myself without thinking of bright limb and parallactic angles. Instead, I calculate the angle of the sunlit side of the Moon from the observer's zenith direction. I have demo programs for this, but not in Kotlin yet. Probably the easiest one to understand will be the C# program camera.cs. The formulas in that code could be ported to Kotlin fairly easily, because the Astronomy Engine functions and types are similar between C# and Kotlin. If your goal is to draw the Moon the way it appears to an observer, that camera.cs source code may help. Or maybe you are trying to do something else, in which case I can help you figure that out instead. So let's keep the conversation going and I'm sure I can help you in your goal. |
Beta Was this translation helpful? Give feedback.
Hello @amoledwatchfaces and welcome to the project!
Most of this will be easy in Astronomy Engine. You can start with the illumination function. It returns an Illumination object, which tells you illumination phase angle (the angle in degrees between the Sun and the Earth, as seen from the body), and the illuminated phase fraction (from 0.0 to 1.0).
It is possible to calculate the Moon's axis using the function rotationAxis. It gives you the direction of the axis in space as both a vector and as equatorial angles (right ascension and declination). Do you have a sense of what a "position angle" means in the context you need? That part may take some research.
About the bright limb angle and…