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

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

CellWidth

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

Columns

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

Count

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

EnumerateHorizontal

#
public IEnumerable<T> EnumerateHorizontal { get; }
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.

EnumerateVertical

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

OriginX

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

OriginY

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

Rows

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

Indexers

this[]

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

this[]

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

Methods

CellCorners

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

CellEvaluate

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

Create

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

Create

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

Create

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

Create

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

Create

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

Create

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

EnumerateAroundCell

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

EnumerateAroundCell

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

EnumerateAroundCell

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

EnumerateSubset

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

EnumerateSubset

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

FindCellIndex

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

IsValidIndex

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

SetAll

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

ToArray

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

ToNestedArray

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

ToString

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