Пример #1
0
        public static DefaultState GetDefaultState(DateTime?epoch = null)
        {
            KeplerianCoordinates keplerianCoordinates = new KeplerianCoordinates
            {
                CoordinateFrame = Frame.EME2000,
                Origin          = Body.Sun,
                Depth           = KeplerianDepth.Exact,
            };
            Coordinates coordinates = new Coordinates
            {
                Body = Body.Sun,
                KeplerianCoordinates = keplerianCoordinates,
            };
            DefaultState defaultState = new DefaultState
            {
                CoordinateType = CoordinateType.Keplerian,
                Coordinates    = coordinates,
            };

            if (epoch == null)
            {
                return(defaultState); //FIXME throw exception
            }
            else
            {
                GetHelioCentricKeplerianElements(epoch.Value, keplerianCoordinates);
                defaultState.Epoch = epoch.Value;
                return(defaultState);
            }
        }
Пример #2
0
        public static DefaultState GetDefaultState(DateTime?epoch = null)
        {
            CartesianCoordinates cartesianCoordinates = new CartesianCoordinates
            {
                CoordinateFrame = Frame.EME2000,
                Origin          = Body.Earth,
            };
            Coordinates coordinates = new Coordinates
            {
                Body = Body.Earth,
                CartesianCoordinates = new List <CartesianCoordinates>
                {
                    cartesianCoordinates,
                },
            };
            DefaultState defaultState = new DefaultState
            {
                CoordinateType = CoordinateType.Cartesian,
                Coordinates    = coordinates,
            };

            if (epoch == null)
            {
                return(defaultState); //FIXME
            }
            else
            {
                defaultState.Epoch = epoch;
                DefaultState         earthDefaultState = Earth.GetDefaultState(epoch);
                CartesianCoordinates earthCartesian    = new CartesianCoordinates
                {
                    Depth = CartesianDepth.Velocity,
                };
                CoordinateTransformations.ConvertKeplerianToCartesian(earthDefaultState.Coordinates.KeplerianCoordinates, earthCartesian);
                earthCartesian.Negative();
                cartesianCoordinates        = earthCartesian;
                cartesianCoordinates.Origin = Body.Earth;
                defaultState.Coordinates.CartesianCoordinates = new List <CartesianCoordinates>
                {
                    cartesianCoordinates
                };
                return(defaultState);
            }
        }