Class ReadOnlyAreaExtensions
Extension methods for IReadOnlyArea.
Namespace: SadRogue.Primitives
Assembly: TheSadRogue.Primitives.dll
Syntax
public static class ReadOnlyAreaExtensions : Object
Methods
FastEnumerator(IReadOnlyArea)
Obsolete.
Declaration
public static ReadOnlyAreaPositionsEnumerator FastEnumerator(this IReadOnlyArea self)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyArea | self |
Returns
Type | Description |
---|---|
ReadOnlyAreaPositionsEnumerator |
PerimeterPositions(IReadOnlyArea, AdjacencyRule)
Returns all points that are on the border of the area, assuming the specified adjacency rule is used to determine adjacent cells for the sake of determining border.
Declaration
public static IEnumerable<Point> PerimeterPositions(this IReadOnlyArea area, AdjacencyRule rule)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyArea | area | |
AdjacencyRule | rule | The AdjacencyRule to use for determining adjacency to cells which are outside of the area. |
Returns
Type | Description |
---|---|
IEnumerable<Point> | An enumerable of every point which is on the outer edge of the area specified. |
Remarks
Typically, you will want to use AdjacencyRule.EightWay as the rule; however AdjacencyRule.Cardinals is faster if you don't want border cells adjacent to a wall ONLY diagonally to be considered border cells.
# # # # # # # #
# . . . . . # #
# . . . . X . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# # # # # # # #
# # # # # # # #
# . . . . . # #
# . . . . X . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# # # # # # # #