Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External Bounding Box has negative height #58

Open
tazdevil78 opened this issue Jan 31, 2020 · 1 comment
Open

External Bounding Box has negative height #58

tazdevil78 opened this issue Jan 31, 2020 · 1 comment

Comments

@tazdevil78
Copy link

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
Copy link
Author

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().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant