A quick function using imageline that I wrote so i could specify a starting point, angle and length of vector.
Thought other people might find this useful.
<?php
$size = 600;
$img = imagecreatetruecolor($size, $size);
$white = imagecolorallocate($img, 255, 255, 255);
$black = imagecolorallocate($img, 0, 0, 0);
imagefilledrectangle($img,0,0,$size,$size,$white);
function Vector($palette,$startx,$starty,$angle,$length,$colour){
$angle = deg2rad($angle);
$endx = $startx+cos($angle)*$length;
$endy = $starty-sin($angle)*$length;
return(imageline($palette,$startx,$starty,$endx,$endy,$colour));
}
Vector($img,$size/2,$size/2,30,200,$black);
header("Content-type: image/png");
imagepng($img);
?>
For this script angles work in a anti-clockwise direction (modify + and - in function to change start of 0 degrees and also direction of angle calculated)