Beispiel #1
0
        void InsertionCalcs()
        {
            OrbitDB targetOrbit = TargetEntity.Entity.GetDataBlob <OrbitDB>();

            (ECSLib.Vector3 position, DateTime eti)targetIntercept = InterceptCalcs.GetInterceptPosition(OrderingEntity.Entity, TargetEntity.Entity.GetDataBlob <OrbitDB>(), _departureDateTime);

            DateTime estArivalDateTime = targetIntercept.eti; //rough calc.

            /*
             * double x = (_radialDV * Math.Cos(_departureAngle)) - (_progradeDV * Math.Sin(_departureAngle));
             * double y = (_radialDV * Math.Sin(_departureAngle)) + (_progradeDV * Math.Cos(_departureAngle));
             */
            var    norm = Vectors.Vector2.Normalise(_departureOrbitalVelocity);
            double x    = norm.X * _radialDV;
            double y    = norm.Y * _progradeDV;

            _deltaV_MS = new ECSLib.Vector3(x, y, 0);

            var insertionVector2d = OrbitProcessor.GetOrbitalInsertionVector(_departureOrbitalVelocity, targetOrbit, estArivalDateTime);//_departureOrbitalVelocity - parentOrbitalVector;

            _insertionOrbitalVelocity = new ECSLib.Vector3(insertionVector2d.X, insertionVector2d.Y, 0);

            _insertionOrbitalVelocity += Distance.MToAU(_deltaV_MS);
            _insertionOrbitalSpeed     = _insertionOrbitalVelocity.Length();
            _insertionAngle            = Math.Atan2(_insertionOrbitalVelocity.Y, _insertionOrbitalVelocity.X);
            _moveWidget.SetArivalProgradeAngle(_insertionAngle);

            /*
             * var sgpCBAU = GameConstants.Science.GravitationalConstant * (_massCurrentBody + _massOrderingEntity) / 3.347928976e33;// (149597870700 * 149597870700 * 149597870700);
             * var ralPosCBAU = OrderingEntity.Entity.GetDataBlob<PositionDB>().RelativePosition_AU;
             * var smaCurrOrbtAU = OrderingEntity.Entity.GetDataBlob<OrbitDB>().SemiMajorAxis;
             * var velAU = OrbitProcessor.PreciseOrbitalVector(sgpCBAU, ralPosCBAU, smaCurrOrbtAU);
             */
        }