Page 1 of 1

line with arrows?

Posted: Tue Jul 06, 2010 4:11 pm
by vschiavoni
Hello
i guess this is kind of a basic question, but i'm really a newbie. How do I attach an arrow to one or both the endings of a line? I guess I need to draw a triangle, but do I need to calculate by hand the coordinates, or is there
around some predefined function that I can add, by specifying the width of the arrow and how log it's supposed to be?

thanks,
valerio

Re: line with arrows?

Posted: Tue Jul 06, 2010 4:34 pm
by Robin
vschiavoni wrote:or is there
around some predefined function that I can add, by specifying the width of the arrow and how log it's supposed to be?
Nope, but I can give you a hint on what you need to do:
math.atan2(y, x), math.cos(a) and math.sin(a).

Re: line with arrows?

Posted: Tue Jul 06, 2010 7:21 pm
by Robin
I decided to write four arrow implementations, just for the heck of it. Four variants are (open, close) x (one end, two end). I'm sure you can make them much more advanced, for example by using setLineWidth or setLineStyle between draws, but this is the basic idea.

Re: line with arrows?

Posted: Thu Jul 08, 2010 9:02 am
by vschiavoni
thanks!