private double JupiterMoon_DistanceFromEarth(SkyContext c, int m) { double r = c.Get(Planet_DistanceFromEarth, Planet.JUPITER); double z = c.Get(JupiterMoon_Rectangular, m).Z; return(GalileanMoons.DistanceFromEarth(r, z)); }
private double JupiterMoonCentralMeridian(SkyContext c, int m) { // planetocentric rectangular coordinates of the moon CrdsRectangular r = c.Get(JupiterMoonRectangular, m); return(GalileanMoons.MoonCentralMeridian(r, m - 1)); }
private CrdsRectangular[,] JupiterMoonsPositions(SkyContext c) { CrdsHeliocentrical earth = c.Get(EarthHeliocentrial); CrdsHeliocentrical jupiter = c.Get(Heliocentrical, Planet.JUPITER); return(GalileanMoons.Positions(c.JulianDay, earth, jupiter)); }
private float JupiterMoon_Magnitude(SkyContext c, int m) { double r = c.Get(Planet_DistanceFromEarth, Planet.JUPITER); double R = c.Get(Planet_DistanceFromSun, Planet.JUPITER); double p = c.Get(Planet_Phase, Planet.JUPITER); return(GalileanMoons.Magnitude(r, R, p, m - 1)); }
private CrdsRectangular[,] JupiterMoons_Positions(SkyContext c) { CrdsHeliocentrical earth = c.Get(Earth_Heliocentrial); CrdsHeliocentrical jupiter = c.Get(Planet_Heliocentrical, Planet.JUPITER); double distance = jupiter.ToRectangular(earth).ToEcliptical().Distance; return(GalileanMoons.Positions(c.JulianDay, earth, jupiter)); }
private double JupiterMoon_Semidiameter(SkyContext c, int m) { // distance from Earth to Jupiter, in a.u. double r = c.Get(Planet_DistanceFromEarth, Planet.JUPITER); // planetocentric z-coordinate of moon double z = c.Get(JupiterMoon_Rectangular, m).Z; // visible moon semidiameter return(GalileanMoons.MoonSemidiameter(r, z, m - 1)); }
public void Magnitude() { var lines = ReadLinesFromResource("ADK.Tests.Data.GalileanMoonsMag.chk", Encoding.ASCII).ToArray(); foreach (string line in lines) { string[] testRecordSplitted = line.Split(';'); int moonIndex = int.Parse(testRecordSplitted[0].Trim(), CultureInfo.InvariantCulture); double mag = double.Parse(testRecordSplitted[1].Trim(), CultureInfo.InvariantCulture); double phase = double.Parse(testRecordSplitted[2].Trim(), CultureInfo.InvariantCulture) / 100; double r = double.Parse(testRecordSplitted[3].Trim(), CultureInfo.InvariantCulture); double delta = double.Parse(testRecordSplitted[4].Trim(), CultureInfo.InvariantCulture); double m = GalileanMoons.Magnitude(r, delta, phase, moonIndex); Assert.AreEqual(mag, m, 0.2); } }
public void Positions() { var earth = new CrdsHeliocentrical() { L = 164.39745364456394, B = -0.00010322443896298875, R = 0.9917003651870131 }; var jupiter = new CrdsHeliocentrical() { L = 312.39309804246045, B = -0.68464503476063021, R = 5.074939001057106 }; for (int i = 0; i < 30 * 24; i++) { var pos = GalileanMoons.Positions(2459278.25976003, earth, jupiter); } }
private double JupiterMoon_CentralMeridian(SkyContext c, int m) { CrdsRectangular r = c.Get(JupiterMoon_Rectangular, m); return(GalileanMoons.MoonCentralMeridian(r)); }
private void RenderJupiterMoonShadow(IMapContext map, SizeableCelestialObject eclipsedBody, CrdsRectangular rect = null) { if (rect == null) { rect = new CrdsRectangular(); } // collect moons than can produce a shadow var ecliptingMoons = planetsCalc.JupiterMoons.Where(m => m.RectangularS.Z < rect.Z); if (ecliptingMoons.Any()) { Planet jupiter = planetsCalc.Planets.ElementAt(Planet.JUPITER - 1); float rotation = map.GetRotationTowardsNorth(jupiter.Equatorial) + 360 - (float)jupiter.Appearance.P; // Jupiter radius, in pixels float sd = map.GetDiskSize(jupiter.Semidiameter) / 2; // Center of eclipsed body PointF pBody = map.Project(eclipsedBody.Horizontal); // elipsed body size, in pixels float szB = map.GetDiskSize(eclipsedBody.Semidiameter); foreach (var moon in ecliptingMoons) { // umbra and penumbra radii, in acrseconds var shadow = GalileanMoons.Shadow(jupiter.Ecliptical.Distance, jupiter.DistanceFromSun, moon.Number - 1, moon.RectangularS, rect); // umbra and penumbra size, in pixels float szU = map.GetDiskSize(shadow.Umbra); float szP = map.GetDiskSize(shadow.Penumbra); // coordinates of shadow relative to eclipsed body CrdsRectangular shadowRelative = moon.RectangularS - rect; // Center of shadow PointF p = new PointF((float)shadowRelative.X * sd, -(float)shadowRelative.Y * sd); map.Graphics.TranslateTransform(pBody.X, pBody.Y); map.Graphics.RotateTransform(rotation); // shadow has enough size to be rendered if ((int)szP > 0) { var gpB = new GraphicsPath(); var gpP = new GraphicsPath(); var gpU = new GraphicsPath(); gpU.AddEllipse(p.X - szU / 2, p.Y - szU / 2, szU, szU); gpP.AddEllipse(p.X - szP / 2, p.Y - szP / 2, szP, szP); gpB.AddEllipse(-szB / 2 - 0.5f, -szB / 2 - 0.5f, szB + 1, szB + 1); var regionP = new Region(gpP); regionP.Intersect(gpB); if (!regionP.IsEmpty(map.Graphics)) { float f1 = 1 - (szU + szP) / 2 / szP; float f2 = 1 - szU / szP; var brushP = new PathGradientBrush(gpP); brushP.CenterPoint = p; brushP.CenterColor = clrJupiterMoonShadowLight; brushP.InterpolationColors = new ColorBlend() { Colors = new[] { Color.Transparent, clrJupiterMoonShadowDark, clrJupiterMoonShadowLight, clrJupiterMoonShadowLight }, Positions = new float[] { 0, f1, f2, 1 } }; var regionU = new Region(gpU); regionU.Intersect(gpB); var brushU = new SolidBrush(clrJupiterMoonShadowLight); map.Graphics.FillRegion(brushP, regionP); map.Graphics.FillRegion(brushU, regionU); // outline circles if (settings.Get <bool>("JupiterMoonsShadowOutline") && szP > 20) { map.Graphics.DrawEllipse(penShadowOutline, p.X - (szP + szU) / 4, p.Y - (szP + szU) / 4, (szP + szU) / 2, (szP + szU) / 2); map.Graphics.DrawEllipse(penShadowOutline, p.X - szU / 2, p.Y - szU / 2, szU, szU); PointF[] points = new PointF[] { new PointF(p.X, p.Y) }; map.Graphics.TransformPoints(CoordinateSpace.Page, CoordinateSpace.World, points); map.Graphics.ResetTransform(); map.DrawObjectCaption(fontShadowLabel, brushShadowLabel, moon.ShadowName, points[0], szP); } } } map.Graphics.ResetTransform(); } } }