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


C# Orbit.GetOrbitNormal方法代码示例

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


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

示例1: LambertSolver

        double tauP; //normalized parabolic transfer time

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ThrottleControlledAvionics.LambertSolver"/> class.
        /// </summary>
        /// <param name="orb">Starting orbit.</param>
        /// <param name="destination">Destination radius-vector.</param>
        /// <param name="UT">Starting UT.</param>
        public LambertSolver(Orbit orb, Vector3d destination, double UT)
        {
            orbit = orb;
            body = orbit.referenceBody;
            StartUT = UT;
            mu = body.gravParameter;

            r1 = orb.getRelativePositionAtUT(UT);
            var h  = Vector3d.Cross(r1, destination);
            if(h.sqrMagnitude < 0.01) h = orb.GetOrbitNormal();
            c  = destination-r1;

            cm  = c.magnitude;
            var r1m = r1.magnitude;
            var r2m = destination.magnitude;
            var rrm = r1m+r2m;
            m  = rrm+cm;
            n  = rrm-cm;
            m3 = m*m*m;

            var transfer_angle = Vector3d.Angle(r1, destination)*Mathf.Deg2Rad;
            if(h.z < 0) transfer_angle = Utils.TwoPI-transfer_angle;
            sigma = Math.Sqrt(n/m);
            if(transfer_angle > Math.PI) sigma = -sigma;
            sigma2 = sigma*sigma;
            sigma3 = sigma2*sigma;
            sigma5 = sigma2*sigma3;

            tauP = 2/3.0*(1-sigma3);
            tauME = Math.Acos(sigma)+sigma*Math.Sqrt(1-sigma2);
        }
开发者ID:Kerbas-ad-astra,项目名称:ThrottleControlledAvionics,代码行数:43,代码来源:LambertSolver.cs

示例2: CurrentPhaseAngle

 /// <summary>
 /// Calculates the current phase angle between <paramref name="origin"/> and <paramref name="destination"/>.
 /// </summary>
 /// <returns>The phase angle.</returns>
 /// <param name="origin">Origin.</param>
 /// <param name="destination">Destination.</param>
 public static double CurrentPhaseAngle(Orbit origin, Orbit destination)
 {
     Vector3d normal = origin.GetOrbitNormal().normalized;
     Vector3d projected = Vector3d.Exclude(normal, destination.pos);
     double result = Vector3d.Angle(origin.pos, projected);
     if (Vector3d.Dot(Vector3d.Cross(origin.pos, projected), normal) < 0) {
         return 360.0 - result;
     } else {
         return result;
     }
 }
开发者ID:RealGrep,项目名称:Protractor2,代码行数:17,代码来源:LambertSolver.cs

示例3: TimeToPlane

        //Computes the time required for the given launch location to rotate under the target orbital plane.
        //If the latitude is too high for the launch location to ever actually rotate under the target plane,
        //returns the time of closest approach to the target plane.
        //I have a wonderful proof of this formula which this comment is too short to contain.
        public static double TimeToPlane(double LANDifference, CelestialBody launchBody, double launchLatitude, double launchLongitude, Orbit target)
        {
            double inc = Math.Abs(Vector3d.Angle(-target.GetOrbitNormal().Reorder(132).normalized, launchBody.angularVelocity));
            Vector3d b = Vector3d.Exclude(launchBody.angularVelocity, -target.GetOrbitNormal().Reorder(132).normalized).normalized; // I don't understand the sign here, but this seems to work
            b *= launchBody.Radius * Math.Sin(Math.PI / 180 * launchLatitude) / Math.Tan(Math.PI / 180 * inc);
            Vector3d c = Vector3d.Cross(-target.GetOrbitNormal().Reorder(132).normalized, launchBody.angularVelocity).normalized;
            double cMagnitudeSquared = Math.Pow(launchBody.Radius * Math.Cos(Math.PI / 180 * launchLatitude), 2) - b.sqrMagnitude;
            if (cMagnitudeSquared < 0) cMagnitudeSquared = 0;
            c *= Math.Sqrt(cMagnitudeSquared);
            Vector3d a1 = b + c;
            Vector3d a2 = b - c;

            Vector3d longitudeVector = launchBody.GetSurfaceNVector(0, launchLongitude);

            double angle1 = Math.Abs(Vector3d.Angle(longitudeVector, a1));
            if (Vector3d.Dot(Vector3d.Cross(longitudeVector, a1), launchBody.angularVelocity) < 0) angle1 = 360 - angle1;
            double angle2 = Math.Abs(Vector3d.Angle(longitudeVector, a2));
            if (Vector3d.Dot(Vector3d.Cross(longitudeVector, a2), launchBody.angularVelocity) < 0) angle2 = 360 - angle2;

            double angle = Math.Min(angle1, angle2) - LANDifference;
            return (angle / 360) * launchBody.rotationPeriod;
        }
