Coordinate Arrays
Coordinates are passed to and from Surfer as arrays of doubles with alternating X and Y coordinates.
For example, the triangle specified by the coordinates (x1,y1), (x2,y2), (x3,y3) would be passed in an array with the elements arranged like so: x1,y1,x2,y2,x3,y3. Surfer is flexible about the dimension of the array so long as the X and Y coordinates are contiguous (no empty elements) and alternating. To use arrays in Surfer from within VB:
1. Singly dimensioned array:
Dim coordinates(1 to 6) As Double
coordinates(1)=x1
coordinates(2)=y1
coordinates(3)=x2
coordinates(4)=y2
coordinates(5)=x3
coordinates(6)=y3
2. Doubly dimensioned array:
Dim Points(1 To 2,1 To NumPoints) As Double
Points(1,1) = x1: Points(2,1) = y1
Points(1,2) = x2: Points(2,2) = y2
Points(1,3) = x3: Points(2,3) = y3
The first dimension is used for the X and Y coordinate, the second dimension refers to the vertex index.
3. You can use the Array statement for initialization, and then copy the results to a double array:
coordinates = Array(x1,y1,x2,y2,x3,y3)
dim Points(1 to 6) As Double
For i=1 to 6
Points(i) =
Next