Class ReadOnlyAreaExtensions
Extension methods for IReadOnlyArea.
Inherited Members
Namespace: SadRogue.Primitives
Assembly: TheSadRogue.Primitives.dll
Syntax
public static class ReadOnlyAreaExtensions
Methods
View SourceFastEnumerator(IReadOnlyArea)
Obsolete.
Declaration
[Obsolete("This method is obsolete; IReadOnlyArea implements GetEnumerator and provides equivalent behavior, so you should no longer call this function; instead just use your area in a foreach loop directly.")]
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 . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# # # # # # # #