public void PtsToMm_Coordinates_Null() { BallCoordinates expected = null; BallCoordinates actual = _testAsset.PtsToMm(expected); Assert.AreEqual(actual, expected); }
/// <summary> /// Decide on action to be taken for each rod /// </summary> /// <param name="currentCoordinates">Current ball coordinates and vector</param> /// <returns>List of actions per each rod</returns> public List <RodAction> Decide(BallCoordinates currentCoordinates) { if (!IsInitialized) { Initialize(); } if (currentCoordinates == null) { throw new ArgumentException(String.Format("[{0}] Coordinates received from vector calculation unit are null", MethodBase.GetCurrentMethod().Name)); } //Convert pts and pts/sec to mm and mm/sec currentCoordinates = _surveyor.PtsToMm(currentCoordinates); //Calculate Actual Possible Action Time DateTime timeOfAction = DateTime.Now + SystemDelays; //Calculate ball future coordinates BallCoordinates bfc = _predictor.FindBallFutureCoordinates(currentCoordinates, timeOfAction); List <RodAction> actions = new List <RodAction>(); foreach (IRod rod in _controlledRods) { //Calculate dynamic sectors rod.CalculateDynamicSector(currentCoordinates); //Draw dynamic sector, better to use on one rod at a time because together is chaos on the screen Marks.DrawSector(rod.RodType, rod.DynamicSector); //Calculate intersection point rod.CalculateSectorIntersection(bfc); //Decide on action RodAction action = _decisionTree.Decide(rod, bfc); actions.Add(action); //if (rod.RodType == eRod.GoalKeeper) Log.Common.Debug(action.Linear + ": " + action.DcCoordinate); } return(actions); }