예제 #1
0
 /// <summary>
 /// Update cell as occupied
 /// </summary>
 /// <param name="cell">The cell</param>
 public void UpdateSetOccupied(LogOddsCell cell)
 {
     if (cell.Value < 50.0f)
     {
         cell.Value += logOddsOccupied;
     }
 }
예제 #2
0
        public float GetObstacleThreshold()
        {
            LogOddsCell temp = new LogOddsCell();

            temp.Reset();
            return(gridFunctions.GetGridProbability(temp));
        }
예제 #3
0
        private void BresenhamCellFree(int offset)
        {
            LogOddsCell cell = GetCell(offset);

            if (cell.UpdateIndex < currMarkFreeIndex)
            {
                gridFunctions.UpdateSetFree(cell);
                cell.UpdateIndex = currMarkFreeIndex;
            }
        }
예제 #4
0
        /**
         * Get the probability value represented by the grid cell.
         * @param cell The cell.
         * @return The probability
         */
        public float GetGridProbability(LogOddsCell cell)
        {
            float odds = MathF.Exp(cell.Value);

            return(odds / (odds + 1.0f));

            /*
             * float val = cell.logOddsVal;
             *
             * //prevent #IND when doing exp(large number).
             * if (val > 50.0f) {
             * return 1.0f;
             * } else {
             * float odds = exp(val);
             * return odds / (odds + 1.0f);
             * }
             */
            //return 0.5f;
        }
예제 #5
0
 /// <summary>
 /// Update cell as not free
 /// </summary>
 /// <param name="cell">The cell</param>
 public void UpdateUnsetFree(LogOddsCell cell)
 {
     cell.Value -= logOddsFree;
 }
예제 #6
0
 /// <summary>
 /// Update cell as free
 /// </summary>
 /// <param name="cell">The cell</param>
 public void UpdateSetFree(LogOddsCell cell)
 {
     cell.Value += logOddsFree;
 }