calculateLongitude() 공개 정적인 메소드

public static calculateLongitude ( double value ) : double
value double
리턴 double
예제 #1
0
        protected override List <Value> values(Vessel vessel, GameEvent events)
        {
            List <Value> values = new List <Value> ();

            if (vessel == null)
            {
                values.Add(new Value("Landing Body", body));
            }
            else
            {
                values.Add(new Value("Landing Body", body, vessel.orbit.referenceBody.bodyName,
                                     vessel.orbit.referenceBody.bodyName.Equals(body) && (vessel.situation == Vessel.Situations.LANDED ||
                                                                                          (splashedValid ? vessel.situation == Vessel.Situations.SPLASHED : false))));
            }

            if (minLatitude != maxLatitude)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Latitude", String.Format(MathTools.MinMaxValue, minLatitude, maxLatitude)));
                }
                else
                {
                    values.Add(new Value("Latitude", String.Format(MathTools.MinMaxValue, minLatitude, maxLatitude),
                                         vessel.latitude, MathTools.inMinMax(minLatitude, maxLatitude, vessel.latitude)));
                }
            }

            if (minLongitude != maxLongitude)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Longitude", String.Format(MathTools.MinMaxValue, minLongitude, maxLongitude)));
                }
                else
                {
                    values.Add(new Value("Longitude", String.Format(MathTools.MinMaxValue, minLongitude, maxLongitude),
                                         MathTools.calculateLongitude(vessel.longitude),
                                         MathTools.inMinMax(minLongitude, maxLongitude, MathTools.calculateLongitude(vessel.longitude))));
                }
            }

            return(values);
        }
예제 #2
0
        protected override List <Value> values(Vessel vessel, GameEvent events)
        {
            List <Value> values = new List <Value>();

            if (vessel == null)
            {
                values.Add(new Value("Launch from", launchZone));
            }
            else
            {
                string currentZone = vessel.orbit.referenceBody.bodyName;

                // Only check the lat/long of the vessel location to update the currentZone when the body is Kerbin
                // and the goal specifies the launch pad or runway on Kerbin.
                if ((launchZone.Equals(LaunchPad) || launchZone.Equals(Runway)) && currentZone.Equals("Kerbin"))
                {
                    double currentLongitude = MathTools.calculateLongitude(vessel.longitude);
                    double currentLatitude  = vessel.latitude;

                    if (MathTools.inMinMax(runwayMinLongitude, runwayMaxLongitude, currentLongitude) &&
                        MathTools.inMinMax(runwayMinLatitude, runwayMaxLatitude, currentLatitude))
                    {
                        // Within runway parameters.
                        currentZone = Runway;
                    }
                    else if (MathTools.inMinMax(padMinLongitude, padMaxLongitude, currentLongitude) &&
                             MathTools.inMinMax(padMinLatitude, padMaxLatitude, currentLatitude))
                    {
                        // Within launch pad parameters.
                        currentZone = LaunchPad;
                    }
                }
                values.Add(new Value("Launch from", launchZone, currentZone, String.Equals(currentZone, launchZone)));

                // Check the speed to make sure that we are not moving. In most cases "<0.01" will donate a stationary object.
                // However, in some cases, that causes flickering of the text as it goes in and out of spec.
                double speed = MathTools.abs(vessel.horizontalSrfSpeed) + MathTools.abs(vessel.verticalSpeed);
                if (speed > 0.02)
                {
                    values.Add(new Value("Launch", "", "requires stationary position", false));
                }
            }
            return(values);
        }
