Ejemplo n.º 1
0
        public static bool CanTakePicture(this Satellite s, Coords c, TimeRange t, out int pictureTurn, int maxTurn)
        {
            pictureTurn = 0;

            if (s.CurrentTurn > t.End)
                return false;

            s = new Satellite(s); //clone
            if(s.CurrentTurn < t.Start)
            {
                s.Move(t.Start - s.CurrentTurn);
            }

            for (int turn = Math.Max(t.Start, s.CurrentTurn); turn < Math.Min(t.End, maxTurn); turn++)
            {
                if(c.IsInRange(s.Range, s.Pos))
                {
                    pictureTurn = turn;
                    return true;
                }
                s.Move(1);
            }

            return false;
        }
Ejemplo n.º 2
0
        public void SatelliteMove()
        {
            var satellite = new Satellite(176400, 7200, 120,0,0);

            satellite.Move(1);
            Assert.AreEqual(176520, satellite.CurrentRot.Lat);
        }
Ejemplo n.º 3
0
        public void SatelliteMoveIsCorrect(int nbTurn, int expectedLat, int expectedLon)
        {
            var satellite = new Satellite(176400, 7200, 120, 0, 0, 0);

            satellite.Move(nbTurn);

            Assert.AreEqual(expectedLat, satellite.Pos.Lat);
            Assert.AreEqual(expectedLon, satellite.Pos.Lon);
        }
Ejemplo n.º 4
0
        public void SatelliteMo(int nbTurn)
        {
            var satellite = new Satellite(176400, 7200, 120, 5, 50, 0);

            satellite.Move(nbTurn);

            Assert.AreEqual(0, satellite.CurrentRot.Lat);
            Assert.AreEqual(0, satellite.CurrentRot.Lon);

            Assert.AreEqual(10, satellite.Range.DeltaLatMax);
            Assert.AreEqual(-10, satellite.Range.DeltaLatMin);
            Assert.AreEqual(-10, satellite.Range.DeltaLonMin);
            Assert.AreEqual(10, satellite.Range.DeltaLonMax);
        }
Ejemplo n.º 5
0
 private static void Step(List<PartialSolution> ranges, Satellite sat)
 {
     foreach (var range in ranges)
     {
         range.CurrentRange.Increase(1, sat.RotSpeed, sat.MaxRot);
     }
     sat.Move(1);
 }