开发者ID:iterion,项目名称:MechJeb2,代码行数:26,代码来源:MechJebModuleAscentAutopilot.cs

示例4: TimeToPhaseAngle

        //Computes the time until the phase angle between the launchpad and the target equals the given angle.
        //The convention used is that phase angle is the angle measured starting at the target and going east until
        //you get to the launchpad.
        //The time returned will not be exactly accurate unless the target is in an exactly circular orbit. However,
        //the time returned will go to exactly zero when the desired phase angle is reached.
        public static double TimeToPhaseAngle(double phaseAngle, CelestialBody launchBody, double launchLongitude, Orbit target)
        {
            double launchpadAngularRate = 360 / launchBody.rotationPeriod;
            double targetAngularRate = 360.0 / target.period;
            if (Vector3d.Dot(-target.GetOrbitNormal().Reorder(132).normalized, launchBody.angularVelocity) < 0) targetAngularRate *= -1; //retrograde target

            Vector3d currentLaunchpadDirection = launchBody.GetSurfaceNVector(0, launchLongitude);
            Vector3d currentTargetDirection = target.SwappedRelativePositionAtUT(Planetarium.GetUniversalTime());
            currentTargetDirection = Vector3d.Exclude(launchBody.angularVelocity, currentTargetDirection);

            double currentPhaseAngle = Math.Abs(Vector3d.Angle(currentLaunchpadDirection, currentTargetDirection));
            if (Vector3d.Dot(Vector3d.Cross(currentTargetDirection, currentLaunchpadDirection), launchBody.angularVelocity) < 0)
            {
                currentPhaseAngle = 360 - currentPhaseAngle;
            }

            double phaseAngleRate = launchpadAngularRate - targetAngularRate;

            double phaseAngleDifference = MuUtils.ClampDegrees360(phaseAngle - currentPhaseAngle);

            if (phaseAngleRate < 0)
            {
                phaseAngleRate *= -1;
                phaseAngleDifference = 360 - phaseAngleDifference;
            }

            return phaseAngleDifference / phaseAngleRate;
        }
开发者ID:iterion,项目名称:MechJeb2,代码行数:33,代码来源:MechJebModuleAscentAutopilot.cs

示例5: GetRelativeInclination

 public static double GetRelativeInclination(this Orbit orbit, Orbit target)
 {
     return Vector3d.Angle(orbit.GetOrbitNormal(), target.GetOrbitNormal());
 }
开发者ID:d5039m,项目名称:KerbalEngineer,代码行数:4,代码来源:OrbitExtensions.cs

示例6: getRelativeInclination

 internal static double getRelativeInclination(this Orbit o, Orbit other)
 {
     Vector3d normal = o.GetOrbitNormal().xzy.normalized;
     Vector3d otherNormal = other.GetOrbitNormal().xzy.normalized;
     double angle = Vector3d.Angle(normal, otherNormal);
     bool south = Vector3d.Dot(Vector3d.Cross(normal, otherNormal), normal.xzy) > 0;
     return south ? -angle : angle;
 }
开发者ID:pellinor0,项目名称:ksp-precisenode,代码行数:8,代码来源:Extensions.cs

示例7: PhaseAngleCalc

        private Double PhaseAngleCalc(Orbit o1, Orbit o2, Double UT)
        {
            Vector3d n = o1.GetOrbitNormal();

            Vector3d p1 = o1.getRelativePositionAtUT(UT);
            Vector3d p2 = o2.getRelativePositionAtUT(UT);
            double phaseAngle = Vector3d.Angle(p1, p2);
            if (Vector3d.Angle(Quaternion.AngleAxis(90, Vector3d.forward) * p1, p2) > 90)
            {
                phaseAngle = 360 - phaseAngle;
            }

            if (o2.semiMajorAxis < o1.semiMajorAxis)
            {
                phaseAngle = phaseAngle - 360;
            }

            return LambertSolver.Deg2Rad * phaseAngle;
            //return LambertSolver.Deg2Rad * ((phaseAngle + 360) % 360);
        }
开发者ID:mercutiodesign,项目名称:TransferWindowPlanner,代码行数:20,代码来源:LambertSolverHelpers.cs

示例8: GetDescendingNode

 private Vector3d GetDescendingNode(Orbit targetOrbit, Orbit originOrbit)
 {
     return Vector3d.Cross(originOrbit.GetOrbitNormal(), targetOrbit.GetOrbitNormal());
 }
开发者ID:CYBUTEK,项目名称:KerbalEngineer,代码行数:4,代码来源:RendezvousProcessor.cs

