当前位置: 首页>>代码示例>>C#>>正文


C# CelestialBody.GetLongitude方法代码示例

本文整理汇总了C#中CelestialBody.GetLongitude方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.GetLongitude方法的具体用法?C# CelestialBody.GetLongitude怎么用?C# CelestialBody.GetLongitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CelestialBody的用法示例。


在下文中一共展示了CelestialBody.GetLongitude方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WorldPositionToGeoCoords

        public static Vector3d WorldPositionToGeoCoords(Vector3d worldPosition, CelestialBody body)
        {
            if(!body)
            {
                return Vector3d.zero;
            }

            double lat = body.GetLatitude(worldPosition);
            double longi = body.GetLongitude(worldPosition);
            double alt = body.GetAltitude(worldPosition);
            return new Vector3d(lat,longi,alt);
        }
开发者ID:BahamutoD,项目名称:VesselMover,代码行数:12,代码来源:VesselSpawn.cs

示例2: DMAnomalyObject

 public DMAnomalyObject(PQSCity City)
 {
     city = City;
     name = city.name;
     try
     {
         body = FlightGlobals.Bodies.FirstOrDefault(b => b.name == city.transform.parent.name);
     }
     catch (Exception e)
     {
         DMUtils.Logging("Something Went Wrong Here: {0}", e);
     }
     if (body != null)
     {
         worldLocation = city.transform.position;
         lat = clampLat(body.GetLatitude(worldLocation));
         lon = clampLon(body.GetLongitude(worldLocation));
     }
 }
开发者ID:kenjinsama,项目名称:Orbital-Science,代码行数:19,代码来源:DMAnomalyObject.cs

示例3: traceTrans

 public static string traceTrans(string prev, Transform tr, CelestialBody body = null)
 {
     string tmp;
     if (body != null)
     {
         tmp = prev + "." + tr.name + " - (" + body.GetLatitude(tr.position) + ", " + body.GetLongitude(tr.position) + ", " + body.GetAltitude(tr.position) + ")\n";
     }
     else
     {
         tmp = prev + "." + tr.name + " - (" + tr.position + ", " + tr.rotation + ")\n";
     }
     Component[] comps = tr.gameObject.GetComponents<Component>();
     foreach (Component comp in comps)
     {
         tmp += "\t" + comp.GetType().Name + " - " + comp.name + "\n";
     }
     for (int i = 0; i < tr.childCount; i++)
     {
         tmp += traceTrans(prev + "." + tr.name, tr.GetChild(i), body);
     }
     return tmp;
 }
开发者ID:nixnocent,项目名称:InfernalRobotics,代码行数:22,代码来源:Part.cs

示例4: PQSAltitude

 public static double PQSAltitude(Vector3d pos, CelestialBody body)
 {
     return (pos - body.position).magnitude - body.Radius - PQSSurfaceHeight(body.GetLatitude(pos), body.GetLongitude(pos), body);
 }
开发者ID:Majiir,项目名称:MuMechLib,代码行数:4,代码来源:ARUtils.cs

示例5: updateCoordinates

        private IEnumerator updateCoordinates(CelestialBody b)
        {
            yield return new WaitForSeconds(3);

            currentBodyAnomalies.Clear();

            if (anomalies.ContainsKey(b.name))
            {
                foreach (var anom in anomalies[b.name].Values)
                {
                    anom.WorldLocation = anom.City.transform.position;
                    anom.Lat = b.GetLatitude(anom.WorldLocation);
                    anom.Lon = b.GetLongitude(anom.WorldLocation);
                }

                currentBodyAnomalies = anomalies[b.name].Values.ToList();
            }
            else
                currentBodyAnomalies = new List<DMAnomalyObject>();
        }
开发者ID:kenjinsama,项目名称:Orbital-Science,代码行数:20,代码来源:DMAnomalyList.cs

