コード例 #1
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;
            }
        }
コード例 #2
0
        internal static void ConvertCartesianFrame(CartesianCoordinates cartesianCoordinates1, CartesianCoordinates cartesianCoordinates2)
        {
            try
            {
                cartesianCoordinates1.CheckCoordinates();
                cartesianCoordinates2.CheckSkeleton(ValidityDepth.CoordinateFrame);
                if (cartesianCoordinates2.Depth > cartesianCoordinates1.Depth)
                {
                    throw new ArgumentException();
                }
            }
            catch
            {
                throw new InvalidOperationException();
            }

            cartesianCoordinates2.IsValid = true;
            cartesianCoordinates2.Origin  = cartesianCoordinates1.Origin;

            //FIXME
            if (cartesianCoordinates1.CoordinateFrame != cartesianCoordinates2.CoordinateFrame)
            {
                throw new NotImplementedException();
            }
            else
            {
                cartesianCoordinates2.Position = cartesianCoordinates1.Position * 10;
                if (cartesianCoordinates2.Depth > CartesianDepth.Velocity)
                {
                    cartesianCoordinates2.Velocity = cartesianCoordinates1.Velocity * 10;
                }
            }
        }
コード例 #3
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);
            }
        }