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


C# Orbit.getEjectionAngleAtUT方法代码示例

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


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

示例1: timeOfEjectionAngle

        /// <summary>
        /// Find the point on the orbit that includes the initial time where the ejection angle is closest to the suplied one
        /// </summary>
        /// <param name="oObject">Orbit of the vessel/body</param>
        /// <param name="timeInitial">The UT you want to search around for the angle - will search 1/2 an orbit back and 1/2 forward</param>
        /// <param name="numDivisions">Higher thisnumber the more precise the answer - and the longer it will take</param>
        /// <param name="closestAngle">The output of the closest angle the method could find</param>
        /// <param name="targetAngle">The ejection angle we are looking for</param>
        /// <returns></returns>
        internal static double timeOfEjectionAngle(Orbit oObject, double timeInitial, double targetAngle, double numDivisions, out double closestAngle)
        {
            double timeStart = timeInitial - oObject.period/2;
            double periodtoscan = oObject.period;
            
            double closestAngleTime = timeStart;
            double closestAngleValue = Double.MaxValue;
            double minTime = timeStart;
            double maxTime = timeStart + periodtoscan;

            //work out iterations for precision - we only really need to within a second - so how many iterations do we actually need
            //Each iteration gets us 1/10th of the period to scan

            for (int iter = 0; iter < 8; iter++) {
                double dt = (maxTime - minTime) / numDivisions;
                for (int i = 0; i < numDivisions; i++) {
                    double t = minTime + i * dt;
                    double angle = oObject.getEjectionAngleAtUT(t);
                    if (Math.Abs(angle - targetAngle) < closestAngleValue) {
                        closestAngleValue = Math.Abs(angle - targetAngle);
                        closestAngleTime = t;
                    }
                }
                minTime = (closestAngleTime - dt).Clamp(timeStart, timeStart + periodtoscan);
                maxTime = (closestAngleTime + dt).Clamp(timeStart, timeStart + periodtoscan); 
            }

            closestAngle = closestAngleValue + targetAngle;
            return closestAngleTime;
        }
开发者ID:mercutiodesign,项目名称:TransferWindowPlanner,代码行数:39,代码来源:Utilities.cs


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