Results 1 to 7 of 7
Thread: A compass
- 10-29-2008, 05:00 AM #1Member
- Join Date
- Nov 2007
- Rep Power
- 10-29-2008, 08:49 AM #2
- 10-29-2008, 03:09 PM #3
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 #4
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 #5
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 #6
- 10-30-2008, 06:50 PM #7
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.
- By levent in forum Java SoftwareReplies: 0Last Post: 05-14-2007, 09:32 AM