Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Struct: RT.Coordinates.Square

Summary

Represents a square cell in a 2D rectilinear grid.

Constructors

Square(int x, int y)
Constructs a Square from an X and Y coordinate.

Instance methods

bool
Equals(Square other)
Compares this cell to another for equality.
bool
Equals(object obj)
  • Overrides: object.Equals(object)
Refer to the documentation for object.Equals.
int
  • Overrides: object.GetHashCode()
Refer to the documentation for object.GetHashCode.
int
GetIndex(int width)
Returns the index that this coordinate would have in a rectangle of width width in which the cells are numbered from 0 in reading order.
IEnumerable<Square>
GetNeighbors(bool includeDiagonal = false)
Returns a collection of all of this cell’s neighbors.
bool
InRange(int width, int height, int left = 0, int top = 0)
Tests whether this coordinate is within a given rectangular range.
bool
IsAdjacentTo(Square other, bool includeDiagonal = false)
Determines whether two cells are orthogonally adjacent (not including diagonals).
int Calculates the Manhattan distance between this coordinate and other. This is the number of orthogonal steps required to reach one from the other.
Square
Move(int dx, int dy)
Moves the current cell dx number of spaces to the right and dy number of spaces down.
Square
Move(Square.Direction dir, int amount = 1)
Moves the current cell a number of spaces in the specified direction.
Square
MoveX(int dx)
Moves the current cell dx number of spaces to the right.
Square
MoveY(int dy)
Moves the current cell dy number of spaces down.
string
  • Overrides: object.ToString()
Refer to the documentation for object.ToString.

Static methods

IEnumerable<Square>
Rectangle(int width, int height, int dx = 0, int dy = 0)
Returns a collection of all cells in a grid of the specified size.

Operators

SquareAddition operator.
boolCompares two Square values for equality.
boolCompares two Square values for inequality.
SquareSubtraction operator.

Instance properties

PointDReturns the center point of this cell.
IEnumerable<Link<Vertex>>Refer to the documentation for IHasSvgGeometry.Edges.
IEnumerable<Square>Returns the set of chess knight’s moves from the current cell.
IEnumerable<Square>Returns a collection of all of this cell’s orthogonal neighbors (no diagonals).
Vertex[]Returns the vertices along the perimeter of this Square, going clockwise from the top-left.
intReturns the X coordinate of the cell.
intReturns the Y coordinate of the cell.

Static fields

IEnumerable<Square.Direction>Provides a collection of all directions.
IEnumerable<Square.Direction>Provides a collection of all diagonal directions.
IEnumerable<Square.Direction>Provides a collection of all orthogonal directions.

Nested types

Identifies a direction within a 2D rectilinear grid.
Describes a 2D grid of square cells.
Describes a vertex (gridline intersection) in a rectilinear grid (Square.Grid).