示例6: GetMouseCoordinates

 public static Coordinates GetMouseCoordinates(CelestialBody body)
 {
     Ray mouseRay = PlanetariumCamera.Camera.ScreenPointToRay(Input.mousePosition);
     mouseRay.origin = ScaledSpace.ScaledToLocalSpace(mouseRay.origin);
     Vector3d relOrigin = mouseRay.origin - body.position;
     Vector3d relSurfacePosition;
     if (PQS.LineSphereIntersection(relOrigin, mouseRay.direction, body.Radius, out relSurfacePosition))
     {
         Vector3d surfacePoint = body.position + relSurfacePosition;
         return new Coordinates(body.GetLatitude(surfacePoint), MuUtils.ClampDegrees180(body.GetLongitude(surfacePoint)));
     }
     else
     {
         return null;
     }
 }
开发者ID:numerobis,项目名称:MechJeb2,代码行数:16,代码来源:GuiUtils.cs

示例7: GeneratePQSCityCoordinates

        private void GeneratePQSCityCoordinates(WaypointData wpData, CelestialBody body)
        {
            LoggingUtil.LogVerbose(this, "   pqs city: " + wpData.pqsCity);
            LoggingUtil.LogVerbose(this, "   Generating a waypoint based on PQS city " + wpData.pqsCity.name + "...");

            Vector3d position = wpData.pqsCity.transform.position;
            LoggingUtil.LogVerbose(this, "    pqs city position = " + position);

            // Translate by the PQS offset (inverse transform of coordinate system)
            Vector3d v = wpData.pqsOffset;
            Vector3d i = wpData.pqsCity.transform.right;
            Vector3d j = wpData.pqsCity.transform.forward;
            Vector3d k = wpData.pqsCity.transform.up;
            LoggingUtil.LogVerbose(this, "    i, j, k = " + i + ", " + j + "," + k);
            LoggingUtil.LogVerbose(this, "    pqs transform = " + wpData.pqsCity.transform);
            LoggingUtil.LogVerbose(this, "    parent transform = " + wpData.pqsCity.transform.parent);
            Vector3d offsetPos = new Vector3d(
                (j.y * k.z - j.z * k.y) * v.x + (i.z * k.y - i.y * k.z) * v.y + (i.y * j.z - i.z * j.y) * v.z,
                (j.z * k.x - j.x * k.z) * v.x + (i.x * k.z - i.z * k.x) * v.y + (i.z * j.x - i.x * j.z) * v.z,
                (j.x * k.y - j.y * k.x) * v.x + (i.y * k.x - i.x * k.y) * v.y + (i.x * j.y - i.y * j.x) * v.z
            );
            offsetPos *= (i.x * j.y * k.z) + (i.y * j.z * k.x) + (i.z * j.x * k.y) - (i.z * j.y * k.x) - (i.y * j.x * k.z) - (i.x * j.z * k.y);
            wpData.waypoint.latitude = body.GetLatitude(position + offsetPos);
            wpData.waypoint.longitude = body.GetLongitude(position + offsetPos);
            LoggingUtil.LogVerbose(this, "    resulting lat, lon = (" + wpData.waypoint.latitude + ", " + wpData.waypoint.longitude + ")");
        }
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:26,代码来源:WaypointGenerator.cs

示例8: GetGroundAltitude

        // relativePosition is in world frame, but relative to the body (i.e. inertial body space)
        // returns the altitude above sea level (can be negative for bodies without ocean)
        private double GetGroundAltitude(CelestialBody body, Vector3 relativePosition)
        {
            if (body.pqsController == null)
                return 0;

            double lat = body.GetLatitude(relativePosition + body.position) / 180.0 * Math.PI;
            double lon = body.GetLongitude(relativePosition + body.position) / 180.0 * Math.PI;
            Vector3d rad = new Vector3d(Math.Cos(lat) * Math.Cos(lon), Math.Sin(lat), Math.Cos(lat) * Math.Sin(lon));
            double elevation = body.pqsController.GetSurfaceHeight(rad) - body.Radius;
            if (body.ocean)
                elevation = Math.Max(elevation, 0.0);

            return elevation;
        }
开发者ID:CalebJ2,项目名称:KSPTrajectories,代码行数:16,代码来源:Trajectory.cs

