Example #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);
            }
        }
Example #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;
                }
            }
        }