note 42984 added to function.imageline
| From: | likavcanatNOSPANsturaknospandotsk at rn2 dot php dot net | Date: | Sat, 05 Jun 2004 19:56:55 +0000 |
| Subject: | note 42984 added to function.imageline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70739@lists.php.net to get a copy of this message | ||
This function draws arrow.
function arrow($im, $x1, $y1, $x2, $y2, $alength, $awidth, $color) {
$distance = sqrt(pow($x1 - $x2, 2) + pow($y1 - $y2, 2));
$dx = $x2 + ($x1 - $x2) * $alength / $distance;
$dy = $y2 + ($y1 - $y2) * $alength / $distance;
$k = $awidth / $alength;
$x2o = $x2 - $dx;
$y2o = $dy - $y2;
$x3 = $y2o * $k + $dx;
$y3 = $x2o * $k + $dy;
$x4 = $dx - $y2o * $k;
$y4 = $dy - $x2o * $k;
imageline($im, $x1, $y1, $dx, $dy, $color);
imageline($im, $x3, $y3, $x4, $y4, $color);
imageline($im, $x3, $y3, $x2, $y2, $color);
imageline($im, $x2, $y2, $x4, $y4, $color);
}
----
Manual Page -- http://www.php.net/manual/en/function.imageline.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42984
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42984&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42984&report=yes
Search -- http://master.php.net/manage/user-notes.php