im making a line in php and so far its showing fine, but what problem im getting now is the line is not being smooth, it shows as breaking edges. following is the code for making radius line:
function draw_radius($img, $x1, $y1, $radius, $angle, $arrow_color, $arrow_length = 10, $arrow_width = 3)
{
$x2 = $x1 + $radius * cos(deg2rad($angle-90));
$y2 = $y1 + $radius * sin(deg2rad($angle-90));
imageline($img, $x1, $y1, $x2, $y2, $arrow_color);
$distance = sqrt(pow($x1 - $x2, 2) + pow($y1 - $y2, 2));
$dx = $x2 + ($x1 - $x2) * $arrow_length / $distance;
$dy = $y2 + ($y1 - $y2) * $arrow_length / $distance;
$k = $arrow_width / $arrow_length;
$x2o = $x2 - $dx;
$y2o = $dy - $y2;
$x3 = $y2o * $k + $dx;
$y3 = $x2o * $k + $dy;
$x4 = $dx - $y2o * $k;
$y4 = $dy - $x2o * $k;
imageline($img, $x1, $y1, $dx, $dy, $arrow_color);
imageline($img, $x3, $y3, $x4, $y4, $arrow_color);
imageline($img, $x3, $y3, $x2, $y2, $arrow_color);
imageline($img, $x2, $y2, $x4, $y4, $arrow_color);
}
following is the compass example, which im drawing line on.