note 92168 added to function.imageline
| From: | Anonymous at osu1 dot php dot net | Date: | Sun, 12 Jul 2009 20:16:01 +0000 |
| Subject: | note 92168 added to function.imageline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158208@lists.php.net to get a copy of this message | ||
Here's another way of modifying likavcan's code to display filled arrows. This makes use
of imagefilledpolygon(...) instead of recursive function calls.
<?php
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);
imagefilledpolygon($im, array($x2, $y2, $x3, $y3, $x4, $y4), 3, $color);
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 91.57.17.209
----
Manual Page -- http://www.php.net/manual/en/function.imageline.php
Edit -- https://master.php.net/note/edit/92168
Del: integrated -- https://master.php.net/note/delete/92168/integrated
Del: useless -- https://master.php.net/note/delete/92168/useless
Del: bad code -- https://master.php.net/note/delete/92168/bad+code
Del: spam -- https://master.php.net/note/delete/92168/spam
Del: non-english -- https://master.php.net/note/delete/92168/non-english
Del: in docs -- https://master.php.net/note/delete/92168/in+docs
Del: other reasons-- https://master.php.net/note/delete/92168
Reject -- https://master.php.net/note/reject/92168
Search -- https://master.php.net/manage/user-notes.php