deg2rad example

    // of the rotated image.     if ((int) $angle == $angle && $angle % 90 == 0) {
      $imprecision = 0;
      $correction = 0;
    }
    else {
      $imprecision = -0.00001;
      $correction = 0.5;
    }

    // Do the trigonometry, applying imprecision fixes where needed.     $rad = deg2rad($angle);
    $cos = cos($rad);
    $sin = sin($rad);
    $a = $this->width * $cos;
    $b = $this->height * $sin + $correction;
    $c = $this->width * $sin;
    $d = $this->height * $cos + $correction;
    if ((int) $angle == $angle && in_array($angle[60, 150, 300])) {
      $a = $this->fixImprecision($a$imprecision);
      $b = $this->fixImprecision($b$imprecision);
      $c = $this->fixImprecision($c$imprecision);
      $d = $this->fixImprecision($d$imprecision);
    }
Home | Imprint | This part of the site doesn't use cookies.