示例9: TrueAnomaly

	private static double TrueAnomaly(Orbit orbit, Vector3d direction)
	{
		Vector3d periapsis = orbit.GetEccVector();
        double trueAnomaly = Vector3d.Angle(periapsis, direction) * Deg2Rad;
		if (Vector3d.Dot(Vector3d.Cross(periapsis, direction), orbit.GetOrbitNormal()) < 0) {
			trueAnomaly = TwoPi - trueAnomaly;
		}

		return trueAnomaly;
	}
开发者ID:mercutiodesign,项目名称:TransferWindowPlanner,代码行数:10,代码来源:LambertSolver.cs

示例10: TimeAtOpposition

	/// <summary>
	/// Calculates the earliest universal time after <paramref name="after"/> when <paramref name="destination"/> will be 180 degrees from the <paramref name="origin"/> position.
	/// </summary>
	/// <returns>The universal time when <paramref name="destination"/> will be in opposition to <paramref name="origin"/>.</returns>
	/// <param name="origin">Origin position.</param>
	/// <param name="destination">Destination orbit.</param>
	/// <param name="after">Universal time after which to find the opposition.</param>
	public static double TimeAtOpposition(Vector3d origin, Orbit destination, double after = 0)
	{
		Vector3d normal = destination.GetOrbitNormal().normalized;
		double trueAnomaly = TrueAnomaly(destination, Vector3d.Exclude(normal, -origin));
		double ut = Planetarium.GetUniversalTime() + destination.GetDTforTrueAnomaly(trueAnomaly, 0);
        if (ut <= after) {
            ut += destination.period * Math.Floor((after - ut) / destination.period + 1);
        }

		return ut;
	}
开发者ID:mercutiodesign,项目名称:TransferWindowPlanner,代码行数:18,代码来源:LambertSolver.cs

示例11: Print_Orbit_info