示例9: GetMouseCoordinates

        public static Coordinates GetMouseCoordinates(CelestialBody body)
        {
            Ray mouseRay = PlanetariumCamera.Camera.ScreenPointToRay(Input.mousePosition);
            mouseRay.origin = ScaledSpace.ScaledToLocalSpace(mouseRay.origin);
            Vector3d relOrigin = mouseRay.origin - body.position;
            Vector3d relSurfacePosition;
            double curRadius = body.pqsController.radiusMax;
            double lastRadius = 0;
            double error = 0;
            int loops = 0;
            float st = Time.time;
            while (loops < 50)
            {
                if (PQS.LineSphereIntersection(relOrigin, mouseRay.direction, curRadius, out relSurfacePosition))
                {
                    Vector3d surfacePoint = body.position + relSurfacePosition;
                    double alt = body.pqsController.GetSurfaceHeight(QuaternionD.AngleAxis(body.GetLongitude(surfacePoint), Vector3d.down) * QuaternionD.AngleAxis(body.GetLatitude(surfacePoint), Vector3d.forward) * Vector3d.right);
                    error = Math.Abs(curRadius - alt);
                    if (error < (body.pqsController.radiusMax - body.pqsController.radiusMin) / 100)
                    {
                        return new Coordinates(body.GetLatitude(surfacePoint), MuUtils.ClampDegrees180(body.GetLongitude(surfacePoint)));
                    }
                    else
                    {
                        lastRadius = curRadius;
                        curRadius = alt;
                        loops++;
                    }
                }
                else
                {
                    if (loops == 0)
                    {
                        break;
                    }
                    else
                    { // Went too low, needs to try higher
                        curRadius = (lastRadius * 9 + curRadius) / 10;
                        loops++;
                    }
                }
            }

            return null;
        }
开发者ID:kext,项目名称:MechJeb2,代码行数:45,代码来源:GuiUtils.cs

示例10: WorldPositionToGeoCoords

        Vector3d WorldPositionToGeoCoords(Vector3d worldPosition, CelestialBody body)
        {
            if(!body)
            {
                Debug.LogWarning ("WorldPositionToGeoCoords body is null");
                return Vector3d.zero;
            }

            double lat = body.GetLatitude(worldPosition);
            double longi = body.GetLongitude(worldPosition);
            double alt = body.GetAltitude(worldPosition);
            return new Vector3d(lat,longi,alt);
        }
开发者ID:BahamutoD,项目名称:VesselMover,代码行数:13,代码来源:VesselMove.cs

示例11: Search

 static Coordinates Search(CelestialBody body, Ray mouseRay)
 {
     Vector3d relSurfacePosition;
     Vector3d relOrigin = mouseRay.origin - body.position;
     double curRadius = body.pqsController.radiusMax;
     double lastRadius = 0;
     double error = 0;
     int loops = 0;
     float st = Time.time;
     while(loops < 50)
     {
         if(PQS.LineSphereIntersection(relOrigin, mouseRay.direction, curRadius, out relSurfacePosition))
         {
             var alt = body.pqsController.GetSurfaceHeight(relSurfacePosition);
             if(body.ocean && alt < body.Radius) alt = body.Radius;
             error = Math.Abs(curRadius - alt);
             if(error < (body.pqsController.radiusMax - body.pqsController.radiusMin) / 100)
             {
                 var surfacePoint = body.position + relSurfacePosition;
                 return new Coordinates(body.GetLatitude(surfacePoint), body.GetLongitude(surfacePoint));
             }
             else
             {
                 lastRadius = curRadius;
                 curRadius = alt;
                 loops++;
             }
         }
         else
         {
             if(loops == 0) break;
             else
             { // Went too low, needs to try higher
                 curRadius = (lastRadius * 9 + curRadius) / 10;
                 loops++;
             }
         }
     }
     return null;
 }
开发者ID:Kerbas-ad-astra,项目名称:ThrottleControlledAvionics,代码行数:40,代码来源:Coordinates.cs


注:本文中的CelestialBody.GetLongitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。