private static void UpdateLocalTransferWindowMarker(ref bool show, ref MeshFilter meshFilterOrbit, double ejectionOrbitHeight, Orbit orbit, TransferWindow.Data transferWindow) { if (transferWindow.departure.type == CelestialBodyData.Type.Star || (transferWindow.transferType == TransferWindow.TransferType.ToNeighbour && transferWindow.departure != transferWindow.firstNeighbour)) { return; } if (transferWindow.transferType == TransferWindow.TransferType.ToNeighbour || transferWindow.transferType == TransferWindow.TransferType.ToParent) { CelestialBodyData celestialBodyData = (transferWindow.transferType != TransferWindow.TransferType.ToNeighbour) ? transferWindow.departure : transferWindow.firstNeighbour; double orbitHeightM = celestialBodyData.orbitData.orbitHeightM; double num = (transferWindow.transferType != TransferWindow.TransferType.ToNeighbour) ? (transferWindow.target.radius + transferWindow.target.atmosphereData.atmosphereHeightM) : transferWindow.secondNeighbour.orbitData.orbitHeightM; double num2 = Math.Min(num, orbitHeightM); double num3 = (orbitHeightM + num) * 0.5; double e = 1.0 - num2 / num3; double mass = celestialBodyData.parentBody.mass; double meanMotion = Kepler.GetMeanMotion(Kepler.GetPeriod(e, num3, mass), e, mass, num3); bool flag = num > orbitHeightM; double magnitude2d = Kepler.GetVelocity(num3, orbitHeightM, meanMotion, (!flag) ? 3.1415926535897931 : 0.0, (!flag) ? 3.1415926535897931 : 0.0, e, 0.0).magnitude2d; double escapeVelocity = magnitude2d - -celestialBodyData.orbitData.orbitalVelocity; float num4 = (float)(Kepler.GetEjectionAngle(escapeVelocity, ejectionOrbitHeight, celestialBodyData.mass, celestialBodyData.orbitData.SOI) * (double)Math.Sign(-orbit.meanMotion) + ((!flag) ? 3.1415926535897931 : 0.0)); float ejectionAngle = num4 + (float)(Ref.controller.globalTime * celestialBodyData.orbitData._meanMotion) - 1.57079637f; TransferWindow.GenerateMeshOrbitTW(ref meshFilterOrbit, ref show, ejectionAngle, orbit); return; } if (transferWindow.transferType != TransferWindow.TransferType.ToSatellite) { return; } if (ejectionOrbitHeight > transferWindow.target.orbitData.orbitHeightM * 0.75) { return; } float num5 = (float)Kepler.GetPhaseAngle(ejectionOrbitHeight, transferWindow.target.orbitData.orbitHeightM); float ejectionAngle2 = num5 + (float)(Ref.controller.globalTime * transferWindow.target.orbitData._meanMotion); TransferWindow.GenerateMeshOrbitTW(ref meshFilterOrbit, ref show, ejectionAngle2, orbit); }
private Data(TransferWindow.TransferType transferType, CelestialBodyData departure, CelestialBodyData target, CelestialBodyData firstNeighbour, CelestialBodyData secondNeighbour) { this.transferType = transferType; this.departure = departure; this.target = target; this.firstNeighbour = firstNeighbour; this.secondNeighbour = secondNeighbour; this.phaseAngle = double.NaN; this.phaseAngle = ((transferType != TransferWindow.TransferType.ToNeighbour) ? double.NaN : Kepler.GetPhaseAngle(firstNeighbour, secondNeighbour)); }
private void UpdatePhaseAngle() { this.transferWindow.phaseAngle = Kepler.GetPhaseAngle(this.transferWindow.firstNeighbour, this.transferWindow.secondNeighbour); this.GenerateTransferWindowMarker(this.transferWindow.markerMesh, 0.05f, -0.005f, (float)(this.transferWindow.firstNeighbour.orbitData.orbitHeightM / 10000.0), this.transferWindow.firstNeighbour.parentBody.mapRefs.holder); this.UpdateTranserWindowMarkerAlpha(this.transferWindowMaterial, this.transferWindow.firstNeighbour.orbitData.orbitHeightM * 0.5); }