Skip to content

Instantly share code, notes, and snippets.

@unlocomqx
Created September 3, 2019 09:18
Show Gist options
  • Save unlocomqx/b0b0acac9ac3448bcfac82e33209a550 to your computer and use it in GitHub Desktop.
Save unlocomqx/b0b0acac9ac3448bcfac82e33209a550 to your computer and use it in GitHub Desktop.
<?php
if ($diagonal < $diag_min) {
$diagonal = $diag_min;
if ($changed == "width") {
$height = sqrt(pow($diagonal, 2) - pow($width, 2));
}
if ($changed == "height") {
$width = sqrt(pow($diagonal, 2) - pow($height, 2));
}
}
if ($diagonal > $diag_max) {
$diagonal = $diag_max;
if ($changed == "width") {
$height = sqrt(pow($diagonal, 2) - pow($width, 2));
}
if ($changed == "height") {
$width = sqrt(pow($diagonal, 2) - pow($height, 2));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment