本文整理汇总了C#中CelestialBody.GetLatitude方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.GetLatitude方法的具体用法?C# CelestialBody.GetLatitude怎么用?C# CelestialBody.GetLatitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CelestialBody
的用法示例。
在下文中一共展示了CelestialBody.GetLatitude方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPressure
public static double GetPressure(Vector3 position, CelestialBody body)
{
double latitude = body.GetLatitude(position) / 180.0 * Math.PI;
double altitude = (position - body.position).magnitude - body.Radius;
return GetPressure(altitude, latitude, body);
}
示例2: 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);
}
示例3: 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));
}
}
示例4: 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;
}
示例5: PQSAltitude
public static double PQSAltitude(Vector3d pos, CelestialBody body)
{
return (pos - body.position).magnitude - body.Radius - PQSSurfaceHeight(body.GetLatitude(pos), body.GetLongitude(pos), body);
}
示例6: 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>();
}
示例7: 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;
}
}
示例8: 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 + ")");
}
示例9: 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;
}
示例10: 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;
}
示例11: SimAeroForce
//*******************************************************
public static Vector3 SimAeroForce(List<Part> parts, CelestialBody body, Vector3 v_wrld_vel, Vector3 position)
{
double latitude = body.GetLatitude(position) / 180.0 * Math.PI;
double altitude = (position - body.position).magnitude - body.Radius;
return SimAeroForce(parts, body, v_wrld_vel, altitude, latitude);
}
示例12: 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);
}
示例13: 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;
}
示例14: getForces_StockAero
public Vector3d getForces_StockAero(CelestialBody body, Vector3d bodySpacePosition, Vector3d airVelocity, double angleOfAttack, double dt)
{
Vector3 position = body.position + bodySpacePosition;
double latitude = body.GetLatitude(position) / 180.0 * Math.PI;
double altitude = (position - body.position).magnitude - body.Radius;
if (altitude > body.atmosphereDepth)
{
return Vector3d.zero;
}
#if !USE_CACHE
return computeForces_StockAero(altitude, airVelocity, new Vector3(0, 1, 0), angleOfAttack, dt);
#else
//double approxMachNumber = useNEAR ? 0.0 : (double)FARAeroUtil_GetMachNumber.Invoke(null, new object[] { body_, body.maxAtmosphereAltitude * 0.5, new Vector3d((float)airVelocity.magnitude, 0, 0) });
//Util.PostSingleScreenMessage("machNum", "machNumber = " + actualMachNumber + " ; approx machNumber = " + approxMachNumber);
Vector2 force = getCachedForce(airVelocity.magnitude, altitude, angleOfAttack);
Vector3d forward = airVelocity.normalized;
Vector3d right = Vector3d.Cross(forward, bodySpacePosition).normalized;
Vector3d up = Vector3d.Cross(right, forward).normalized;
return forward * force.x + up * force.y;
#endif
}