/* * getSurfacePolygonCount will return the number of polygons that are in every surfacePolygonholder added to gether * Parameter: none * Return: (int) * the number of surface polygons in the surfacePolygonHolders */ /*int getSurfacePolygonCount() * { * int counter = 0; * for (int count = 0; count < surfacePolygonHolders.Length; count++) { * if (surfacePolygonHolders [count] != null) * counter += surfacePolygonHolders [count].getPolygonsHeld (); * } * return counter; * }*/ /* mergeSurfacePolygonsHolders calls the merge function to merge all the polygons in * the surfacePolygonHolders array. * Parameters: none * Return: none */ void mergeSurfacePolygonHolders() { surfacePolygonHolders.merge(); /*for (int count = surfacePolygonHolders.Length - 1; count >= 0; count--) { * if (surfacePolygonHolders [count] != null) { * for (int count2 = surfacePolygonHolders.Length - 1; count2 >= 0; count2--) { * if (surfacePolygonHolders [count2] != null && count != count2) { * surfacePolygonHolders [count] = surfacePolygonHolders [count].mergePolygonHolder (surfacePolygonHolders [count2]); * surfacePolygonHolders [count2] = null; * } * } * } * }*/ /*int counter = 0; * for (int count = 0; count < surfacePolygonHolders.Length; count++) * if (surfacePolygonHolders [count] != null) * counter++;*/ /*AIPolygonHolder[] tempArray = new AIPolygonHolder[counter]; * * for (int count = 0, tempCount = 0; count < surfacePolygonHolders.Length; count++) { * if (surfacePolygonHolders [count] != null) { * tempArray [tempCount] = surfacePolygonHolders [count]; * tempCount++; * } * }*/ }
/* * mergePolygonHolder will merge two AIPolygonHolder objects. This will create a new AIPolygonHolder * place the polygons from each AIPolygonHolder to the new AIPolygonHolder then merge the Polygons * in the new AIPolygonHolder * Parameter: (AIPolygonHolder)holderToMerge is the AIPolygonHolder that will be merged with this object * Return: (AIPolygonHolder) * the new AIPolygonHolder that is the two merged AIPolygonHolders */ public AIPolygonHolder mergePolygonHolder(AIPolygonHolder holderToMerge) { copyAndSrink(polygonArray); holderToMerge.copyAndSrink(holderToMerge.getPolygons()); AIPolygon[] tempArray = mergeTwoArrays(polygonArray, holderToMerge.getPolygons()); //makes a new AIPolygonHolder with the capacity of both AIPolygonHolders being Merged AIPolygonHolder newHolder = new AIPolygonHolder(tempArray.Length); //makes a new AIPolygonHolder with the capacity of both AIPolygonHolders being Merged for (int count = 0; count < tempArray.Length; count++) { newHolder.addPolygon(tempArray [count].getVertices()); } newHolder.merge(); // merged the polygons in the new AIPolygonHolders return(newHolder); }