getPointsAround method
Implementation
List<PointData<T>> getPointsAround(Point point, Offset offset) {
_CellKey cellKey = _cellKey(point);
List<PointData<T>> results = [];
// Calculate the range of cells to check
int startX = cellKey.x - (offset.dx / cellSize.width).floor();
int startY = cellKey.y - (offset.dy / cellSize.height).floor();
int endX = cellKey.x + (offset.dx / cellSize.width).ceil();
int endY = cellKey.y + (offset.dy / cellSize.height).ceil();
for (int x = startX; x <= endX; x++) {
for (int y = startY; y <= endY; y++) {
Point currentCellKey = Point(x, y);
if (_cellMap.containsKey(currentCellKey)) {
for (Point p in _cellMap[currentCellKey]!) {
results.add(PointData(p, _pointData[p] as T));
}
}
}
}
return results;
}