Show / Hide Table of Contents

Class ReadOnlyAreaExtensions

Extension methods for IReadOnlyArea.

Inheritance
object
ReadOnlyAreaExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadRogue.Primitives
Assembly: TheSadRogue.Primitives.dll
Syntax
public static class ReadOnlyAreaExtensions

Methods

View Source

FastEnumerator(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
View Source

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 . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# . . . . . . #
# # # # # # # #
  • View Source
In this article
Back to top Generated by DocFX