public static double GetBeltAntiparticles(this CelestialBody body, CelestialBody homeworld, double altitude, double lat) { if (body.flightGlobalsIndex != 0 && altitude <= PluginHelper.getMaxAtmosphericAltitude(body)) { return(0); } BeltData beltdata; if (!BeltDataCache.TryGetValue(body.name, out beltdata)) { double relrp = body.Radius / homeworld.Radius; double relrt = body.rotationPeriod / homeworld.rotationPeriod; beltdata = new BeltData() { density = body.Mass / homeworld.Mass * relrp / relrt * 50, ampere = 1.5 * homeworld.Radius * relrp / sqrt2, }; BeltDataCache.Add(body.name, beltdata); } double beltparticles = beltdata.density * sqrt2divPi * Math.Pow(altitude, 2) * Math.Exp(-Math.Pow(altitude, 2) / (2 * Math.Pow(beltdata.ampere, 2))) / (Math.Pow(beltdata.ampere, 3)); if (KopernicusHelper.GetLuminocity(body) > 0) { beltparticles /= 1000; } if (body.atmosphere) { beltparticles *= body.atmosphereDepth / 70000; } else { beltparticles *= 0.01; } return(beltparticles * Math.Abs(Math.Cos(lat / 180 * Math.PI)) * body.specialMagneticFieldScaling()); }
public static double GetBeltAntiparticles(this CelestialBody body, CelestialBody homeworld, double altitude, double lat) { if (body.flightGlobalsIndex != 0 && altitude <= PluginHelper.getMaxAtmosphericAltitude(body)) { return(0); } BeltData beltdata; if (!BeltDataCache.TryGetValue(body.name, out beltdata)) { double mp = body.Mass; double rp = body.Radius; double rt = body.rotationPeriod; double relmp = mp / homeworld.Mass; double relrp = rp / homeworld.Radius; double relrt = rt / homeworld.rotationPeriod; double peakbelt = 1.5 * homeworld.Radius * relrp; beltdata = new BeltData() { density = relmp * relrp / relrt * 50, ampere = peakbelt / Math.Sqrt(2), strengthMult = MagneticFieldDefinitionsHandler.GetMagneticFieldDefinitionForBody(body.name).StrengthMult }; BeltDataCache.Add(body.name, beltdata); } double beltparticles = beltdata.strengthMult * beltdata.density * Math.Sqrt(2 / Math.PI) * Math.Pow(altitude, 2) * Math.Exp(-Math.Pow(altitude, 2) / (2 * Math.Pow(beltdata.ampere, 2))) / (Math.Pow(beltdata.ampere, 3)); if (body.flightGlobalsIndex == 0) { beltparticles = beltparticles / 1000; } return(beltparticles * Math.Abs(Math.Cos(lat / 180 * Math.PI)) * body.specialMagneticFieldScaling()); }