Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Draw an arrow
Message
De
18/06/2002 07:10:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
18/06/2002 05:46:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00669490
Message ID:
00669631
Vues:
18
This message has been marked as a message which has helped to the initial question of the thread.
>Some help would be appreciated. Trigonometry is not my specialty.

In general, coordinates can either be specified in rectangular (x;y) form, or in polar (distance, angle) form.

In rectangular form, the first coordinate specified is usually x (positive towards the right), the second, y (positive upwards).

In VFP and many other programming languages (in Excel, too, for instance), angles are not expressed in degrees, but in radians. Use dtor() and rtod() to convert back and forth.

Angles are measured starting from the right, going up, left, bottom, down. A full circle is an angle of 360 degrees, or 2*pi() radians.

Example: To draw a line of length 100, starting at point (30;20), going 30 degrees up (towards the right), the end-point is at (30+100*cos(dtor(30)); 20+100*sin(dtor(20))).

I don't have experience with the line-drawing functions, so perhaps you should try it yourself first. Perhaps you have to apply int() or round() to the end-result. Or perhaps VFP accepts fractional pixels, discarding the fractional part.

Save this ending-point in two variables (or two object properties).

To add or subtract angles for the arrowhead: Let's assume you want the small lines at 45 degrees from the main line. To the 30 degrees, add 180 degrees (to go backwards), and then add 45 degrees for one line, subtract 45 degrees for the other one. Repeat the calculation above, using the saved end-point of your arrow-tip for the starting-point.

I hope this helps. Otherwise, just ask back.

Met hartelijke groeten,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform