Method GetPointsInRangeCost
GetPointsInRangeCost<TPoint>(IGrid<TPoint>, TPoint, Func<TPoint, IEnumerable<TPoint>>, Func<TPoint, bool>, Func<TPoint, TPoint, float>, float)
A generic function that returns the points in range based on a given start point, moveRange, and a function that returns the cost of moving between neighboring cells.
public static Dictionary<TPoint, float> GetPointsInRangeCost<TPoint>(IGrid<TPoint> grid, TPoint start, Func<TPoint, IEnumerable<TPoint>> getConnectedPoints, Func<TPoint, bool> isAccessible, Func<TPoint, TPoint, float> getCellMoveCost, float moveRange)Parameters
- gridIGrid<TPoint>
- The grid to use for the calculations 
- startTPoint
- The starting point for the range calculation 
- getConnectedPointsFunc<TPoint, IEnumerable<TPoint>>
- This function is used to get the connected Points to a point. 
- isAccessibleFunc<TPoint, bool>
- Whether the cell at the given point can be reached. 
- getCellMoveCostFunc<TPoint, TPoint, float>
- A function that returns the move cost given a cell 
- moveRangefloat
- The range from which to return cells 
Returns
- Dictionary<TPoint, float>
Type Parameters
- TPoint
Examples
Example usage:
var costs = Algorithms.GetPointsInRangeCost(
		grid,
		start,
		tile1, tile2 => DistanceBetween(tile1, tile2),
		5f);Remarks
note
Author: Justin Kivak
See 
GetPointsInRangeCost<TPoint>(IGrid<TPoint>, TPoint, Func<TPoint, IEnumerable<TPoint>>, Func<TPoint, bool>, Func<TPoint, TPoint, int>, int)
Gets all the points (and their costs) from a given point in a given range. This result is stored and returned in a dictionary.
public static Dictionary<TPoint, int> GetPointsInRangeCost<TPoint>(IGrid<TPoint> grid, TPoint start, Func<TPoint, IEnumerable<TPoint>> getConnectedPoints, Func<TPoint, bool> isAccessible, Func<TPoint, TPoint, int> getCellMoveCost, int moveRange)Parameters
- gridIGrid<TPoint>
- The grid used to make the calculations. 
- startTPoint
- Point where the calculations will start. 
- getConnectedPointsFunc<TPoint, IEnumerable<TPoint>>
- This function is used to get the connected points to a given point. 
- isAccessibleFunc<TPoint, bool>
- This function is used to know if a point is accessible within the grid. 
- getCellMoveCostFunc<TPoint, TPoint, int>
- This function is used to get the movement cost from moving to a cell. 
- moveRangeint
- Range of movement where make the calculations. 
Returns
- Dictionary<TPoint, int>
Type Parameters
- TPoint
- The type of the point used on the grid. 
Remarks
note
Author: Justin Kivak
See