Rotate object
based on:

@link http://www.fpdf.org/en/script/script2.php

@param int    $angle degrees
@param int    $x     x position
@param int    $y     y position
343167
public function rotate($angle, $x = -1, $y = -1)
    {
        if ($x == -1) {
            $x = $this->x;
        }
        if ($y == -1) {
            $y = $this->y;
        }
        if ($this->angle!=0) {
            $this->_out('Q');
        }
        $this->angle = $angle;
        if ($angle != 0) {
            $angle*=M_PI/180;
            $c=cos($angle);
            $s=sin($angle);
            $cx=$x*$this->k;
            $cy=($this->h-$y)*$this->k;
            $this->_out(sprintf(
                'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',
                $c,
                $s,
                -$s,
                $c,
                $cx,
                $cy,
                -$cx,
                -$cy
            ));
        }
    }
1303089
public void rotate(double angle) {
        double s = Math.sin(angle);
        double c = Math.cos(angle);

        double temp1 = m00;
        double temp2 = m01;
        m00 =  c * temp1 + s * temp2;
        m01 = -s * temp1 + c * temp2;
        temp1 = m10;
        temp2 = m11;
        m10 =  c * temp1 + s * temp2;
        m11 = -s * temp1 + c * temp2;
    }
371612
public static function atan2($y, $x)
    {
        $y = $y instanceof Angle ? $y->rad : $y;
        $x = $x instanceof Angle ? $x->rad : $x;

        return static::rad(atan2($y, $x));
    }
721330
function rotate($angle, $bg_color = '#000000') {
        // Perform the rotation
        $rgba = $this->normalize_color($bg_color);
        $bg_color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
        $new = imagerotate($this->image, -($this->keep_within($angle, -360, 360)), $bg_color);
        imagesavealpha($new, true);
        imagealphablending($new, true);
        // Update meta data
        $this->width = imagesx($new);
        $this->height = imagesy($new);
        $this->image = $new;
        return $this;
    }
21426
final public function rotateImage(
		$angle              = 0,
		array $bgd_color    = array(0, 0, 0, 127),
		$ignore_transparent = false
	)
	{
		$this->_image_handle = imagerotate(
			$this->_image_handle,
			$angle,
			$this->_createImageColorAlpha($bgd_color),
			$ignore_transparent ? 1 : 0
		);
	}
1258904
function rotate(angle) {
         if (angle !== 0) {
           var a = this.val,
               a0 = a[0],
               a1 = a[1],
               a3 = a[3],
               a4 = a[4],
               s = Math.sin(angle),
               c = Math.cos(angle);
           a[0] = a0 * c + a3 * s;
           a[1] = a1 * c + a4 * s;
           a[3] = a0 * -s + a3 * c;
           a[4] = a1 * -s + a4 * c;
         }

         return this;
       }
806677
public function roll(float $angle, string $type = Math::DEGREES) {
        $this->setRotationX($angle, $type);
    }
872384
function rotate($angle, $do = false) {
		$angle = min(max(floatval($angle), -360), 360);
        if (!$do){
            $this->_transforms[] = array('rotate', array($angle, true));
            $this->_transforms_str.='rotate('.$angle.')';
        }else{
            $rgba = array(255,255,255,0);
            $handler = $this->handler();
            $bg_color = imagecolorallocatealpha($handler, $rgba[0], $rgba[1], $rgba[2], $rgba[3]);
            $new = imagerotate($handler, $angle, $bg_color);
            imagesavealpha($new, true);
            imagealphablending($new, true);
            $this->_info['width'] = imagesx($new);
            $this->_info['height'] = imagesy($new);
            imagedestroy($this->_handler);
            $this->_handler = $new;
        }
		return $this;
	}
732963
public function skewX(Point $center, Angle $angle)
	{
		$this->x += $angle->tan * ($this->y - $center->y);
		return $this;
	}
653048
def rotate(self, angle, axis=(0, 0, 1)):
        """"""
        if not all(isinstance(a, int) for a in axis):
            raise ValueError
        x, y, z = self.x, self.y, self.z

        # Z axis rotation
        if(axis[2]):
            x = (self.x * math.cos(angle) - self.y * math.sin(angle))
            y = (self.x * math.sin(angle) + self.y * math.cos(angle))

        # Y axis rotation
        if(axis[1]):
            x = self.x * math.cos(angle) + self.z * math.sin(angle)
            z = -self.x * math.sin(angle) + self.z * math.cos(angle)

        # X axis rotation
        if(axis[0]):
            y = self.y * math.cos(angle) - self.z * math.sin(angle)
            z = self.y * math.sin(angle) + self.z * math.cos(angle)

        return Vector(x, y, z)
396785
public function rotate($angle, $bgColor)
    {
        $this->log("Rotate image " . $angle . " degrees with filler color.");

        $color = $this->getBackgroundColor();
        $this->image = imagerotate($this->image, $angle, $color);

        $this->width  = imagesx($this->image);
        $this->height = imagesy($this->image);

        $this->log("New image dimension width x height: " . $this->width . " x " . $this->height);

        return $this;
    }
324181
public function rotate($angle, $bg = '000000') {
        if (!$angle) {
            throw new InvalidArgumentException('angle must be specified');
        }

        return $this->addTransformation(sprintf('rotate:angle=%d,bg=%s', (int) $angle, $bg));
    }
1360129
public function rotate($x = 90)
    {
        $this->gdExtensionCheck();

        $file = $this->getFilePath();
        switch ($this->getExt()) {
            case 'png':
                $kaynak = imagecreatefrompng($file);
                unlink($file);
                $rotated = imagerotate($kaynak, $x, 0);
                imagepng($rotated, $file, 10);
                break;
            case 'jpg':
                $kaynak = imagecreatefromjpeg($file);
                unlink($file);

                $rotated = imagerotate($kaynak, $x, 0);
                imagejpeg($rotated, $file, 100);
                break;
            case 'gif':
                $kaynak = imagecreatefromgif($file);
                unlink($file);

                $rotated = imagerotate($kaynak, $x, 0);
                imagegif($rotated, $file);
                break;
        }
        imagedestroy($kaynak);

        return $this;
    }
97600
public function rotate($angle = 0)
    {
        if ($this->resource) {
            $this->resource = imagerotate($this->resource, $angle, 0);
        }

        return $this;
    }
1162345
public function rotatedText($x, $y, $txt, $angle)
    {
        //Text rotated around its origin
        $this->rotate($angle, $x, $y);
        $this->Text($x, $y, $txt);
        $this->rotate(0);
    }
782782
public function rotate(Point $center, Angle $angle)
	{
		$x = $this->x - $center->x;
		$y = $this->y - $center->y;
		$this->x = $x * $angle->cos - $y * $angle->sin + $center->x;
		$this->y = $y * $angle->cos + $x * $angle->sin + $center->y;
		return $this;
	}
581430
def rotate(self, angle):
        
        perp = Vector(-self.y, self.x)
        angle = angle * math.pi / 180.0
        c, s = math.cos(angle), math.sin(angle)
        return Vector(self.x * c + perp.x * s, self.y * c + perp.y * s)