protected static function TextimageTextbox::rotatePoint in Textimage 7.3
Translate a point, by an offset and a rotation angle.
Parameters
int $x: x coordinate of the point
int $y: y coordinate of the point
float $angle: rotation angle
array $offset: offset array (x, y)
Return value
array array with x,y translated coordinates
1 call to TextimageTextbox::rotatePoint()
- TextimageTextbox::rotateBoxPoints in classes/
TextimageTextbox.inc - Rotate the box.
File
- classes/
TextimageTextbox.inc, line 170 - Textimage - Font textbox management class.
Class
- TextimageTextbox
- Textimage - Font textbox management class.
Code
protected static function rotatePoint($x, $y, $angle, $offset = NULL) {
$rad = deg2rad($angle);
$sin = sin($rad);
$cos = cos($rad);
$tx = round($x * $cos + $y * -$sin) + ($offset ? $offset[0] : 0);
$ty = round($y * $cos - $x * -$sin) + ($offset ? $offset[1] : 0);
return array(
$tx,
$ty,
);
}