void scaleBBox()

in h3_bbox.c [265:282]


void scaleBBox(BBox *bbox, double scale) {
    double width = bboxWidthRads(bbox);
    double height = bboxHeightRads(bbox);
    double widthBuffer = (width * scale - width) * 0.5;
    double heightBuffer = (height * scale - height) * 0.5;
    // Scale north and south, clamping to latitude domain
    bbox->north += heightBuffer;
    if (bbox->north > M_PI_2) bbox->north = M_PI_2;
    bbox->south -= heightBuffer;
    if (bbox->south < -M_PI_2) bbox->south = -M_PI_2;
    // Scale east and west, clamping to longitude domain
    bbox->east += widthBuffer;
    if (bbox->east > M_PI) bbox->east -= M_2PI;
    if (bbox->east < -M_PI) bbox->east += M_2PI;
    bbox->west -= widthBuffer;
    if (bbox->west > M_PI) bbox->west -= M_2PI;
    if (bbox->west < -M_PI) bbox->west += M_2PI;
}