Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating Curvature with an Array
Message
From
19/04/2008 08:08:08
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Calculating Curvature with an Array
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01311849
Message ID:
01311849
Views:
60
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.
Next
Reply
Map
View

Click here to load this message in the networking platform