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.
BisectionResultEnumerator
A custom enumerator used to iterate over all rectangles in the given bisection result efficiently. Generally, you should simply use a BisectionResult in a foreach loop, rather than creating one of these manually.
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.
BresenhamEnumerator
A custom enumerator used to iterate over all positions on the on a line using the Bresenham line algorithm efficiently.
Generally, you should use GetBresenhamLine(Point, Point) to get an instance of this, rather than creating one yourself.
ChebyshevDistance
Represents chebyshev distance (equivalent to 8-way movement with no extra cost for diagonals).
CirclePositionsEnumerator
A custom enumerator used to iterate over all positions on the outside of a circle efficiently.
Generally, you should use GetCircle(Point, Int32) to get an instance of this, rather than creating one yourself.
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.
DDAEnumerator
A custom enumerator used to iterate over all positions on the on a line using the DDA line algorithm efficiently.
Generally, you should use GetDDALine(Point, Point) to get an instance of this, rather than creating one yourself.
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).
EllipsePositionsEnumerator
A custom enumerator used to iterate over all positions on the outside of an ellipse efficiently.
Generally, you should use GetEllipse(Point, Point) to get an instance of this, rather than creating one yourself.
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.
IDGenerator
Class designed as a helper for situations where you need to generate and assign a unique integer to each instance of a class, eg. for a class implementing IHasID.
Lines
Provides implementations of various line-drawing algorithms which are useful for generating lines on a 2D integer grid.
Lines.Algorithm
Various supported line-drawing algorithms.
ListEnumerator<T>
A custom enumerator that simply iterates over a List. It differs from C#'s built-in iterator in that it also implements IEnumerable, and so can be used as a substitute for IEnumerable<T>.
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.
OrthogonalEnumerator
A custom enumerator used to iterate over all positions on the on a line using the Orthogonal line algorithm efficiently.
Generally, you should use GetOrthogonalLine(Point, Point) to get an instance of this, rather than creating one yourself.
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.
PropertyChangedEventHelpers
Helper functions useful for implementing events using ValueChangedEventArgs<TProperty> as their parameter.
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.
ReadOnlyAreaPositionsEnumerator
A custom enumerator used to iterate over all positions within an area with a foreach loop efficiently.
ReadOnlyListEnumerator<T>
A structure similar to ListEnumerator<T>, but for IReadOnlyList<T>. It is not quite as fast as ListEnumerator<T>, but is still faster than using the typical Enumerable implementation for IReadOnlyList. You should only use this if you can't use ListEnumerator<T> due to the type you're working with; they share the same characteristics otherwise.
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.
RectanglePerimeterPositionsEnumerator
A custom enumerator used to iterate over all positions on the outside edges of a rectangle efficiently.
Generally, you should use PerimeterPositions() to get an instance of this, rather than creating one yourself.
RectanglePositionsEnumerator
A custom enumerator used to iterate over all positions within a rectangle efficiently.
Shapes
Provides implementations of various shape algorithms which are useful for for generating points representing shapes on a 2D integer grid.
ToStringExtensions
Static class containing extension extension methods for printing various built-in C# classes (as well as some grid views) as strings neatly.
Useful for debugging, and within the primitives library for ToString implementations.
ValueChangedEventArgs<TProperty>
Event arguments for an event fired when an object's properties are changed. Often used with SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>) and other overloads of that function.
Interfaces
IHasID
Interface for a class that has an integer ID value, typically used for items in a spatial map, or generally for purposes of hashing.
IHasLayer
Interface for objects that reside on a "Z-index" or "layer".
IMatchable<T>
Interface implemented to define a form of checking value equality, without guarantees that it corresponds to GetHashCode.
IPositionable
An interface describing an object which has a position on a grid and can move around.
IReadOnlyArea
Read-only interface for an arbitrary 2D area.