Buckets2D<T>

References
public sealed class Buckets2D<T>
Represents a two-dimensional array of rectangular spatial buckets. The buckets are anchored at an origin point (lower left corner of the region).
T

Properties

CellHeight

#
Gets the height of each row.
public double CellHeight { get; }

CellWidth

#
Gets the width of each column.
public double CellWidth { get; }

Columns

#
Gets the number of columns.
public int Columns { get; }

Count

#
Gets the total number of cells.
public int Count { get; }

EnumerateHorizontal

#
Enumerate over all items starting at [0,0] and completing row=0 from left to right before switching to the row above. This is the most natural way to iterate over a bucket list.
public IEnumerable<T> EnumerateHorizontal { get; }

EnumerateVertical

#
Enumerate over all items starting at[0, 0] and completing column=0 from bottom to top before switching to the column to the right.
public IEnumerable<T> EnumerateVertical { get; }

OriginX

#
Gets the leftmost x-coordinate of the first column.
public double OriginX { get; }

OriginY

#
Gets the bottommost y-coordinate of the first row.
public double OriginY { get; }

Rows

#
Gets the number of rows.
public int Rows { get; }

Indexers

this[]

#
Access this two-dimensional array.
public T this[
column,
Column index.
row
Row index.
] { get; set; }

this[]

#
Access this two-dimensional array using a linear index.
public T this[
index
Linear index.
] { get; set; }

Methods

CellCorners

#
Gets the physical corners of a cell within the bucket space.
public void CellCorners(
column,
Column index.
row,
Row index.
out Point2d
min,
Corner with minimum (x,y) coordinate.
out Point2d
max
Corner with maximum (x,y) coordinate.
)

CellEvaluate

#
Evaluate a point in cell coordinates.
public Point2d CellEvaluate(
column,
Column index.
row,
Row index.
x,
Normalised cell x parameter.
y
Normalised cell y parameter.
)

Create

#
Create a bucket grid inside a boundingbox.
public static Buckets2D<T> Create(
region,
Region to cover.
cellSize
Width and height of cells.
)
Bucket list.

Create

#
Create a bucket grid inside a boundingbox.
public static Buckets2D<T> Create(
region,
Region to cover.
cellWidth,
Width of cells.
cellHeight
Height of cells.
)
Bucket list.

Create

#
Create a bucket grid inside a boundingbox.
public static Buckets2D<T> Create(
region,
Region to cover.
cellCount
Number of horizontal and vertical cells.
)
Bucket list.

Create

#
Create a bucket grid inside a boundingbox.
public static Buckets2D<T> Create(
region,
Region to cover.
horizontalCount,
Number of horizontal cells.
verticalCount
Number of vertical cells.
)
Bucket list.

Create

#
Create a bucket grid inside a boundingbox.
public static Buckets2D<T> Create(
min,
Corner of region to cover.
max,
Corner of region to cover.
cellWidth,
Width of cells.
cellHeight
Height of cells.
)
Bucket list.

Create

#
Create a bucket grid inside a boundingbox.
public static Buckets2D<T> Create(
min,
Corner of region to cover.
max,
Corner of region to cover.
horizontalCount,
Number of horizontal cells.
verticalCount
Number of vertical cells.
)
Bucket list.

EnumerateAroundCell

#
Enumerate over all eight cells surrounding a given cell, but omitting the non-existent ones.
public IEnumerable<T> EnumerateAroundCell(
column,
Column index.
row,
Row index.
filter,
A bucket list of true/false filter values (false=skip).
mask
Integer circle mask.
)

EnumerateAroundCell

#
Enumerate over all eight cells surrounding a given cell, but omitting the non-existent ones.
public IEnumerable<T> EnumerateAroundCell(
column,
Column index.
row,
Row index.
filter
A bucket list of true/false filter values (false=skip).
)

EnumerateAroundCell

#
Enumerate over all eight cells surrounding a given cell, but omitting the non-existent ones.
public IEnumerable<T> EnumerateAroundCell(
column,
Column index.
row
Row index.
)

EnumerateSubset

#
Enumerate over all valid, filtered cells in some subdomain.
public IEnumerable<T> EnumerateSubset(
column0,
Inclusive first column index.
column1,
Exclusive last column index.
row0,
Inclusive first row index.
row1,
Exclusive last row index.
filter
A bucket list of true/false filter values (false=skip).
)

EnumerateSubset

#
Enumerate over all valid cells in some subdomain.
public IEnumerable<T> EnumerateSubset(
column0,
Inclusive first column index.
column1,
Exclusive last column index.
row0,
Inclusive first row index.
row1
Exclusive last row index.
)

FindCellIndex

#
Find the (column, row) index pair of the cell which contains the given point. The index pair is always valid.
public bool FindCellIndex(
locus,
Point coordinate.
out int
column,
Column index.
out int
row
Row index.
)
True if the locus was within the found cell, false if it way beyond the bucket region.

IsValidIndex

#
Gets whether a [column,row] index pair is within the bucket domain.
public bool IsValidIndex(
column,
row
)

SetAll

#
Assign a value to all cells in this array.
public void SetAll(
T
instance
Value to assign.
)

ToArray

#
Gets a linear copy of the array.
public T[] ToArray()

ToNestedArray

#
Gets a nested array copy of this bucket list. The secondary arrays represent the individual rows.
public T[][] ToNestedArray()

ToString

#
Gets a string representation of this Buckets2D.
public override string ToString()
Object.ToString