I’m working on a iterative function system program, and there’s a section of code here:
double[] dist = StdArrayIO.readDouble1D();
double[][] cx = StdArrayIO.readDouble2D();
double[][] cy = StdArrayIO.readDouble2D();
It reads in this text file (piped into the program in the command line):
3
.33 .33 .34
3 3
.50 .00 .00
.50 .00 .50
.50 .00 .25
3 3
.00 .50 .00
.00 .50 .00
.00 .50 .433
And I am having a really hard time trying to understand what this exactly does. Later on in the program points from these arrays are randomly selected, and the program prints out a Sierpinski Triangle. Could someone give me a basic explanation of what is going on here?
It looks like the first line of the file represents the length of the array, and the next line are the values of that array. It then stores these values in an array of doubles of length 3, called dist. Similarly for the next four lines, it takes the dimensions of a 3×3 matrix (or an array of arrays) and then the values for that matrix, storing it in cx. Same for cy.