Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating Curvature with an Array
Message
De
19/04/2008 08:08:08
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Calculating Curvature with an Array
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01311849
Message ID:
01311849
Vues:
61
I have an array that makes a rectangle using X and Y coordinates like this:
* Top Left
aShapeArray[1,1] = 10
aShapeArray[1,2] = 10

* Top Right
aShapeArray[2,1] = 20
aShapeArray[2,2] = 10

* Bottom Right
aShapeArray[3,1] = 20
aShapeArray[3,2] = 20

* Bottom Left
aShapeArray[4,1] = 10
aShapeArray[4,2] = 20

* Top Left again to close the shape
aShapeArray[5,1] = 10
aShapeArray[5,2] = 10
What loop/math can I use to create a rounded corner shape?

For example, if I add four more points to the array (ignore the actual subscripts, the are just at the four corners):
aShapeArray[1,1] = 25
aShapeArray[1,2] = 5

aShapeArray[1,1] = 25
aShapeArray[1,2] = 15

aShapeArray[1,1] = 5
aShapeArray[1,2] = 15

aShapeArray[1,1] = 5
aShapeArray[1,2] = 5
This will create an octagon. If I kept adding various points, I could end up with a circle. There must be a way to calculate that using another value, like 100 for a circle (or ellipse) and 0 for a square (or rectangle) and create the array used to create the shape.

Or if someone knows a resource that would help me do this.

These array points were not actually tested, but the idea hopefully is clear.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform