Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solstice and Equinox #144

Closed
FloffyTheGreat opened this issue Jun 23, 2020 · 3 comments
Closed

Solstice and Equinox #144

FloffyTheGreat opened this issue Jun 23, 2020 · 3 comments

Comments

@FloffyTheGreat
Copy link

I would be great if CoordinateSharp could calculate Solstice and Equinox

@Tronald
Copy link
Owner

Tronald commented Jun 23, 2020

Thank you for the great suggestion.

After a bit of research, it would be best to use approximation algorithms (Meeus) to obtain equinox and solstice values. This would keep overhead small, but still give a comfortable accuracy level for most uses intended for the library. Approximation algorithms will eliminate the need to run iterations which would increase algorithm benchmarks by 3 times.

Approximation's largest error margin between 1950-2050 is about 51 seconds.

This will be approached using "Last/Next Solstice/Equinox" properties from the specified Celestial object.

Once benchmarks are determined an eager loading approach will be specified.

@Tronald
Copy link
Owner

Tronald commented Jun 28, 2020

Solar_Cycle eager loaded calculations remain under a 1 ms benchmark when solstice and equinox calculations are included. As performance cost is negligible, I am comfortable adding the values to the eager loaded solar cycle properties.

A slight change from the plan above: Instead of "Last/Next", the event values will be "Current" based on the provided year.

Example Usage:

Coordinate.CelestialInfo.Solstices.Summer or Celestial.Soltices.Summer

This will be available with the next release.

@Tronald
Copy link
Owner

Tronald commented Jul 13, 2020

This has been added to v2.7.1.1 (Released on 7/12/2020)

Coordinate c = new Coordinate(45,112, new DateTime(2020,3,6));
Console.WriteLine(c.CelestialInfo.Solstices.Summer);//20-Jun-2020 21:44 (UTC)
Console.WriteLine(c.CelestialInfo.Equinoxes.Spring);//20-Mar-2020 03:51 (UTC)

Eager loading extensions were also added last minute. Performance hits were negligible, but we wanted the option to turn the new feature off as lower powered processors may need to maximize performance where able. We didn't want to force users to take the hit. Values are eager loaded by default however.

To turn off calculations application wide.

//Set this in the application startup logic
 GlobalSettings.Default_EagerLoad.Extensions.Solstice_Equinox = false;

Note: Solstices and Equinoxes Properties will still be created with empty values when eager loading is off. This equates to an approximate 424 bytes in memory.

@Tronald Tronald closed this as completed Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants