# A compass

Printable View

• 10-29-2008, 05:00 AM
bozovilla
A compass
Hi, can I know how do I draw an arrow in a circle which is similar to a compass. But the arrow doesn't have to move around. Thanks
• 10-29-2008, 08:49 AM
Eranga
Since you no need to move the arrow, use lines to build the array.
• 10-29-2008, 03:09 PM
Norm
Drawing the shaft of the arrow would be just a straight line from the center of the circle to the end point. Drawing the head of the arrow would require some computations that will have to be worked out.
Can you draw a circle?
Can you draw a line from the center of the circle to the end point?
Do these first then work on drawing the arrow head.
There are code examples for drawing on the forum. Use search.
• 10-30-2008, 06:13 AM
Eranga
Actually it's not much difficult. Only thing need to identify is about the starting point and the end point of a line, and three lines only need.
• 10-30-2008, 02:55 PM
Norm
I think drawing the 2 lines that make the head of the arrow will be tricky. That would require some trig to get the angles right.
• 10-30-2008, 06:01 PM
Eranga
Actually it's not much difficult if you keep track with the coordination.
• 10-30-2008, 06:50 PM
Norm
Not too hard if your trig is good:
Say you have the arrow 100 pixels long pointing to the right.
Say the head is to be 10 pixels long.
Say the angle between the head parts and the shaft is 45 deg.
Go to the end of the arrow and measuse a 45 deg angle above the shaft and find the point 10 pixels away at that angle and draw a line from the end of the arrow to the above point.
Do the same for the angle below the shaft.
Voila you have an arrow with head.