Filling in arrays with points data and retrieving/cycling through the data

simurq

Board Regular
Joined
Nov 11, 2011
Messages
73
Hello,

I'd like to construct variable-length polygon arrays, which contain a set of points given their coordinates. Each point has two coordinates (x, y). Eg.:

Code:
poly001 = [ (x1,y1); (x2,y2); ... (xn, yn) ]
where (x1,y1) ... represents the first point in 1-dimensional array.

I'm also thinking about using 2D arrays like this:

Code:
Dim poly001(6, 6) As Double, poly002(7, 7) As Double, poly003(5, 5) As Double, poly004(8, 8) As Double
Since the bounds of dimensions are equal (naturally), I'm also fine if the first dimension contains X values and the second dimension contains Y values.

But then I don't know how to retrieve and cycle through the data (points) in them.

So, the questions are:

i) which array type to use? 1D or 2D
ii) how can I fill in and retrieve data from these arrays?

Thanks!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top