public OrbitTrace(SolarSystemObjects body, uint pointCount, double pathDuration) { this.body = body; this.pathDuration = pathDuration; coverageDuration = this.pathDuration * coverageWindowDurationFactor; this.pointCount = (uint) (pointCount * coverageWindowDurationFactor); }
public TourPlace(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { this.constellation = constellation; this.name = name; Classification = classification; this.camParams = camParams; Type = type; Target = target; }
public TourPlace(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { this.constellation = constellation; this.name = name; Classification = classification; this.camParams = camParams; Type = type; Target = target; }
private void MainWindow_Load(object sender, EventArgs e) { SolarSystemObjects solarSystemObjects = AstronomicalObjectConstructor.Instance.CreateSolarSystemObjects(); foreach (IPlanet aObject in solarSystemObjects) { this.drawers.Add(new PlanetDrawer(aObject, this.mainPanel.Height, this.mainPanel.Width, this.trackBar.Value)); this.mainPanel.Controls.Add(aObject.Picture); } }
public SolarSystemObjects CreateSolarSystemObjects() { Star star = this.CreateStar(); var starAdapter = new StarAdapter(star); IEnumerable <IPlanet> planets = this.CreatePlanets(); var solarSystemObjects = new SolarSystemObjects(); solarSystemObjects.Add(starAdapter); solarSystemObjects.AddRange(planets); return(solarSystemObjects); }
public CameraParameters(double lat, double lng, double zoom, double rotation, double angle, float opactity) { Lat = lat; Lng = lng; Zoom = zoom; Rotation = rotation; Angle = angle; RaDec = false; Opacity = opactity; ViewTarget = new Vector3d(0, 0, 0); Target = SolarSystemObjects.Custom; TargetReferenceFrame = ""; DomeAlt = 0; DomeAz = 0; }
public CameraParameters(double lat, double lng, double zoom, double rotation, double angle, float opactity) { Lat = lat; Lng = lng; Zoom = zoom; Rotation = rotation; Angle = angle; RaDec = false; Opacity = opactity; ViewTarget = new Vector3d(0, 0, 0); Target = SolarSystemObjects.Custom; TargetReferenceFrame = ""; DomeAlt = 0; DomeAz = 0; }
public void SetLocation(double lat, double lng, double zoom, double cameraRotate, double cameraAngle, int foregroundImageSetHash, int backgroundImageSetHash, float blendOpacity, bool runSetup, bool flush, SolarSystemObjects target, Vector3d targetPoint, int solarSystemScale, string targetReferenceFrame) { if (!Settings.MasterController) { bool resetViewmode = false; if (!imageStackVisible) { if (CurrentImageSet.GetHash() != backgroundImageSetHash && CurrentImageSet.ThumbnailUrl.GetHashCode32() != backgroundImageSetHash) { SetImageSetByHash(backgroundImageSetHash); resetViewmode = true; } if (StudyImageset == null || (StudyImageset.GetHash() != foregroundImageSetHash && StudyImageset.ThumbnailUrl.GetHashCode32() != foregroundImageSetHash)) { if (foregroundImageSetHash != 0) { SetStudyImagesetByHash(foregroundImageSetHash); } } } if (resetViewmode) { SetViewMode(); } TrackingFrame = targetReferenceFrame; TargetLat = ViewLat = lat; TargetLong = ViewLong = lng; ZoomFactor = TargetZoom = zoom; if (Space && Settings.Active.GalacticMode) { double[] gPoint = Coordinates.J2000toGalactic(viewCamera.RA * 15, viewCamera.Dec); targetAlt = alt = gPoint[1]; targetAz = az = gPoint[0]; } else if (Space && Settings.Active.LocalHorizonMode) { Coordinates currentAltAz = Coordinates.EquitorialToHorizon(Coordinates.FromRaDec(viewCamera.RA, viewCamera.Dec), SpaceTimeController.Location, SpaceTimeController.Now); targetAlt = alt = currentAltAz.Alt; targetAz = az = currentAltAz.Az; } this.CameraAngle = cameraAngle; this.CameraRotate = cameraRotate; this.StudyOpacity = blendOpacity; this.SolarSystemTrack = target; this.viewCamera.ViewTarget = targetPoint; if (Properties.Settings.Default.SolarSystemScale != solarSystemScale) { Properties.Settings.Default.SolarSystemScale = solarSystemScale; } TimeSpan ts = DateTime.Now.Subtract(lastMessage); lastMessage = DateTime.Now; } if (runSetup) { runUpdate(); } }
public void GotoTarget(Place place, bool noZoom, bool instant, bool trackObject) { if (place == null) { return; } if ((trackObject && SolarSystemMode)) { if ((place.Classification == Classification.SolarSystem && place.Type != ImageSetType.SolarSystem) || (place.Classification == Classification.Star) || (place.Classification == Classification.Galaxy) && place.Distance > 0) { SolarSystemObjects target = SolarSystemObjects.Undefined; if (place.Classification == Classification.Star || place.Classification == Classification.Galaxy) { target = SolarSystemObjects.Custom; } else { try { if (place.Target != SolarSystemObjects.Undefined) { target = place.Target; } else { target = (SolarSystemObjects)Planets.GetPlanetIDFromName(place.Name); } } catch { } } if (target != SolarSystemObjects.Undefined) { trackingObject = place; if (target == SolarSystemTrack && !(place.Classification == Classification.Star || place.Classification == Classification.Galaxy)) { GotoTarget3(place.CamParams, noZoom, instant); return; } double jumpTime = 4; if (target == SolarSystemObjects.Custom) { jumpTime = 17; } else { jumpTime += 13 * (101 - Settings.Active.SolarSystemScale) / 100; } if (instant) { jumpTime = 1; } //SolarSystemTrack = target; CameraParameters camTo = RenderContext.ViewCamera.Copy(); camTo.TargetReferenceFrame = ""; camTo.Target = target; double zoom = 10; if (target == SolarSystemObjects.Custom) { if (place.Classification == Classification.Galaxy) { zoom = 1404946007758; } else { zoom = 63239.6717 * 100; } // Star or something outside of SS Vector3d vect = Coordinates.RADecTo3dAu(place.RA, place.Dec, place.Distance); double ecliptic = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI; vect.RotateX(ecliptic); camTo.ViewTarget = Vector3d.Negate(camTo.ViewTarget); } else { camTo.ViewTarget = Planets.GetPlanet3dLocationJD(target, SpaceTimeController.GetJNowForFutureTime(jumpTime)); switch (target) { case SolarSystemObjects.Sun: zoom = .6; break; case SolarSystemObjects.Mercury: zoom = .0004; break; case SolarSystemObjects.Venus: zoom = .0004; break; case SolarSystemObjects.Mars: zoom = .0004; break; case SolarSystemObjects.Jupiter: zoom = .007; break; case SolarSystemObjects.Saturn: zoom = .007; break; case SolarSystemObjects.Uranus: zoom = .004; break; case SolarSystemObjects.Neptune: zoom = .004; break; case SolarSystemObjects.Pluto: zoom = .0004; break; case SolarSystemObjects.Moon: zoom = .0004; break; case SolarSystemObjects.Io: zoom = .0004; break; case SolarSystemObjects.Europa: zoom = .0004; break; case SolarSystemObjects.Ganymede: zoom = .0004; break; case SolarSystemObjects.Callisto: zoom = .0004; break; case SolarSystemObjects.Earth: zoom = .0004; break; case SolarSystemObjects.Custom: zoom = 10; break; default: break; } zoom = zoom * Settings.Active.SolarSystemScale; } CameraParameters fromParams = RenderContext.ViewCamera.Copy(); if (SolarSystemTrack == SolarSystemObjects.Custom && !string.IsNullOrEmpty(RenderContext.TrackingFrame)) { fromParams = RenderContext.CustomTrackingParams; RenderContext.TrackingFrame = ""; } camTo.Zoom = zoom; Vector3d toVector = camTo.ViewTarget; toVector.Subtract(fromParams.ViewTarget); //Vector3d toVector = camTo.ViewTarget; //toVector.Subtract(new Vector3d(cameraPosition)); if (place.Classification == Classification.Star) { toVector = Vector3d.Negate(toVector); } if (toVector.Length() != 0) { Vector2d raDec = toVector.ToRaDec(); if (target == SolarSystemObjects.Custom) { camTo.Lat = -raDec.Y; } else { camTo.Lat = raDec.Y; } camTo.Lng = raDec.X * 15 - 90; } else { camTo.Lat = RenderContext.ViewCamera.Lat; camTo.Lng = RenderContext.ViewCamera.Lng; } if (target != SolarSystemObjects.Custom) { // replace with planet surface camTo.ViewTarget = Planets.GetPlanetTargetPoint(target, camTo.Lat, camTo.Lng, SpaceTimeController.GetJNowForFutureTime(jumpTime)); } ViewMoverKenBurnsStyle solarMover = new ViewMoverKenBurnsStyle(fromParams, camTo, jumpTime, SpaceTimeController.Now, SpaceTimeController.GetTimeForFutureTime(jumpTime), InterpolationType.EaseInOut); solarMover.FastDirectionMove = true; Mover = solarMover; return; } } } tracking = false; trackingObject = null; CameraParameters camParams = place.CamParams.Copy(); // (gonzalo) backgroundimageset could be null... protect onself! if (RenderContext.BackgroundImageset != null && place.Type != RenderContext.BackgroundImageset.DataSetType) { RenderContext.TargetCamera = place.CamParams.Copy(); RenderContext.ViewCamera = RenderContext.TargetCamera.Copy(); RenderContext.BackgroundImageset = GetDefaultImageset(place.Type, BandPass.Visible); instant = true; } else if (SolarSystemMode && place.Target != SolarSystemTrack) { RenderContext.TargetCamera = place.CamParams.Copy(); RenderContext.ViewCamera = RenderContext.TargetCamera.Copy(); SolarSystemTrack = place.Target; instant = true; } if (place.Classification == Classification.Constellation) { camParams.Zoom = ZoomMax; GotoTargetFull(false, instant, camParams, null, null); } else { SolarSystemTrack = place.Target; GotoTargetFull(noZoom, instant, camParams, place.StudyImageset, place.BackgroundImageset); //if (place.Classification == Classification.SolarSystem) if (trackObject) { tracking = true; trackingObject = place; } } }
public static Vector3d GetPlanet3dLocation(SolarSystemObjects target) { try { if ((int)target < 21) { return planet3dLocations[(int)target]; } } catch { } return new Vector3d(0, 0, 0); }
public static Vector3d GetPlanetTargetPoint(SolarSystemObjects target, double lat, double lng, double jNow) { Vector3d temp; if (jNow == 0) { temp = (Vector3d)Planets.GetPlanet3dLocation(target); } else { temp = (Vector3d)Planets.GetPlanet3dLocationJD(target, jNow); } temp.Add((Vector3d)Coordinates.RADecTo3dAu((lng / 15) + 6, lat, Planets.GetPlanet3dSufaceAltitude(target))); return (Vector3d)temp; }
public static double GetPlanet3dSufaceAltitude(SolarSystemObjects target) { try { if ((int)target < 21) { return GetAdjustedPlanetRadius((int)target); } } catch { } return 0; }
public static Vector3d GetPlanet3dLocationJD(SolarSystemObjects target, double jNow) { try { Vector3d result = new Vector3d(); AstroRaDec centerRaDec = AstroCalc.GetPlanet(jNow, 0, 0, 0, -6378149); Vector3d center = (Vector3d)Coordinates.RADecTo3dAu(centerRaDec.RA, centerRaDec.Dec, centerRaDec.Distance); if (target == SolarSystemObjects.Earth) { result = Vector3d.Create(-center.X, -center.Y, -center.Z); } else { AstroRaDec planet = AstroCalc.GetPlanet(jNow, (EO)(int)target, 0, 0, -6378149); result = (Vector3d)Coordinates.RADecTo3dAu(planet.RA, planet.Dec, planet.Distance); result.Subtract(center); } result.RotateX(Coordinates.MeanObliquityOfEcliptic(jNow) * RC); if (Settings.Active.SolarSystemScale != 1) { switch (target) { case SolarSystemObjects.Moon: { Vector3d parent = (Vector3d)GetPlanet3dLocationJD(SolarSystemObjects.Earth, jNow); // Parent Centric result.Subtract(parent); result.Multiply(Settings.Active.SolarSystemScale / 2); result.Add(parent); } break; case SolarSystemObjects.Io: case SolarSystemObjects.Europa: case SolarSystemObjects.Ganymede: case SolarSystemObjects.Callisto: { Vector3d parent = (Vector3d)GetPlanet3dLocationJD(SolarSystemObjects.Jupiter, jNow); // Parent Centric result.Subtract(parent); result.Multiply(Settings.Active.SolarSystemScale); result.Add(parent); } break; default: break; } } return (Vector3d)result; } catch { return Vector3d.Create(0, 0, 0); } }
public static Vector3d GetPlanet3dLocation(SolarSystemObjects target) { try { if ((int)target < 21) { return (Vector3d)planet3dLocations[(int)target].Copy(); } } catch { } return Vector3d.Create(0, 0, 0); }
private static Vector3d SetupShadow(RenderContext11 renderContext, Vector3d centerPoint, float width, SolarSystemObjects shadowCaster, int shadowIndex) { var device = renderContext.Device; if (PlanetShadow == null) { PlanetShadow = Texture11.FromBitmap(device, Resources.planetShadow); } var invViewCam = renderContext.View; invViewCam.Invert(); var sun = planet3dLocations[0]; sun.Subtract(centerPoint); var moon = planet3dLocations[(int)shadowCaster]; moon.Subtract(centerPoint); var biasd = Matrix3d.Scaling(0.5, 0.5, 0.5) * Matrix3d.Translation(new Vector3d(0.5, 0.5, 0.5)); var mat = invViewCam * Matrix3d.LookAtLH(sun, moon, new Vector3d(0, 1, 0)) * Matrix3d.PerspectiveFovLH(width, 1, 0.001f, 200f) * biasd; renderContext.SetEclipseShadowMatrix(shadowIndex, mat.Matrix11); return centerPoint; }
public static Place CreateCameraParams(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { Place temp = new Place(); temp.constellation = constellation; temp.name = name; temp.Classification = classification; temp.camParams = camParams; temp.Type = type; temp.Target = target; return temp; }
public static void listenerThreadFunc() { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false); while (running) { GetClient(); IPEndPoint destinationEP = new IPEndPoint(IPAddress.Any, Settings.MasterController ? 8088 : 8087); while (running) { try { byte[] bytes = listener.Receive(ref destinationEP); if (bytes.Length > 2) { if (bytes[0] == 42 && bytes[1] == 42 && bytes[2] == 1 && !Settings.MasterController) { MemoryStream ms = new MemoryStream(bytes); BinaryReader br = new BinaryReader(ms); // Eat the three leading bytes br.ReadBytes(3); if (br.ReadInt32() == Earth3d.MainWindow.Config.ClusterID) { MasterAddress = destinationEP.Address.ToString(); lat = br.ReadDouble(); lng = br.ReadDouble(); zoom = br.ReadDouble(); cameraRotate = br.ReadDouble(); cameraAngle = br.ReadDouble(); foregroundImageSetHash = br.ReadInt32(); backgroundImageSetHash = br.ReadInt32(); blendOpacity = br.ReadSingle(); settingsData = br.ReadBytes(35); flush = br.ReadBoolean(); now = DateTime.FromBinary(br.ReadInt64()); altitude = br.ReadDouble(); loclat = br.ReadDouble(); loclng = br.ReadDouble(); solarSystemData = br.ReadBytes(13); target = (SolarSystemObjects)br.ReadInt32(); targetPoint.X = br.ReadDouble(); targetPoint.Y = br.ReadDouble(); targetPoint.Z = br.ReadDouble(); solarSystemScale = br.ReadInt32(); focusAltitude = br.ReadDouble(); timeRate = br.ReadDouble(); domeTilt = br.ReadSingle(); domeAngle = br.ReadSingle(); domeAlt = br.ReadSingle(); domeAz = br.ReadSingle(); tileThrottling = br.ReadInt32(); ColorVersionNumber = br.ReadInt32(); TrackingFrame = br.ReadString(); LayerManager.CurrentSlideID = br.ReadInt32(); LayerManager.SlideTweenPosition = br.ReadSingle(); Earth3d.masterSyncFrameNumber = br.ReadInt32(); Earth3d.Logging = br.ReadBoolean(); figuresFilter = br.ReadBytes(12); namesFilter = br.ReadBytes(12); bounderiesFilter = br.ReadBytes(12); artFilter = br.ReadBytes(12); int count = br.ReadByte(); for (int i = 0; i < count; i++) { bool enabled = br.ReadBoolean(); int id = br.ReadByte(); double alt = br.ReadSingle(); double az = br.ReadSingle(); System.Drawing.Color color = System.Drawing.Color.FromArgb(br.ReadInt32()); if (enabled) { Reticle.Set(id, alt, az, color); } else { Reticle.Hide(id, false); } } currnetSyncFrame++; //Check for restart if (LayerManager.CurrentSlideID > -1 && Earth3d.RestartedWithoutTour) { Earth3d.RestartedWithoutTour = false; Earth3d.MainWindow.SyncTourNeeded = true; } continue; } continue; } //Convert Byte to String string sBuffer = Encoding.ASCII.GetString(bytes); string[] values = sBuffer.Split(new char[] { ',' }); if (values.Length > 1 && values[0] == "CAL" && Earth3d.MainWindow.Config.ClusterID.ToString() == values[1] && !Earth3d.MainWindow.Config.Master) { TerraViewer.Callibration.CalibrationScreen.ParseCommandString(values); continue; } if (values.Length > 1 && values[0] == "SCREEN" && Earth3d.MainWindow.Config.ClusterID.ToString() == values[1] && !Earth3d.MainWindow.Config.Master) { double alt = Convert.ToSingle(values[2]); double az = Convert.ToSingle(values[3]); double scale = Convert.ToSingle(values[4]); string url = values[5]; if (!string.IsNullOrEmpty(url)) { url = "http://" + MasterAddress + url.Substring(url.IndexOf(":5050")); if (Earth3d.MainWindow.videoOverlay == null) { Earth3d.MainWindow.videoOverlay = new ImageSetHelper("video", url, ImageSetType.Sky, BandPass.Visible, ProjectionType.SkyImage, Math.Abs(url.GetHashCode32()), 0, 0, 256, scale / 1000, ".tif", false, "", az, alt, 0, false, "", false, false, 2, 960, 600, "", "", "", "", 0, ""); } bool dirty = false; if (Earth3d.MainWindow.videoOverlay.CenterX != az) { dirty = true; } if (Earth3d.MainWindow.videoOverlay.CenterY != alt) { dirty = true; } if (Earth3d.MainWindow.videoOverlay.BaseTileDegrees != scale / 1000) { dirty = true; } Earth3d.MainWindow.videoOverlay.CenterX = az; Earth3d.MainWindow.videoOverlay.CenterY = alt; Earth3d.MainWindow.videoOverlay.BaseTileDegrees = scale / 1000; Tile tile = TileCache.GetTile(0, 0, 0, Earth3d.MainWindow.videoOverlay, null); tile.ReadyToRender = false; tile.Volitile = true; tile.TextureReady = false; if (dirty) { TileCache.RemoveTile(tile); } } else { if (Earth3d.MainWindow.videoOverlay != null) { Tile tile = TileCache.GetTile(0, 0, 0, Earth3d.MainWindow.videoOverlay, null); tile.CleanUp(false); TileCache.RemoveTile(tile); } Earth3d.MainWindow.videoOverlay = null; } continue; } if (values.Length > 1 && values[0] == "CONFIG" && Earth3d.MainWindow.Config.ClusterID.ToString() == values[1]) { if (values.Length == 10) { if (Convert.ToInt32(values[2]) == Earth3d.MainWindow.Config.NodeID) { Earth3d.MainWindow.Config.Heading = Convert.ToSingle(values[3]); Earth3d.MainWindow.Config.Pitch = Convert.ToSingle(values[4]); Earth3d.MainWindow.Config.Roll = Convert.ToSingle(values[5]); Earth3d.MainWindow.Config.UpFov = Convert.ToSingle(values[6]); Earth3d.MainWindow.Config.DownFov = Convert.ToSingle(values[7]); Earth3d.MainWindow.Config.Aspect = Convert.ToSingle(values[8]); Properties.Settings.Default.DomeTilt = Convert.ToSingle(values[9]); Earth3d.MainWindow.Config.DomeTilt = Convert.ToSingle(values[9]); Earth3d.MainWindow.Config.MultiChannelDome1 = true; } } } if (values.Length > 1 && values[0] == "SYNCLAYERS" && Earth3d.MainWindow.Config.ClusterID.ToString() == values[1] && !Earth3d.MainWindow.Config.Master) { SyncLayers(); continue; } if (values.Length > 1 && values[0] == "SYNCTOUR" && Earth3d.MainWindow.Config.ClusterID.ToString() == values[1] && !Earth3d.MainWindow.Config.Master) { SyncTour(); continue; } if (values.Length == 27 && !Settings.MasterController) { if (values[0] == "SYNC" && Earth3d.MainWindow.Config.ClusterID.ToString() == values[1]) { MasterAddress = destinationEP.Address.ToString(); lat = Convert.ToDouble(values[2]); lng = Convert.ToDouble(values[3]); zoom = Convert.ToDouble(values[4]); cameraRotate = Convert.ToDouble(values[5]); cameraAngle = Convert.ToDouble(values[6]); foregroundImageSetHash = Convert.ToInt32(values[7]); backgroundImageSetHash = Convert.ToInt32(values[8]); blendOpacity = Convert.ToSingle(values[9]); settingsFlags = Convert.ToInt32(values[10]); flush = Convert.ToBoolean(values[11]); now = DateTime.Parse(values[12]); altitude = Convert.ToDouble(values[13]); loclat = Convert.ToDouble(values[14]); loclng = Convert.ToDouble(values[15]); solarSystemSettingsFlags = Convert.ToInt32(values[16]); target = (SolarSystemObjects)Convert.ToInt32(values[17]); targetPoint.X = Convert.ToDouble(values[18]); targetPoint.Y = Convert.ToDouble(values[19]); targetPoint.Z = Convert.ToDouble(values[20]); solarSystemScale = Convert.ToInt32(values[21]); focusAltitude = Convert.ToDouble(values[22]); timeRate = Convert.ToDouble(values[23]); domeTilt = Convert.ToDouble(values[24]); TrackingFrame = values[25]; ColorVersionNumber = int.Parse(values[26]); currnetSyncFrame++; sync.Set(); } } else if (values.Length == 3) { double leftRight = Convert.ToDouble(values[0]); double upDown = Convert.ToDouble(values[1]); double zoom = Convert.ToDouble(values[2]); Earth3d.MainWindow.MoveAndZoom(leftRight, upDown, zoom); } else if (values.Length == 4) { double leftRight = Convert.ToDouble(values[0]); double upDown = Convert.ToDouble(values[1]); double zoom = Convert.ToDouble(values[2]); string name = values[3]; Earth3d.MainWindow.MoveAndZoomRate(leftRight, upDown, zoom, ""); } else if (values.Length == 5) { Earth3d.MainWindow.Config.Heading = Convert.ToSingle(values[0]); Earth3d.MainWindow.Config.Pitch = Convert.ToSingle(values[1]); Earth3d.MainWindow.Config.Roll = Convert.ToSingle(values[2]); Earth3d.MainWindow.Config.UpFov = Convert.ToSingle(values[3]); Earth3d.MainWindow.Config.DownFov = Convert.ToSingle(values[4]); } else if (values.Length == 6) { if (Convert.ToInt32(values[5]) == Earth3d.MainWindow.Config.NodeID) { Earth3d.MainWindow.Config.Heading = Convert.ToSingle(values[0]); Earth3d.MainWindow.Config.Pitch = Convert.ToSingle(values[1]); Earth3d.MainWindow.Config.Roll = Convert.ToSingle(values[2]); Earth3d.MainWindow.Config.UpFov = Convert.ToSingle(values[3]); Earth3d.MainWindow.Config.DownFov = Convert.ToSingle(values[4]); } } else if (values.Length == 8) { double leftRight = Convert.ToDouble(values[0]); double upDown = Convert.ToDouble(values[1]); double zoom = Convert.ToDouble(values[2]); string name = values[3]; bool dome = Convert.ToBoolean(values[4]); double domeTilt = Convert.ToDouble(values[5]); double viewTilt = Convert.ToDouble(values[6]); string mode = values[7]; Earth3d.MainWindow.CameraAngle = viewTilt; if (Properties.Settings.Default.DomeView != dome) { Properties.Settings.Default.DomeView = dome; Settings.DomeView = false; } if (Properties.Settings.Default.DomeTilt != domeTilt) { Properties.Settings.Default.DomeTilt = domeTilt; } Earth3d.MainWindow.MoveAndZoomRate(leftRight, upDown, zoom, mode); if (!String.IsNullOrEmpty(name)) { Earth3d.MainWindow.SetBackgroundByName(name); } } else if ((values.Length == 15 ) && values[0] == "Kinect" && Earth3d.MainWindow.Config.ClusterID.ToString() == values[1]) { double leftRight = Convert.ToDouble(values[2]); double upDown = Convert.ToDouble(values[3]); double zoom = Convert.ToDouble(values[4]); string name = values[5]; bool dome = Convert.ToBoolean(values[6]); double domeTilt = Convert.ToDouble(values[7]); double viewTilt = Convert.ToDouble(values[8]); string mode = values[9]; Earth3d.MainWindow.CameraAngleTarget = viewTilt; if (Properties.Settings.Default.DomeView != dome) { Properties.Settings.Default.DomeView = dome; } if (Properties.Settings.Default.DomeTilt != domeTilt) { Properties.Settings.Default.DomeTilt = domeTilt; } Earth3d.MainWindow.MoveAndZoomRate(leftRight, upDown, zoom, mode); if (!String.IsNullOrEmpty(name)) { Earth3d.MainWindow.SetBackgroundByName(name); } int retId = int.Parse(values[10]); bool state = Boolean.Parse(values[11]); double alt = Convert.ToDouble(values[12]); double az = Convert.ToDouble(values[13]); System.Drawing.Color color = System.Drawing.Color.White; try { color = System.Drawing.Color.FromArgb(int.Parse(values[14])); } catch { } if (state) { Reticle.Set(retId, alt, az, color); } else { Reticle.Hide(retId, false); } } else if ((values.Length == 18) && values[0] == "Kinect" && Earth3d.MainWindow.Config.ClusterID.ToString() == values[1]) { double leftRight = Convert.ToDouble(values[2]); double upDown = Convert.ToDouble(values[3]); double zoom = Convert.ToDouble(values[4]); string name = values[5]; bool dome = Convert.ToBoolean(values[6]); double domeTilt = Convert.ToDouble(values[7]); double viewTilt = Convert.ToDouble(values[8]); string mode = values[9]; Earth3d.MainWindow.CameraAngleTarget = viewTilt; if (Properties.Settings.Default.DomeView != dome) { Properties.Settings.Default.DomeView = dome; } if (Properties.Settings.Default.DomeTilt != domeTilt) { Properties.Settings.Default.DomeTilt = domeTilt; } Earth3d.MainWindow.MoveAndZoomRate(leftRight, upDown, zoom, mode); if (!String.IsNullOrEmpty(name)) { Earth3d.MainWindow.SetBackgroundByName(name); } int retId = int.Parse(values[10]); bool state = Boolean.Parse(values[11]); double alt = Convert.ToDouble(values[12]); double az = Convert.ToDouble(values[13]); System.Drawing.Color color = System.Drawing.Color.White; try { color = System.Drawing.Color.FromArgb(int.Parse(values[14])); } catch { } if (state) { Reticle.Set(retId, alt, az, color); } else { Reticle.Hide(retId, false); } Earth3d.MainWindow.SetHeadPosition(new Vector3d(-double.Parse(values[15])*2, -double.Parse(values[16])*2, (double.Parse(values[17])-1.5))*6); } } } catch { if (Earth3d.Logging) { Earth3d.WriteLogMessage("NetControl: Exception on receive"); } if (!running) { return; } } } listener.Close(); listener = null; } }
public static Vector3d GetPlanet3dLocation(SolarSystemObjects target, double jNow) { // Directly calculate 3D position of all planets but Earth and Jupiter var id = (int)target; if ((id >= 1 && id <= 3) || (id >= 5 && id <= 8)) { return GetPlanetPositionDirect(target, jNow); } try { var result = new Vector3d(); var centerRaDec = AstroCalc.AstroCalc.GetPlanet(jNow, 0, 0, 0, -6378149); var center = Coordinates.RADecTo3d(centerRaDec.RA, centerRaDec.Dec, centerRaDec.Distance); if (target == SolarSystemObjects.Earth) { result = new Vector3d(-center.X, -center.Y, -center.Z); } else { var planet = AstroCalc.AstroCalc.GetPlanet(jNow, (int)target, 0, 0, -6378149); result = Coordinates.RADecTo3d(planet.RA, planet.Dec, planet.Distance); result.Subtract(center); } result.RotateX(Coordinates.MeanObliquityOfEcliptic(jNow) * RC); if (Settings.Active.SolarSystemScale != 1) { switch (target) { case SolarSystemObjects.Moon: { var parent = GetPlanet3dLocation(SolarSystemObjects.Earth, jNow); // Parent Centric result.Subtract(parent); result.Multiply(Settings.Active.SolarSystemScale / 2); result.Add(parent); } break; case SolarSystemObjects.Io: case SolarSystemObjects.Europa: case SolarSystemObjects.Ganymede: case SolarSystemObjects.Callisto: { var parent = GetPlanet3dLocation(SolarSystemObjects.Jupiter, jNow); // Parent Centric result.Subtract(parent); result.Multiply(Settings.Active.SolarSystemScale); result.Add(parent); } break; default: break; } } return result; } catch { return new Vector3d(0, 0, 0); } }
public static Place CreateCameraParams(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { Place temp = new Place(); temp.constellation = constellation; temp.name = name; temp.Classification = classification; temp.camParams = camParams; temp.Type = type; temp.Target = target; return(temp); }
// Get the position of a Solar System object using a 'direct' calculation that // avoids including an aberration correction. // // The returned position is in ecliptic coordinate system with the origin at the center // of the parent body (i.e. the Sun for planets, a planet for moons). The position of moons // is _not_ modified by the SolarSystemScale, making it possible to use function to // a calculate valid Keplerian elements. public static Vector3d GetPlanetPositionDirect(SolarSystemObjects id, double jd) { var L = 0.0; var B = 0.0; var R = 0.0; switch (id) { case SolarSystemObjects.Mercury: L = CAAMercury.EclipticLongitude(jd); B = CAAMercury.EclipticLatitude(jd); R = CAAMercury.RadiusVector(jd); break; case SolarSystemObjects.Venus: L = CAAVenus.EclipticLongitude(jd); B = CAAVenus.EclipticLatitude(jd); R = CAAVenus.RadiusVector(jd); break; case SolarSystemObjects.Earth: { //double x = HiResTimer.TickCount; L = CAAEarth.EclipticLongitude(jd); B = CAAEarth.EclipticLatitude(jd); R = CAAEarth.RadiusVector(jd); //x = (HiResTimer.TickCount - x) / HiResTimer.Frequency; //System.Console.WriteLine("Earth orbit time: " + x * 1000.0 + "ms"); } break; case SolarSystemObjects.Mars: L = CAAMars.EclipticLongitude(jd); B = CAAMars.EclipticLatitude(jd); R = CAAMars.RadiusVector(jd); break; case SolarSystemObjects.Jupiter: L = CAAJupiter.EclipticLongitude(jd); B = CAAJupiter.EclipticLatitude(jd); R = CAAJupiter.RadiusVector(jd); break; case SolarSystemObjects.Saturn: L = CAASaturn.EclipticLongitude(jd); B = CAASaturn.EclipticLatitude(jd); R = CAASaturn.RadiusVector(jd); break; case SolarSystemObjects.Uranus: L = CAAUranus.EclipticLongitude(jd); B = CAAUranus.EclipticLatitude(jd); R = CAAUranus.RadiusVector(jd); break; case SolarSystemObjects.Neptune: L = CAANeptune.EclipticLongitude(jd); B = CAANeptune.EclipticLatitude(jd); R = CAANeptune.RadiusVector(jd); break; case SolarSystemObjects.Pluto: L = CAAPluto.EclipticLongitude(jd); B = CAAPluto.EclipticLatitude(jd); R = CAAPluto.RadiusVector(jd); break; case SolarSystemObjects.Moon: L = CAAMoon.EclipticLongitude(jd); B = CAAMoon.EclipticLatitude(jd); R = CAAMoon.RadiusVector(jd)/149598000; break; case SolarSystemObjects.Io: { var galileanInfo = CAAGalileanMoons.Calculate(jd); var position = galileanInfo.Satellite1.EclipticRectangularCoordinates; return new Vector3d(position.X, position.Z, position.Y); } case SolarSystemObjects.Europa: { var galileanInfo = CAAGalileanMoons.Calculate(jd); var position = galileanInfo.Satellite2.EclipticRectangularCoordinates; return new Vector3d(position.X, position.Z, position.Y); } case SolarSystemObjects.Ganymede: { var galileanInfo = CAAGalileanMoons.Calculate(jd); var position = galileanInfo.Satellite3.EclipticRectangularCoordinates; return new Vector3d(position.X, position.Z, position.Y); } case SolarSystemObjects.Callisto: { var galileanInfo = CAAGalileanMoons.Calculate(jd); var position = galileanInfo.Satellite4.EclipticRectangularCoordinates; return new Vector3d(position.X, position.Z, position.Y); } } // Enabling this code transforms planet positions from the mean ecliptic/equinox of // date to the J2000 ecliptic. It is necessary because the VSOP87D series used // for planet positions is in the mean-of-date frame. The transformation is currently // disabled in order to better match planet positions calculated elsewhere in the code. //CAA2DCoordinate prec = CAAPrecession.PrecessEcliptic(L, B, jd, 2451545.0); //L = prec.X; //B = prec.Y; L = CAACoordinateTransformation.DegreesToRadians(L); B = CAACoordinateTransformation.DegreesToRadians(B); var eclPos = new Vector3d(Math.Cos(L) * Math.Cos(B), Math.Sin(L) * Math.Cos(B), Math.Sin(B)) * R; // Transform from the ecliptic of date to the J2000 ecliptic; this transformation should be deleted // once the precession is turned one. var eclipticOfDateRotation = (Coordinates.MeanObliquityOfEcliptic(jd) - Coordinates.MeanObliquityOfEcliptic(2451545.0)) * RC; eclPos.RotateX(eclipticOfDateRotation); return new Vector3d(eclPos.X, eclPos.Z, eclPos.Y); }