float[] (double edgeLength) { // If the edge is vertical, then edgeLength is equal to rowHeight. Exactly one dash and one space fits on the edge, // so spaceLength + dashLength is also equal to rowHeight. // When the edge is not vertical, spaceLength is kept the same, but dashLength is chosen to be slightly greater // so that the whole number of dashes would fit on the edge. int rowHeight = getRowHeight(); int dashCount = Math.max(1, (int)Math.floor(edgeLength / rowHeight)); float spaceLength = rowHeight / 2.0f - 2; float dashLength = (float)(edgeLength / dashCount - spaceLength); return new float[]{dashLength, spaceLength}; }