int[] Mv = new int[maxnv]; // vertex markers int rings=1; // number of rings for colorcoding int[] Tt = new int[maxnt]; // triangle type int[] Tc = new int[3*maxnt]; // corner type int[] Mt = new int[maxnt]; // triangle markers for distance and other things /****/ int [] Valence = new int [maxnv]; // vertex valence (count of incident triangles) boolean [] Border = new boolean [maxnv]; // vertex is border boolean [] VisitedV = new boolean [maxnv]; // vertex visited boolean [] VisitedT = new boolean [maxnv]; // vertex visited boolean[] Land = new boolean[maxnt]; // triangle type land (and bridge) or water int[] Lake = new int[maxnt]; // Which lake , for water triangles int lake=1; // currently selected lake >1; int nLakes=1; // number of lakes int lakeSize; // triangle count in current lake int[] Island = new int[maxnt]; // triangle markers for distance and other things int nIslands=1; // number of islands int islandSize; // triangle count in current island int largestIsland; int sizeOfLargestIsland; int[] Distance = new int[maxnt]; // triangle markers for distance fields int[] Tv = new int[maxnv]; // vertex type: 0=water, 1=border, 2=land boolean[] P = new boolean [3*maxnt]; // marker of corners in a path to parent triangle int c = 0; // current corner shown in image and manipulated with keys: n, p, o, l, r int sc=0; int maxValence=0; int longestShoreLake=0; int longestShore=0; int step=1; void findLakes() { if (step==1) {print("Initialize valences for "+nv+" vertices"); for (int i=0; imaxValence) { maxValence=Valence[i];};}; println(" Maximum valences = "+maxValence); };if (step==2) { println("Initialize Land and Distance for "+nt+" triangles"); for(int t=0; t collapsing lake "+L); pt LakeCenter= new pt(0,0,0); for (int v=0; v filled lake "+i+" with "+interior+" interior & "+border+" border vertices"); } else {remainingLakes++; for (int t=0; t "+interior+" interior & "+border+" border vertices in lake "+i); if (border>longestShore) {longestShore=border; longestShoreLake=i;}; }; println(" > Lake "+longestShoreLake+" has the longest shore of "+longestShore); for (int c=0; csizeOfLargestIsland) {largestIsland=nIslands; sizeOfLargestIsland=islandSize;}; }; }; } void conquerIsland (int c) { if ((Land[t(c)]) && (Island[t(c)]==0)) { Island[t(c)]=nIslands; islandSize++; if (nb(n(c))) {conquerIsland(l(c));}; if (nb(p(c))) {conquerIsland(r(c));}; }; }; int expandLargestIsland() { int tc=0; // counts water triangles for(int i=0; i0) && (r<15) && (!reached)) { for(int c=0; c "+ground+" ground & "+water+" water triangles. Total="+nt);}; void printVertices() {int regular=0, irregular=0; for (int v=0; v "+regular+" regular & "+irregular+" irregular vertices. Total="+nv);}; void printVertexTypes() {int land=0, water=0, border=0; for (int v=0; v "+water+" water, "+border+" border, "+land+" land vertices. Total="+nv);}; void setVertexTypes() { for (int c=0; c