Comments (3)
Potential Solution ?
This looks like it can be resolved by removing this line in moon.js
:
i = (i+1) & 3;
Here's what results, and these are much closer aligned to expectations:
Day: 1 || illuminatedFraction: 0.2718262029195282 || phaseQuarter: 1
Day: 2 || illuminatedFraction: 0.1913535738047783 || phaseQuarter: 1
Day: 3 || illuminatedFraction: 0.12275534591473419 || phaseQuarter: 1
Day: 4 || illuminatedFraction: 0.06789228968867916 || phaseQuarter: 1
Day: 5 || illuminatedFraction: 0.028402658847401396 || phaseQuarter: 1
Day: 6 || illuminatedFraction: 0.005654730897217575 || phaseQuarter: 1
Day: 7 || illuminatedFraction: 0.0006617445257049992 || phaseQuarter: 2
Day: 8 || illuminatedFraction: 0.01398865166284069 || phaseQuarter: 2
Day: 9 || illuminatedFraction: 0.04567593153994548 || phaseQuarter: 2
Day: 10 || illuminatedFraction: 0.09519380617986456 || phaseQuarter: 2
Day: 11 || illuminatedFraction: 0.16142284737506968 || phaseQuarter: 2
Day: 12 || illuminatedFraction: 0.2426405680532956 || phaseQuarter: 2
Day: 13 || illuminatedFraction: 0.3364851635748891 || phaseQuarter: 2
Day: 14 || illuminatedFraction: 0.43987279594989304 || phaseQuarter: 2
Day: 15 || illuminatedFraction: 0.5488689342271671 || phaseQuarter: 3
Day: 16 || illuminatedFraction: 0.6585597621788225 || phaseQuarter: 3
Day: 17 || illuminatedFraction: 0.763029581554865 || phaseQuarter: 3
Day: 18 || illuminatedFraction: 0.8555981913616235 || phaseQuarter: 3
Day: 19 || illuminatedFraction: 0.9294546722062444 || phaseQuarter: 3
Day: 20 || illuminatedFraction: 0.9786814411700813 || phaseQuarter: 3
Day: 21 || illuminatedFraction: 0.9994095420276781 || phaseQuarter: 3
Day: 22 || illuminatedFraction: 0.9906443297921943 || phaseQuarter: 0
Day: 23 || illuminatedFraction: 0.9543665946579276 || phaseQuarter: 0
Day: 24 || illuminatedFraction: 0.8948694419357917 || phaseQuarter: 0
Day: 25 || illuminatedFraction: 0.8176725929146917 || phaseQuarter: 0
Day: 26 || illuminatedFraction: 0.728477536842415 || phaseQuarter: 0
Day: 27 || illuminatedFraction: 0.6324682679459483 || phaseQuarter: 0
Day: 28 || illuminatedFraction: 0.5340178279576334 || phaseQuarter: 0
Day: 29 || illuminatedFraction: 0.4367005906508668 || phaseQuarter: 1
Day: 30 || illuminatedFraction: 0.3434676777124016 || phaseQuarter: 1
Day: 31 || illuminatedFraction: 0.2568689766546564 || phaseQuarter: 1
I'm running this on a fork with tests (https://github.com/0xStarcat/Moshier-Ephemeris-JS), so I can say confidently removing this line does NOT break anything.
Does this line need to be in there? Was the &
bitwise operator intended as a %
modulo maybe?
Honestly, if you changed the line to:
i = (i+2) % 4;
and moved it right above $moshier.body.moon.position.phaseQuarter = i;
so it ran every iteration, it makes the calculated value make much more sense.
New Moon = 0
First quarter = 1
Full moon = 2
last quarter = 3
i can add a PR for this if you'd like. What do you think?
Thank you! :)
from ephemeris.
I'm beginning to think this line
i = (i+1) & 3;
was maybe meant to serve as an "approximator" or an orb
in astrological terms, for when to designate the start and end of a quarter. In this case, from checking the phaseDaysBefore
and phaseDaysAfter
values, it seems like the quarters are approximated within 3 days on either side of the true quarter event.
I suppose this has a useful purpose, and based on this, there's probably something that can be done to make the output of these fields more useful like
- letting user define the "approximation" or "orb" amount,
- returning
Waxing
,Waning
,Crescent
andGibbous
strings for shape and direction, etc
In any case, I've done a little bit of this in my fork 0xStarcat@135ca2b
from ephemeris.
Closing this down because I think I've answered this sufficiently for myself
from ephemeris.
Related Issues (20)
- Compute separation angle of two objects (Sun, Moon) from location on Earth at time? HOT 2
- North and south moon nodes HOT 5
- Longitude speed HOT 1
- retrograde planets? HOT 2
- Stars data
- Best Practice for Importing/Exporting classes in Angular project
- How to find ascendant? HOT 2
- possible typo's in code.
- e.load() has to run 3 times for proper calculations to be made. HOT 2
- twilight
- Query on how to compute planetary angles HOT 2
- Converting to php
- Code for calculating "exact" sunrise/sunset
- Question
- Calculating Eclipses
- Here goes nothing... unconventional contact method, yes, but I REALLY want to discuss HD with you.
- Wrong values in years B.C. HOT 6
- Geocentric distance equal to -1?... HOT 6
- local Apparent Sidereal Time Incorrect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ephemeris.