Table of Contents

Method GetLongestConnectedLine

Namespace
Gamelogic.Grids2
Assembly
Gamelogic.Grids2.dll

GetLongestConnectedLine<TPoint>(IImplicitShape<TPoint>, TPoint, IEnumerable<IMap<TPoint, TPoint>>, Func<TPoint, TPoint, bool>)

Get the longest line of points connected to the given point

public static IEnumerable<TPoint> GetLongestConnectedLine<TPoint>(IImplicitShape<TPoint> grid, TPoint point, IEnumerable<IMap<TPoint, TPoint>> lineMaps, Func<TPoint, TPoint, bool> isNeighborsConnected)

Parameters

grid IImplicitShape<TPoint>

Grid in which the calculations are made.

point TPoint

Point where the calculations start.

lineMaps IEnumerable<IMap<TPoint, TPoint>>

List of maps that can generate lines iteratively.

isNeighborsConnected Func<TPoint, TPoint, bool>

A functions that returns true or false, depending on whether two points can be considered connected when they are neighbors.For example, if you want rays of points that refer to cells of the same color, you can pass in a functions that compares the DefaultColors of cells.

Returns

IEnumerable<TPoint>

Type Parameters

TPoint

The type of point of the grid that this algorithm takes.