Click or drag to resize

AlgorithmsIsConnectedTCell, TPoint Method (IGridTCell, TPoint, TPoint, TPoint, 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. Another way to put this is, this function returns true if there is a set that connects point1 to point2.

Namespace:  Gamelogic.Grids
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static bool IsConnected<TCell, TPoint>(
	IGrid<TCell, TPoint> grid,
	TPoint point1,
	TPoint point2,
	Func<TPoint, TPoint, bool> isNeighborsConnected
)
where TPoint : Object, IGridPoint<TPoint>

Parameters

grid
Type: Gamelogic.GridsIGridTCell, TPoint
The grid on which to do the check
point1
Type: TPoint
The first point to check.
point2
Type: TPoint
The second point to check.
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: Boolean
Returns true if the two points are in a connected set.
Examples
checks whether the two points are connected by color.
IsConnected(grid, p1, p2, (p, q) => grid[p].Color == grid[q].Color)
See Also