Show / Hide Table of Contents

Class ReadOnlyAreaExtensions

Extension methods for IReadOnlyArea.

Inheritance
Object
ReadOnlyAreaExtensions
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.

Using AdjacencyRule.Cardinals, if "." and "x" are cells within the area and "#" are cells that are not within, X will NOT be considered a border:
# # # # # # # #
# . . . . . # #
# . . . . X . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# # # # # # # #
Using AdjacencyRule.EightWay, if "." and "x" are cells within the area and "#" are cells that are not within, X WILL be considered a border:
# # # # # # # #
# . . . . . # #
# . . . . X . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# # # # # # # #
In This Article
Back to top Generated by DocFX