Skip to content

Instantly share code, notes, and snippets.

@kodawah
Last active February 10, 2017 17:11
Show Gist options
  • Save kodawah/2dace1b894cdd3910ae87a6c1c832a21 to your computer and use it in GitHub Desktop.
Save kodawah/2dace1b894cdd3910ae87a6c1c832a21 to your computer and use it in GitHub Desktop.
uint32_t max_coord = (uint32_t) -1;
size_t orig_width = (size_t) sc->width * max_coord / (max_coord - r - l);
size_t orig_height = (size_t) sc->height * max_coord / (max_coord - b - t);
sc->spherical->left_bound = ceil(orig_width * l / max_coord);
sc->spherical->top_bound = ceil(orig_height * t / max_coord);
sc->spherical->right_bound = orig_width - sc->width - sc->spherical->left_bound;
sc->spherical->bottom_bound = orig_height - sc->height - sc->spherical->top_bound;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment