 | AlgorithmsIsConnectedTCell, TPoint Method (IGridTCell, TPoint, IEnumerableTPoint, FuncTPoint, TPoint, Boolean) |
The set is connected if
the set of points are neighbor-connected, and isNeighborsConnected return true for each
two neighbors in the set.Two points are connected if they are neighbors, or one point has
a neighbor that is neighbor-connected with the other point.
Namespace:
Gamelogic.Grids
Assembly:
Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntaxpublic static bool IsConnected<TCell, TPoint>(
IGrid<TCell, TPoint> grid,
IEnumerable<TPoint> points,
Func<TPoint, TPoint, bool> isNeighborsConnected
)
where TPoint : Object, IGridPoint<TPoint>
Parameters
- grid
- Type: Gamelogic.GridsIGridTCell, TPoint
The grid on which to do the check - points
- Type: System.Collections.GenericIEnumerableTPoint
The set of points to check. It is assumed all points are in the grid. - isNeighborsConnected
- Type: SystemFuncTPoint, TPoint, Boolean
The function to use to check whether two neighbors are connected
Type Parameters
- TCell
- The type of cell of the grid that this algorithm takes.
- TPoint
- The type of point of the grid that this algorithm takes.
Return Value
Type:
BooleanReturns true if the collection of points are connected.
Examples
checks whether the list of points are connected by color.
IsConnected(grid, points, (p, q) => grid[p].Color == grid[q].Color)
See Also