Determinate the vector between two points

Topics: Algorithms, SharpMap v0.9 / v1.x, SharpMap v2.0
May 29, 2008 at 9:42 AM
Edited May 29, 2008 at 6:28 PM
Hi!

I'm developing a program similar to "Tom Tom" using SharpMap to draw the map.

One of the things that I must to do it's draw an arrow pointing from one point to another. If I have two points, p1 and p2. How can I calculate the angle to draw this arrow pointing to p2?  (p1 it's the origin).

Imagine:

If p2 its in the top of p1, the angle its 90 degrees. If p2 its on the left of p1, the angle its 180 degress. And, if p2 its on the right of p1, the angle its 0 degrees.

Thank you very much.

May 29, 2008 at 7:16 PM
In other words:

I need to draw a short arrow in p1 pointing to p2. This arrow indicates the path to be followed by the user.

Thanks!
Coordinator
May 29, 2008 at 7:37 PM
Hi Vans, Perhaps this will help [url:http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.adjustablearrowcap_members.aspx] use it on the Pen you are rendering the line with. HTH jd