예제 #3
0
        protected override List <Value> values(Vessel vessel, GameEvent events)
        {
            List <Value> values = new List <Value> ();

            if (eccentricity != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Eccentricity", String.Format(MathTools.Range, eccentricity, eccentricityPrecision)));
                }
                else
                {
                    values.Add(new Value("Eccentricity", String.Format(MathTools.Range, eccentricity, eccentricityPrecision),
                                         vessel.orbit.eccentricity, MathTools.inRange(eccentricity, eccentricityPrecision, vessel.orbit.eccentricity)));
                }
            }

            if (body != null)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Body", "" + body));
                }
                else
                {
                    values.Add(new Value("Body", "" + body, vessel.orbit.referenceBody.bodyName, vessel.orbit.referenceBody.bodyName.Equals(body)));
                }
            }

            if (minPeA != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("min. Periapsis", String.Format(MathTools.SingleDoubleValue, minPeA)));
                }
                else
                {
                    values.Add(new Value("min. Periapsis", String.Format(MathTools.SingleDoubleValue, minPeA),
                                         vessel.orbit.PeA, vessel.orbit.PeA >= minPeA));
                }
            }

            if (minApA != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("min. Apoapsis", String.Format(MathTools.SingleDoubleValue, minApA)));
                }
                else
                {
                    values.Add(new Value("min. Apoapsis", String.Format(MathTools.SingleDoubleValue, minApA),
                                         vessel.orbit.ApA, vessel.orbit.ApA >= minApA));
                }
            }

            if (maxPeA != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("max. Periapsis", String.Format(MathTools.SingleDoubleValue, maxPeA)));
                }
                else
                {
                    values.Add(new Value("max. Periapsis", String.Format(MathTools.SingleDoubleValue, maxPeA),
                                         vessel.orbit.PeA, vessel.orbit.PeA <= maxPeA));
                }
            }

            if (maxApA != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("max. Apoapsis", String.Format(MathTools.SingleDoubleValue, maxApA)));
                }
                else
                {
                    values.Add(new Value("max. Apoapsis", String.Format(MathTools.SingleDoubleValue, maxApA),
                                         vessel.orbit.ApA, vessel.orbit.ApA <= maxApA &&
                                         (vessel.orbit.ApA * maxApA > 0)));    //either both values are positive, or both are negative
                }
            }

            if (minInclination != maxInclination)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Inclination", String.Format(MathTools.MinMaxValue, minInclination, maxInclination)));
                }
                else
                {
                    values.Add(new Value("Inclination", String.Format(MathTools.MinMaxValue, minInclination, maxInclination),
                                         String.Format(MathTools.SingleDoubleValue, vessel.orbit.inclination),
                                         MathTools.inMinMax(minInclination, maxInclination, vessel.orbit.inclination)));
                }
            }

            if (minLan != maxLan)
            {
                if (vessel == null)
                {
                    values.Add(new Value("LAN", String.Format(MathTools.MinMaxValue, minLan, maxLan)));
                }
                else
                {
                    values.Add(new Value("LAN", String.Format(MathTools.MinMaxValue, minLan, maxLan),
                                         vessel.orbit.LAN, MathTools.inMinMax(minLan, maxLan, vessel.orbit.LAN)));
                }
            }

            if (minAltitude != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("min Altitude", String.Format(MathTools.SingleDoubleValue, minAltitude)));
                }
                else
                {
                    values.Add(new Value("min Altitude", String.Format(MathTools.SingleDoubleValue, minAltitude),
                                         vessel.orbit.altitude, vessel.orbit.altitude >= minAltitude));
                }
            }

            if (maxAltitude != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("max Altitude", String.Format(MathTools.SingleDoubleValue, maxAltitude)));
                }
                else
                {
                    values.Add(new Value("max Altitude", String.Format(MathTools.SingleDoubleValue, maxAltitude),
                                         vessel.orbit.altitude, vessel.orbit.altitude <= maxAltitude));
                }
            }

            if (minSpeedOverGround != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("min speed over ground", String.Format(MathTools.SingleDoubleValue, minSpeedOverGround)));
                }
                else
                {
                    values.Add(new Value("min speed over ground", String.Format(MathTools.SingleDoubleValue, minSpeedOverGround),
                                         vessel.horizontalSrfSpeed, vessel.horizontalSrfSpeed >= minSpeedOverGround));
                }
            }

            if (maxSpeedOverGround != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("max speed over ground", String.Format(MathTools.SingleDoubleValue, maxSpeedOverGround)));
                }
                else
                {
                    values.Add(new Value("max speed over ground", String.Format(MathTools.SingleDoubleValue, maxSpeedOverGround),
                                         vessel.horizontalSrfSpeed, vessel.horizontalSrfSpeed <= maxSpeedOverGround));
                }
            }

            if (maxEccentricity != minEccentricity)
            {
                // If both min < max, then max has not been set at all and ignore the max value
                if (minEccentricity < maxEccentricity)
                {
                    if (vessel == null)
                    {
                        values.Add(new Value("Eccentricity", String.Format(MathTools.HighPrecisionMinMaxValue, minEccentricity, maxEccentricity)));
                    }
                    else
                    {
                        values.Add(new Value("Eccentricity", String.Format(MathTools.HighPrecisionMinMaxValue, minEccentricity, maxEccentricity),
                                             vessel.orbit.eccentricity, MathTools.inMinMax(minEccentricity, maxEccentricity, vessel.orbit.eccentricity), true));
                    }
                }
                else
                {
                    if (vessel == null)
                    {
                        values.Add(new Value("min. Eccentricity", String.Format(MathTools.HighPrecisionDoubleValue, minEccentricity)));
                    }
                    else
                    {
                        values.Add(new Value("min. Eccentricity", String.Format(MathTools.HighPrecisionDoubleValue, minEccentricity),
                                             vessel.orbit.eccentricity, minEccentricity < vessel.orbit.eccentricity, true));
                    }
                }
            }

            if (minOrbitalPeriod < maxOrbitalPeriod)
            {
                if (vessel == null || Planetarium.fetch == null)
                {
                    values.Add(new Value("Orbital Period", String.Format(MathTools.MinMaxString,
                                                                         MathTools.formatTime(minOrbitalPeriod), MathTools.formatTime(maxOrbitalPeriod))));
                }
                else
                {
                    values.Add(new Value("Orbital Period", String.Format(MathTools.MinMaxString,
                                                                         MathTools.formatTime(minOrbitalPeriod), MathTools.formatTime(maxOrbitalPeriod)),
                                         MathTools.formatTime(vessel.orbit.period), MathTools.inMinMax(minOrbitalPeriod, maxOrbitalPeriod, vessel.orbit.period)));
                }
            }

            if (minVerticalSpeed != 0.0)   //both min and max Vertical Speed variables are tested in game.  Good Test.
            {
                if (vessel == null)
                {
                    values.Add(new Value("Min Vertical Speed", String.Format(MathTools.SingleDoubleValue, minVerticalSpeed)));
                }
                else
                {
                    values.Add(new Value("Min Vertical Speed", String.Format(MathTools.SingleDoubleValue, minVerticalSpeed),
                                         vessel.verticalSpeed, vessel.verticalSpeed >= minVerticalSpeed));
                }
            }

            if (maxVerticalSpeed != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Max Vertical Speed", String.Format(MathTools.SingleDoubleValue, maxVerticalSpeed)));
                }
                else
                {
                    values.Add(new Value("Max Vertical Speed", String.Format(MathTools.SingleDoubleValue, maxVerticalSpeed),
                                         vessel.verticalSpeed, vessel.verticalSpeed <= maxVerticalSpeed));
                }
            }

            if (minGForce != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Min G Force", String.Format(MathTools.SingleDoubleValue, minGForce)));
                }
                else
                {
                    values.Add(new Value("Min G Force", String.Format(MathTools.SingleDoubleValue, minGForce),
                                         vessel.geeForce, vessel.geeForce >= minGForce));
                }
            }

            if (maxGForce != 0.0)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Max G Force", String.Format(MathTools.SingleDoubleValue, maxGForce)));
                }
                else
                {
                    values.Add(new Value("Max G Force", String.Format(MathTools.SingleDoubleValue, maxGForce),
                                         vessel.geeForce, vessel.geeForce <= maxGForce));
                }
            }

            if (minLatitude != maxLatitude)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Latitude", String.Format(MathTools.MinMaxValue, minLatitude, maxLatitude)));
                }
                else
                {
                    values.Add(new Value("Latitude", String.Format(MathTools.MinMaxValue, minLatitude, maxLatitude),
                                         vessel.latitude, MathTools.inMinMax(minLatitude, maxLatitude, vessel.latitude)));
                }
            }

            if (minLongitude != maxLongitude)
            {
                if (vessel == null)
                {
                    values.Add(new Value("Longitude", String.Format(MathTools.MinMaxValue, minLongitude, maxLongitude)));
                }
                else
                {
                    values.Add(new Value("Longitude", String.Format(MathTools.MinMaxValue, minLongitude, maxLongitude),
                                         MathTools.calculateLongitude(vessel.longitude),
                                         MathTools.inMinMax(minLongitude, maxLongitude, MathTools.calculateLongitude(vessel.longitude))));
                }
            }

            return(values);
        }