Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Christmas puzzle
Message
De
24/12/2003 06:17:32
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
A Christmas puzzle
Divers
Thread ID:
00861878
Message ID:
00861878
Vues:
50
Hi All,

Here's a Christmas puzzle. The requirements will probably be clearer if you've worked with GDI Regions but anyway:

Given a shape formed by two concentric arcs with arbitrary but identical start and end angles and two lines connecting the two start points and two endpoints : Construct a polygon (defined as an array of x,y points) which encloses the above shape but does not infringe on the area between the two circles outside the start and end angles.

Coordinate system is with x increasing to the right, y increasing downwards, circle centre is 0,0. Angles are defined counterclockwise with 0 at +x,0. The size of the polygon does not need to be the minimum achievable.

Because of the way regions can be combined it can be assumed that the angle of the arc will not exceed 180 degrees which makes it easier. You can also assume that I've already calculated the x,y coordinates for the start and end point of both arcs.

As you may have guessed the end requirement here is to convert the shape to a region which can be used with the FillRgn() function. Before someone suggests using Paths instead - I am using them for W2000 but we need this for backwards compatibility with WIN98 OS's which do not support arcs in path definitions.

My usual problem - I can do it but it's not pretty - just looking for a neat general alogorithm. This isn't going to be VFP code but...

Have a Merry Christmas,
Viv
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform