Ejemplo n.º 1
0
        internal static void ConvertKeplerianToCartesian(KeplerianCoordinates keplerianCoordinates, CartesianCoordinates cartesianCoordinates)
        {
            try
            {
                if (keplerianCoordinates.Depth < KeplerianDepth.Exact)
                {
                    throw new ArgumentException();
                }
                keplerianCoordinates.CheckCoordinates();
            }
            catch
            {
                throw new InvalidOperationException();
            }

            //FIXME
            cartesianCoordinates.IsValid         = true;
            cartesianCoordinates.Origin          = keplerianCoordinates.Origin;
            cartesianCoordinates.CoordinateFrame = keplerianCoordinates.CoordinateFrame;

            cartesianCoordinates.Position = Vector <double> .Build.Random(3);

            if (cartesianCoordinates.Depth >= CartesianDepth.Velocity)
            {
                cartesianCoordinates.Velocity = Vector <double> .Build.Random(3);
            }
        }
Ejemplo n.º 2
0
        internal static void ConvertKeplerianFrame(KeplerianCoordinates keplerianCoordinates1, KeplerianCoordinates keplerianCoordinates2)
        {
            try
            {
                keplerianCoordinates1.CheckCoordinates();
                keplerianCoordinates2.CheckSkeleton(ValidityDepth.CoordinateFrame);
                if (keplerianCoordinates2.Depth > keplerianCoordinates1.Depth)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }
            catch
            {
                throw new InvalidOperationException();
            }

            keplerianCoordinates2.IsValid = true;
            keplerianCoordinates2.Origin  = keplerianCoordinates1.Origin;

            //FIXME
            if (keplerianCoordinates1.CoordinateFrame != keplerianCoordinates2.CoordinateFrame)
            {
                throw new NotImplementedException();
            }
            else
            {
                keplerianCoordinates2.SMA  = keplerianCoordinates1.SMA * 10;
                keplerianCoordinates2.Ecc  = keplerianCoordinates1.Ecc * 10;
                keplerianCoordinates2.Inc  = keplerianCoordinates1.Inc * 10;
                keplerianCoordinates2.RAAN = keplerianCoordinates1.RAAN * 10;
                if (keplerianCoordinates2.Depth > KeplerianDepth.PlaneOnly)
                {
                    keplerianCoordinates2.ArgPer   = keplerianCoordinates1.ArgPer * 10;
                    keplerianCoordinates2.TrueAnom = keplerianCoordinates1.TrueAnom * 10;
                }
            }
        }
Ejemplo n.º 3
0
        internal static void ConvertCartesianToKeplerian(CartesianCoordinates cartesianCoordinates, KeplerianCoordinates keplerianCoordinates)
        {
            //FIXME
            try
            {
                if (cartesianCoordinates.Depth < CartesianDepth.Velocity)
                {
                    throw new ArgumentException();
                }
                cartesianCoordinates.CheckCoordinates();
            }
            catch
            {
                throw new InvalidOperationException();
            }

            //FIXME
            keplerianCoordinates.Origin          = cartesianCoordinates.Origin;
            keplerianCoordinates.CoordinateFrame = cartesianCoordinates.CoordinateFrame;
            keplerianCoordinates.IsValid         = true;

            keplerianCoordinates.SMA  = 1D;
            keplerianCoordinates.Ecc  = 1D;
            keplerianCoordinates.Inc  = 1D;
            keplerianCoordinates.RAAN = 1D;

            if (keplerianCoordinates.Depth >= KeplerianDepth.PlaneOnly)
            {
                keplerianCoordinates.ArgPer   = 1D;
                keplerianCoordinates.TrueAnom = 1D;
            }
        }