//.........这里部分代码省略.........
            //Output += "\n radius :"+ o.radius ;
            Output += "\n referenceBody :"+ o.referenceBody ;
            //Output += "\n sampleInterval :"+ o.sampleInterval ;
            Output += "\n secondaryPosAtTransition1 :"+ o.secondaryPosAtTransition1 ;
            Output += "\n secondaryPosAtTransition2 :"+ o.secondaryPosAtTransition2 ;
            //Output += "\n semiLatusRectum :"+ o.semiLatusRectum ;
            //Output += "\n semiMajorAxis :"+ o.semiMajorAxis ;
            //Output += "\n semiMinorAxis :"+ o.semiMinorAxis ;
            //Output += "\n SEVp :"+ o.SEVp ;
            //Output += "\n SEVs :"+ o.SEVs ;
            //Output += "\n StartUT :"+ o.StartUT ;
            Output += "\n timeToAp :"+ o.timeToAp ;
            Output += "\n timeToPe :"+ o.timeToPe ;
            Output += "\n timeToTransition1 :"+ o.timeToTransition1 ;
            Output += "\n timeToTransition2 :"+ o.timeToTransition2 ;
            //Output += "\n toE :"+ o.toE ;
            //Output += "\n toV :"+ o.toV ;
            //Output += "\n trueAnomaly :"+ o.trueAnomaly ;
            //Output += "\n UTappr :"+ o.UTappr ;
            //Output += "\n UTsoi :"+ o.UTsoi ;
            //Output += "\n V :"+ o.V ;
            //Output += "\n vel :"+ o.vel ;

            Debug.Log(Output);

            if (!o.activePatch) {
                return;
            }
            try{

                //Functions
                Output = "Orbit Functions: \n";
                Output += "\n PeA :"+ o.PeA ;
                Output += "\n PeR :"+ o.PeR ;
                Output += "\n GetANVector:"+ o.GetANVector() ;
                Output += "\n GetEccVector:"+ o.GetEccVector() ;
                Output += "\n GetFrameVel:"+ o.GetFrameVel() ;
                Output += "\n GetHashCode:"+ o.GetHashCode() ;
                Output += "\n GetOrbitNormal:"+ o.GetOrbitNormal() ;
                Output += "\n GetRelativeVel:"+ o.GetRelativeVel() ;
                Output += "\n GetType:"+ o.GetType() ;
                Output += "\n GetVel:"+ o.GetVel() ;
                Output += "\n GetWorldSpaceVel:"+ o.GetWorldSpaceVel() ;

                //Unused Funtion (Tests?)
                //			Output += "\n :"+ o.DrawOrbit;
                //			Output += "\n :"+ o.Equals ;
                //			Output += "\n :"+ o.GetDTforTrueAnomaly() ;
                //			Output += "\n :"+ o.GetEccentricAnomaly ;
                //			Output += "\n :"+ o.GetFrameVelAtUT ;
                //			Output += "\n :"+ o.GetMeanAnomaly ;
                //			Output += "\n :"+ o.getObTAtMeanAnomaly ;
                //			Output += "\n :"+ o.getObtAtUT ;
                //			Output += "\n :"+ o.getOrbitalSpeedAt ;
                //			Output += "\n :"+ o.getOrbitalSpeedAtDistance ;
                //			Output += "\n :"+ o.getOrbitalSpeedAtPos ;
                //			Output += "\n :"+ o.getOrbitalSpeedAtRelativePos ;
                //			Output += "\n :"+ o.getOrbitalVelocityAtObT ;
                //			Output += "\n :"+ o.getOrbitalVelocityAtUT ;
                //			Output += "\n :"+ o.GetPatchTrajectory ;
                //			Output += "\n :"+ o.getPositionAtT ;
                //			Output += "\n :"+ o.getPositionAtUT ;
                //			Output += "\n :"+ o.getPositionFromEccAnomaly ;
                //			Output += "\n :"+ o.getPositionFromMeanAnomaly ;
                //			Output += "\n :"+ o.getPositionFromTrueAnomaly ;
                //			Output += "\n :"+ o.getRelativePositionAtT ;
                //			Output += "\n :"+ o.getRelativePositionAtUT ;
                //			Output += "\n :"+ o.getRelativePositionFromEccAnomaly ;
                //			Output += "\n :"+ o.getRelativePositionFromMeanAnomaly ;
                //			Output += "\n :"+ o.getRelativePositionFromTrueAnomaly ;
                //			Output += "\n :"+ o.GetRotFrameVel ;
                //			Output += "\n :"+ o.getTrueAnomaly ;
                //			Output += "\n :"+ o.GetTrueAnomalyOfZupVector ;
                //			Output += "\n :"+ o.getTruePositionAtUT ;
                //			Output += "\n :"+ o.GetUTforTrueAnomaly ;
                //			Output += "\n :"+ o.Init() ;
                //			Output += "\n :"+ o.RadiusAtTrueAnomaly ;
                //			Output += "\n :"+ o.solveEccentricAnomaly ;
                //			Output += "\n :"+ o.TrueAnomalyAtRadius ;
                //			Output += "\n :"+ o.TrueAnomalyAtT ;
                //			Output += "\n :"+ o.TrueAnomalyAtUT;
                //			Output += "\n :"+ o.UpdateFromOrbitAtUT;
                //			Output += "\n :"+ o.UpdateFromStateVectors;
                //			Output += "\n :"+ o.UpdateFromUT;
            }
            catch(Exception ex) {
                Debug.Log("Could not orbit functions. Exception:" + ex);
                //no catch exception for now.
            }

            Debug.Log(Output);

            Debug.Log("Patch from o.nextPatch");
            Print_Orbit_info (o.nextPatch);

            Debug.Log("Patch from o.closestEncounterPatch");
            Print_Orbit_info (o.closestEncounterPatch);

            Output = "";
        }
开发者ID:ve2dmn,项目名称:AsteroidScanner,代码行数:101,代码来源:MyScanner.cs

示例12: getTargetDNUT

 /// <summary>
 /// Gets the UT for the descending node in reference to the target orbit.
 /// </summary>
 /// <returns>The UT for the descending node in reference to the target orbit.</returns>
 /// <param name="a">The orbit to find the UT on.</param>
 /// <param name="b">The target orbit.</param>
 public static double getTargetDNUT(Orbit a, Orbit b)
 {
     //TODO: Add safeguards for bad UTs, may need to be refactored to NodeManager
     Vector3d DNVector = Vector3d.Cross(a.GetOrbitNormal(), b.h).normalized;
     return a.GetUTforTrueAnomaly(a.GetTrueAnomalyOfZupVector(DNVector), 2);
 }
开发者ID:jbengtson,项目名称:ksp-precisenode,代码行数:12,代码来源:NodeTools.cs

示例13: GetAscendingNode

 private Vector3d GetAscendingNode(Orbit origin, Orbit target)
 {
     return Vector3d.Cross(target.GetOrbitNormal(), origin.GetOrbitNormal());
 }
开发者ID:jclapis,项目名称:Engineer,代码行数:4,代码来源:Rendezvous.cs

示例14: CalcRelativeInclination

 private double CalcRelativeInclination(Orbit origin, Orbit target)
 {
     return Vector3d.Angle(origin.GetOrbitNormal(), target.GetOrbitNormal());
 }
开发者ID:jclapis,项目名称:Engineer,代码行数:4,代码来源:Rendezvous.cs


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