# Namespace SadRogue.Primitives

### Classes

#### AdjacencyRule

Structure representing a method for determining which coordinates are adjacent to a given coordinate, and which directions those neighbors are in. Cannot be instantiated -- pre-made static instances are provided.

#### AdjacencyRule.Types

Enum representing AdjacencyRule types. Each AdjacencyRule instance has a Type field which contains the corresponding value from this enum. Useful for easy mapping of AdjacencyRule types to a primitive type (for cases like a switch statement).

#### Area

Represents an arbitrarily-shaped 2D area. Stores and provides access to a list of each unique position in the area.

#### BisectionResult

Structure representing the result of a rectangle bisection.

#### BoundedRectangle

This class defines a 2D rectangular area, whose area is automatically "locked" to being inside a rectangular bounding box as it is changed. A typical use might be keeping track of a camera's view area.

#### ChebyshevDistance

Represents chebyshev distance (equivalent to 8-way movement with no extra cost for diagonals).

#### Color

Describes a 32-bit packed color.

#### ColorExtensions

Contains set of operators that match ones defined by other packages for interoperability, so syntax may be uniform. Functionality is similar to the corresponding actual operators for Color.

#### Direction

Structure representing the concept of a "direction" on a grid, and "defines" the coordinate plane via the YIncreasesUpward flag. Interacts with Point to allow easy translation of positions in a direction, and contains numerous helper functions for retrieving directions in various orders, getting direction closest to a line, etc.

#### Direction.Types

Enum representing Direction types. Each Direction instance has a Type field which contains the corresponding value from this enum. Useful for easy mapping of Direction types to a primitive type (for cases like a switch statement).

#### Distance

Class representing methods of calculating distance on a grid. You cannot create instances of this class using a constructor -- instead this class contains static instances representing the various distance calculations.

#### Distance.Types

Enum representing Distance types. Each Distance instance has a Type field which contains the corresponding value from this enum. Useful for easy mapping of Distance types to a primitive type (for cases like a switch statement).

#### EuclideanDistance

Represents euclidean distance (equivalent to 8-way movement with ~1.41 movement cost for diagonals).

#### Gradient

Represents a gradient with multiple color stops.

#### GradientStop

A gradient stop. Defines a color and where it is located within the gradient.

#### ManhattanDistance

Represents manhattan distance (equivalent to 4-way, cardinal-only movement).

#### MathHelpers

Static class consisting of mathematical "helper" functions and constants that can be useful for performing operations on a 2D grid.

#### Palette

A palette of colors.

#### Point

A structure that represents a standard 2D point. Provides numerous functions and operators that enable common grid/position-related math and operations.

#### PointExtensions

Contains set of operators that match ones defined by other packages for interoperability, so syntax may be uniform. Functionality is similar to the corresponding actual operators for Point.

#### PolarCoordinate

A Polar Coordinate.

#### Radius

Structure representing different shapes that define the concept of a radius on a grid. You cannot create instances of this class using a constructor -- instead, this class contains static instances representing the various radius shapes.

#### Radius.Types

Enum representing Radius types. Each Radius instance has a Type field which contains the corresponding value from this enum. Useful for easy mapping of Radius types to a primitive type (for cases like a switch statement).

#### RadiusLocationContext

A context representing information necessary to get all the positions in a radius via functions like PositionsInRadius(RadiusLocationContext). Storing a context and re-using it may be more performant in cases where you're getting the positions in a radius of the same size many times, even if the location center point or shape of the radius is changing.

#### ReadOnlyAreaExtensions

Extension methods for IReadOnlyArea.

#### ReadOnlyAreaPositionsEnumerable

A custom enumerator used to iterate over all positions within an area with a foreach loop efficiently.

#### Rectangle

Represents a 2D rectangle. Provides numerous static functions that enable creation and common operations involving rectangles.

#### RectangleExtensions

Contains set of operators that match ones defined by other packages for interoperability, so syntax may be uniform. Functionality is similar to the corresponding actual operators for Color.

#### RectanglePositionsEnumerable

A custom enumerator used to iterate over all positions within a rectangle with a foreach loop efficiently.

### Interfaces

#### IMatchable<T>

Interface implemented to define a form of checking value equality, without guarantees that it corresponds to GetHashCode.

#### IReadOnlyArea

Read-only interface for an arbitrary 2D area.