public static void InitializeConstellationNames() { if (ConstellationCentroids == null) { return; } NamesBatch = new Text3dBatch(80); foreach (string key in ConstellationCentroids.Keys) { IPlace centroid = ConstellationCentroids[key]; Vector3d center = Coordinates.RADecTo3dAu(centroid.RA, centroid.Dec, 1); Vector3d up = Vector3d.Create(0, 1, 0); string name = centroid.Name; if (centroid.Name == "Triangulum Australe") { name = name.Replace(" ", "\n "); } NamesBatch.Add(new Text3d(center, up, name, 80, .000125)); } }
private static void MakePrecessionChart() { double obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow); Matrix3d mat = Matrix3d.RotationX((obliquity / 360.0 * (Math.PI * 2))); Color col = Colors.White; if (precLineList == null) { precLineList = new SimpleLineList(); precLineList.DepthBuffered = false; for (double l = 0; l < 360; l++) { double b = 90 - obliquity; precLineList.AddLine(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu((l + 1) / 15, b, 1), mat)); } for (double l = -12000; l < 13000; l += 2000) { double b = 90 - obliquity; double p = -((l - 2000) / 25772 * 24) - 6; precLineList.AddLine(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(p, b - .5, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(p, b + .5, 1), mat)); } } if (PrecTextBatch == null) { PrecTextBatch = new Text3dBatch(50); int index = 0; for (double l = -12000; l < 13000; l += 2000) { double b = 90 - obliquity + 3; double p = -((l - 2000) / 25772 * 24) - 6; string text = l.ToString(); if (l == 0) { b = 90 - obliquity + 2; text = "1 CE"; } else if (l < 0) { text = " " + (Math.Abs(l).ToString()) + " BCE"; } else { text = (Math.Abs(l).ToString()) + " CE"; } if (text.Length == 9) { text = " " + text; } PrecTextBatch.Add(new Text3d(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(p, b, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(p + .01, b, 1), mat), text, 75, .00015)); } } return; }
private static void MakeAltAzGridText() { Color drawColor = Colors.White; int index = 0; if (AltAzTextBatch == null) { AltAzTextBatch = new Text3dBatch(30); for (double l = 0; l < 360; l += 10) { string text = " " + l.ToString(); if (l < 10) { text = " " + l.ToString(); } else if (l < 100) { text = " " + l.ToString(); } double lc = 360 - l; AltAzTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(lc / 15 - 6, .4, 1), Coordinates.RADecTo3dAu(lc / 15 - 6, .5, 1), text, 75, .00018)); } index = 0; for (double l = 0; l < 360; l += 90) { for (double b = -80; b <= 80; b += 10) { if (b == 0) { continue; } string text = b.ToString(); if (b > 0) { text = " +" + b.ToString(); AltAzTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(l / 15, b - .4, 1), Coordinates.RADecTo3dAu(l / 15, b - .3, 1), text, 75, .00018)); } else { text = " - " + text.Substr(1); AltAzTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(l / 15, b + .4, 1), Coordinates.RADecTo3dAu(l / 15, b + .5, 1), text, 75, .00018)); } index++; } } } return; }
private static void MakeEclipticGridText() { Color drawColor = Colors.White; double obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow); Matrix3d mat = Matrix3d.RotationX((float)(-obliquity / 360.0 * (Math.PI * 2))); if (EclipticTextBatch == null) { EclipticTextBatch = new Text3dBatch(30); for (double l = 0; l < 360; l += 10) { string text = " " + l.ToString(); if (l < 10) { text = " " + l.ToString(); } else if (l < 100) { text = " " + l.ToString(); } EclipticTextBatch.Add(new Text3d(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, .4, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, .5, 1), mat), text, 75, .00018)); } for (double l = 0; l < 360; l += 90) { for (double b = -80; b <= 80; b += 10) { if (b == 0) { continue; } string text = b.ToString(); if (b > 0) { text = " +" + b.ToString(); EclipticTextBatch.Add(new Text3d(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b - .4, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b - .3, 1), mat), text, 75, .00018)); } else { text = " - " + text.Substr(1); EclipticTextBatch.Add(new Text3d(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b + .4, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b + .5, 1), mat), text, 75, .00018)); } } } } return; }
private static void MakeEquitorialGridText() { if (EquTextBatch == null) { EquTextBatch = new Text3dBatch(30); int index = 0; for (int ra = 0; ra < 24; ra++) { string text = ra.ToString() + " hr"; if (ra < 10) { text = " " + ra.ToString() + " hr"; } EquTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(ra + 0.005, 0.4, 1), Coordinates.RADecTo3dAu(ra + 0.005, 0.5, 1), text, 45, .00018)); } index = 0; for (double ra = 0; ra < 24; ra += 3) { for (double dec = -80; dec <= 80; dec += 10) { if (dec == 0) { continue; } string text = dec.ToString(); if (dec > 0) { text = " +" + dec.ToString(); EquTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(ra, dec - .4, 1), Coordinates.RADecTo3dAu(ra, dec - .3, 1), text, 45, .00018)); } else { text = " - " + text.Substr(1); EquTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(ra, dec + .4, 1), Coordinates.RADecTo3dAu(ra, dec + .5, 1), text, 45, .00018)); } index++; } } } }
private static void MakeGalacticGridText() { if (GalTextBatch == null) { GalTextBatch = new Text3dBatch(30); for (int l = 0; l < 360; l += 10) { string text = " " + l.ToString(); if (l < 10) { text = " " + l.ToString(); } else if (l < 100) { text = " " + l.ToString(); } GalTextBatch.Add(new Text3d(Coordinates.GalacticTo3dDouble(l, 0.4), Coordinates.GalacticTo3dDouble(l, 0.5), text, 75, .00018)); } for (double l = 0; l < 360; l += 90) { for (double b = -80; b <= 80; b += 10) { if (b == 0) { continue; } string text = b.ToString(); if (b > 0) { text = " +" + b.ToString(); GalTextBatch.Add(new Text3d(Coordinates.GalacticTo3dDouble(l, b - .4), Coordinates.GalacticTo3dDouble(l, b - .3), text, 75, .00018)); } else { text = " - " + text.Substr(1); GalTextBatch.Add(new Text3d(Coordinates.GalacticTo3dDouble(l, b + .4), Coordinates.GalacticTo3dDouble(l, b + .5), text, 75, .00018)); } } } } }
private static void MakeEclipticText() { int year = SpaceTimeController.Now.GetUTCFullYear(); if (EclipOvTextBatch == null) { EclipOvTextBatch = new Text3dBatch(80); EclipticTextYear = year; double obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow); Matrix3d mat = Matrix3d.RotationX((-obliquity / 360.0 * (Math.PI * 2))); double daysPerYear = 365.25; if (DT.IsLeap(year, true)) { monthDays[1] = 29; daysPerYear = 366; } else { monthDays[1] = 28; daysPerYear = 365; } int count = 2 * (int)daysPerYear; EclipticCount = (int)daysPerYear; double jYear = SpaceTimeController.UtcToJulian(new Date(year, 0, 1, 12, 0, 0)); int index = 0; double d = 0; for (int m = 0; m < 12; m++) { int daysThisMonth = (int)monthDays[m]; for (int i = 0; i < daysThisMonth; i++) { AstroRaDec sunRaDec = Planets.GetPlanetLocationJD("Sun", jYear); COR sunEcliptic = CT.Eq2Ec(sunRaDec.RA, sunRaDec.Dec, obliquity); d = sunEcliptic.X; double dd = d;// +180; if (i == Math.Floor(daysThisMonth / 2.0)) { Vector3d center = Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)), .025f, (Math.Sin((dd * Math.PI * 2.0) / 360))), mat); Vector3d up = Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)), .045f, (Math.Sin((dd * Math.PI * 2.0) / 360))), mat); up.Subtract(center); up.Normalize(); EclipOvTextBatch.Add(new Text3d(center, up, monthNames[m], 80, .000159375)); } index++; index++; jYear += 1; } d += monthDays[m]; } } }
private static void MakeGalacticGridText() { if (GalTextBatch == null) { GalTextBatch = new Text3dBatch(30); for (int l = 0; l < 360; l += 10) { string text = " " + l.ToString(); if (l < 10) { text = " " + l.ToString(); } else if (l < 100) { text = " " + l.ToString(); } GalTextBatch.Add(new Text3d(Coordinates.GalacticTo3dDouble(l, 0.4), Coordinates.GalacticTo3dDouble(l, 0.5), text, 80, .00006)); } for (double l = 0; l < 360; l += 90) { for (double b = -80; b <= 80; b += 10) { if (b == 0) { continue; } string text = b.ToString(); if (b > 0) { text = " +" + b.ToString(); GalTextBatch.Add(new Text3d(Coordinates.GalacticTo3dDouble(l, b - .4), Coordinates.GalacticTo3dDouble(l, b - .3), text, 80, .00006)); } else { text = " - " + text.Substr(1); GalTextBatch.Add(new Text3d(Coordinates.GalacticTo3dDouble(l, b + .4), Coordinates.GalacticTo3dDouble(l, b + .5), text, 80, .00006)); } } } } }
private static void MakePrecessionChart() { double obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow); Matrix3d mat = Matrix3d.RotationX((obliquity / 360.0 * (Math.PI * 2))); Color col = Colors.White; if (precLineList == null) { precLineList = new SimpleLineList(); precLineList.DepthBuffered = false; for (double l = 0; l < 360; l++) { double b = 90 - obliquity; precLineList.AddLine(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu((l + 1) / 15, b, 1), mat)); } for (double l = -12000; l < 13000; l += 2000) { double b = 90 - obliquity; double p = -((l - 2000) / 25772 * 24) - 6; precLineList.AddLine(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(p, b - .5, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(p, b + .5, 1), mat)); } } if (PrecTextBatch == null) { PrecTextBatch = new Text3dBatch(50); int index = 0; for (double l = -12000; l < 13000; l += 2000) { double b = 90 - obliquity + 3; double p = -((l - 2000) / 25772 * 24) - 6; string text = l.ToString(); if (l == 0) { b = 90 - obliquity + 2; text = "1 CE"; } else if (l < 0) { text = " " + (Math.Abs(l).ToString()) + " BCE"; } else { text = (Math.Abs(l).ToString()) + " CE"; } if (text.Length == 9) { text = " " + text; } PrecTextBatch.Add(new Text3d(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(p, b, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(p + .01, b, 1), mat), text, 80, .00009)); } } return; }
private static void MakeEquitorialGridText() { if (EquTextBatch == null) { EquTextBatch = new Text3dBatch(30); int index = 0; for (int ra = 0; ra < 24; ra++) { string text = ra.ToString() + " hr"; if (ra < 10) { text = " " + ra.ToString() + " hr"; } EquTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(ra + 0.005, 0.4, 1), Coordinates.RADecTo3dAu(ra + 0.005, 0.5, 1), text, 30, .00006)); } index = 0; for (double ra = 0; ra < 24; ra += 3) { for (double dec = -80; dec <= 80; dec += 10) { if (dec == 0) { continue; } string text = dec.ToString(); if (dec > 0) { text = " +" + dec.ToString(); EquTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(ra, dec - .4, 1), Coordinates.RADecTo3dAu(ra, dec - .3, 1), text, 30, .00006)); } else { text = " - " + text.Substr(1); EquTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(ra, dec + .4, 1), Coordinates.RADecTo3dAu(ra, dec + .5, 1), text, 30, .00006)); } index++; } } } }
private static void MakeEclipticText() { int year = SpaceTimeController.Now.GetUTCFullYear(); if (EclipOvTextBatch == null) { EclipOvTextBatch = new Text3dBatch(80); EclipticTextYear = year; double obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow); Matrix3d mat = Matrix3d.RotationX((-obliquity / 360.0 * (Math.PI * 2))); double daysPerYear = 365.25; if (DT.IsLeap(year,true)) { monthDays[1] = 29; daysPerYear = 366; } else { monthDays[1] = 28; daysPerYear = 365; } int count = 2 * (int)daysPerYear; EclipticCount = (int)daysPerYear; double jYear = SpaceTimeController.UtcToJulian(new Date(year, 0, 1, 12, 0, 0)); int index = 0; double d = 0; for (int m = 0; m < 12; m++) { int daysThisMonth = (int)monthDays[m]; for (int i = 0; i < daysThisMonth; i++) { AstroRaDec sunRaDec = Planets.GetPlanetLocationJD("Sun", jYear); COR sunEcliptic = CT.Eq2Ec(sunRaDec.RA, sunRaDec.Dec, obliquity); d = sunEcliptic.X; double dd = d;// +180; if (i == Math.Floor(daysThisMonth / 2.0)) { Vector3d center = Vector3d.TransformCoordinate( Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)), .025f, (Math.Sin((dd * Math.PI * 2.0) / 360))), mat); Vector3d up = Vector3d.TransformCoordinate( Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)), .045f, (Math.Sin((dd * Math.PI * 2.0) / 360))), mat); up.Subtract(center); up.Normalize(); EclipOvTextBatch.Add(new Text3d(center, up, monthNames[m], 80, .000159375)); } index++; index++; jYear += 1; } d += monthDays[m]; } } }
private static void MakeEclipticGridText() { Color drawColor = Colors.White; double obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow); Matrix3d mat = Matrix3d.RotationX((float)(-obliquity / 360.0 * (Math.PI * 2))); if (EclipticTextBatch == null) { EclipticTextBatch = new Text3dBatch(30); for (double l = 0; l < 360; l += 10) { string text = " " + l.ToString(); if (l < 10) { text = " " + l.ToString(); } else if (l < 100) { text = " " + l.ToString(); } EclipticTextBatch.Add(new Text3d(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, .4, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, .5, 1), mat), text, 80, .00006)); } for (double l = 0; l < 360; l += 90) { for (double b = -80; b <= 80; b += 10) { if (b == 0) { continue; } string text = b.ToString(); if (b > 0) { text = " +" + b.ToString(); EclipticTextBatch.Add(new Text3d(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b - .4, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b - .3, 1), mat), text, 80, .00006)); } else { text = " - " + text.Substr(1); EclipticTextBatch.Add(new Text3d(Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b + .4, 1), mat), Vector3d.TransformCoordinate(Coordinates.RADecTo3dAu(l / 15, b + .5, 1), mat), text, 80, .00006)); } } } } return; }
private static void MakeAltAzGridText() { Color drawColor = Colors.White; int index = 0; if (AltAzTextBatch == null) { AltAzTextBatch = new Text3dBatch(30); for (double l = 0; l < 360; l += 10) { string text = " " + l.ToString(); if (l < 10) { text = " " + l.ToString(); } else if (l < 100) { text = " " + l.ToString(); } double lc = 360 - l; AltAzTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(lc / 15 - 6, .4, 1), Coordinates.RADecTo3dAu(lc / 15 - 6, .5, 1), text, 80, .00006)); } index = 0; for (double l = 0; l < 360; l += 90) { for (double b = -80; b <= 80; b += 10) { if (b == 0) { continue; } string text = b.ToString(); if (b > 0) { text = " +" + b.ToString(); AltAzTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(l / 15, b - .4, 1), Coordinates.RADecTo3dAu(l / 15, b - .3, 1), text, 80, .00006)); } else { text = " - " + text.Substr(1); AltAzTextBatch.Add(new Text3d(Coordinates.RADecTo3dAu(l / 15, b + .4, 1), Coordinates.RADecTo3dAu(l / 15, b + .5, 1), text, 80, .00006)); } index++; } } } return; }