getChildBoundary method
Gets the boundary rectangle for a child quadrant
Implementation
Rectangle getChildBoundary(Quadrant quadrant) {
final double halfWidth = boundary.width / 2;
final double halfHeight = boundary.height / 2;
final double x = boundary.x;
final double y = boundary.y;
switch (quadrant) {
case Quadrant.northWest:
return Rectangle(x, y, halfWidth, halfHeight);
case Quadrant.northEast:
return Rectangle(x + halfWidth, y, halfWidth, halfHeight);
case Quadrant.southWest:
return Rectangle(x, y + halfHeight, halfWidth, halfHeight);
case Quadrant.southEast:
return Rectangle(x + halfWidth, y + halfHeight, halfWidth, halfHeight);
}
}