Hexworks / mixite

A GUI agnostic hexagonal grid library. Supports a multitude of grid layouts including hexagonal, triangular, rectangular and more.
Apache License 2.0
192 stars 29 forks source link

External Bounding Box has negative height #58

Open tazdevil78 opened 4 years ago

tazdevil78 commented 4 years ago

call to Hexagon.getExternalBoundingBox() returns a negative value for height.

``@Test public void negativeHeight() { HexagonalGridBuilder builder = new HexagonalGridBuilder() .setGridHeight(3) .setGridWidth(3) .setGridLayout(HexagonalGridLayout.HEXAGONAL) .setOrientation(HexagonOrientation.FLAT_TOP) .setRadius(138); HexagonalGrid grid = builder.build(); Hexagon hex = (Hexagon) grid.getHexagons().iterator().next(); Rectangle rect = hex.getExternalBoundingBox(); assertTrue(rect.getHeight()>0); // [207.0, 358.5, 276.0 ,-239.0] }```

tazdevil78 commented 4 years ago

height for a flat top hex with a radius of 138 is sqrt(3)*138 = 239. Appears the magnitude is correct, just need to take the abs().