>*************************************************************** >* x1, y1 define start point of arrow (p1) >* x2, y2 define end point of arrow (p2) >* hdlen is length of arrow head >* hdang is angle of arrow head from straight line, in degrees >* p1h, p2h define if arrow head should at p1 & p2 respectively >* for reversed arrow heads make hdlen negative OR hdang > 90 >*************************************************************** > lparameters x1, y1, x2, y2, hdlen, hdang, p1h, p2h > local ang1r, hdar, nxa, nya, nxb, nyb > local xdif, ydif, xsum, ysum > > * convert angle of arrow head to radians > hdar = DTOR( hdang ) > * calculate slope of main line > ang1r = ATAN( (y2-y1)/(x2-x1) ) > > * calculate change in x & y positions due difference between above angles > xdif = hdlen * COS( ang1r - hdar ) > ydif = hdlen * SIN( ang1r - hdar ) > * calculate change in x & y positions due sum of above angles > xsum = hdlen * COS( ang1r + hdar ) > ysum = hdlen * SIN( ang1r + hdar ) > > * draw main line > thisform.Line( x1, y1, x2, y2 ) > > * if arrow head required at p1 > if p1h > * if drawing left to right or vertical than difference in lengths > * should be added, otherwise subtracted > if x2 >= x1 > nxa = x1 + xdif > nya = y1 + ydif > nxb = x1 + xsum > nyb = y1 + ysum > else > nxa = x1 - xdif > nya = y1 - ydif > nxb = x1 - xsum > nyb = y1 - ysum > endif > * draw p1 arrow heads > thisform.Line( x1, y1, nxa, nya ) > thisform.Line( x1, y1, nxb, nyb ) > endif > > * if arrow head required at p2 > if p2h > * if drawing left to right or vertical than difference in lengths > * should be subtracted, otherwise added > if x2 >= x1 > nxa = x2 - xdif > nya = y2 - ydif > nxb = x2 - xsum > nyb = y2 - ysum > else > nxa = x2 + xdif > nya = y2 + ydif > nxb = x2 + xsum > nyb = y2 + ysum > endif > * draw p2 arrow heads > thisform.Line( x2, y2, nxa, nya ) > thisform.Line( x2, y2, nxb, nyb ) > endif >>