-
Notifications
You must be signed in to change notification settings - Fork 263
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
Fix hexagon geometry #4831
Merged
cwisniew
merged 13 commits into
RPTools:develop
from
kwvanderlinde:bugfix/2840+4830-hex-grid-consistency
Jun 27, 2024
Merged
Fix hexagon geometry #4831
cwisniew
merged 13 commits into
RPTools:develop
from
kwvanderlinde:bugfix/2840+4830-hex-grid-consistency
Jun 27, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The edge projection was not always recalculated when the dimensions change. On top of that, it is not always half the edge length - that's only for regular hexagons. Now we always recalculate edge projection and edge length together, and relate them to the diameter propertly. There was one place where edge length was used where the diameter should have been used. Also remove a bunch of unused and commented out code, and caches for things that don't need to be cached.
The movement keys, zone, and cell shape have no business being serialized. The cell shape was also removed from the DTO to match this.
…le for calling setGridShapeCache()
No more unioning up areas or need for hacks to avoid meshing artifacts. We make one path that goes around the entire boundary, then convert that into a single area.
Previously we were offseting by 3/8 on the U axis, but this is only correct for regular hexagons. We now express this more generally in terms of edge length and projection. FIXME Also some clean up: - One implementation for both types of hex grids - Don't offset by more than a grid cell. It's unnecessary and means we need to do so everywhere else too.
kwvanderlinde
force-pushed
the
bugfix/2840+4830-hex-grid-consistency
branch
from
June 11, 2024 17:55
874b32a
to
f4832fc
Compare
…ng the implementation into HexGrid
Hex grids already ignored the `size` parameter and for square grids it was only ever called with the current size anyways. Isometrics grids used it, but they can have their own private overload for that.
With scaling in play, we can't rely on the width and height being larger or smaller than the other.
kwvanderlinde
force-pushed
the
bugfix/2840+4830-hex-grid-consistency
branch
from
June 11, 2024 19:10
5132563
to
862f67c
Compare
cwisniew
approved these changes
Jun 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identify the Bug or Feature request
Fixes #2840
Fixes #4830
Description of the Change
A number of underlying problems with hex grid have been fixed:
With the above, whatever the users sets in the "2nd Size" input is kept and is reflected in the map. Previously, typing in 100 x 400 would change the second size and result in this:
Now the 400 is kept and we see this:
Some general grid clean up is included as well:
transient
, with only size, offset, and for hex grids also their "aspect ratio" and orientation being serialized. The DTOs now include only these fields as well.Path2D
and filled in as anArea
instead of merging together a bunch of individual cells. This avoids precision issues (gaps) without needing to scale up the cell size. It avoids any possibility of holes in the result, and avoids hex grid lights bleeding over the cell edges.Possible Drawbacks
If loading an existing campaign with really stretched out hex grids, snap-to-grid tokens will not end up in the same cell as before. Since the cell dimensions were not accurate before, the conversion between a tokens real position and its cell has changed.
Documentation Notes
N/A
Release Notes
This change is