Skip to content

Improve Area -> Geometry conversion - #5506

Merged
cwisniew merged 5 commits into
RPTools:developfrom
kwvanderlinde:bugfix/fix-geometry-on-load
May 27, 2025
Merged

Improve Area -> Geometry conversion#5506
cwisniew merged 5 commits into
RPTools:developfrom
kwvanderlinde:bugfix/fix-geometry-on-load

Conversation

@kwvanderlinde

@kwvanderlinde kwvanderlinde commented May 27, 2025

Copy link
Copy Markdown
Collaborator

Identify the Bug or Feature request

Improves on #5159

Description of the Change

There are two parallel changes in this PR.

First is fix for how we handle more nuanced geometry. Area does not seem to give reliably oriented paths when the coordinates are more precise than about 1e-10. So after read the coordinates, we reduce their precision to a 1e-10 grid in order to get more consistent orientation checks. Along with that, we also apply a GeometryFixer to each polygon to make sure that we don't get invalid geometry if any manages to sneak by.

Second change is a performance improvement to how we handle token BL, especially when rendering the topology overlay. Before, we would union up all the token BL of a given type on a map to produce a single Area, which would then be rendered. This unioning is very slow when there are many BL-bearing tokens, so it has been updated to use the faster union in GeometryUtil.union(). Even with that, it is much to slow to use during rendering, so in that case we skip unions altogether and just draw the individual BL. This is arguable more correct as well, since it more clearly indicates where token BL overlaps.

Possible Drawbacks

None

Documentation Notes

N/A

Release Notes

  • Improved performance and increased robustness of BL rendering and processing.

This change is Reviewable

These unions are really expensive, so if we can avoid them it matters. A key case is in rendering the topology tool - it
was doing this expensive union each time it painted. We now just obtain a list of the masks and render them
individually.
@github-project-automation github-project-automation Bot moved this from Awaiting-Review to To-Be-Merged in MapTool 1.18 May 27, 2025
@cwisniew
cwisniew added this pull request to the merge queue May 27, 2025
Merged via the queue into RPTools:develop with commit 90828db May 27, 2025
@github-project-automation github-project-automation Bot moved this from To-Be-Merged to Merged in MapTool 1.18 May 27, 2025
@kwvanderlinde
kwvanderlinde deleted the bugfix/fix-geometry-on-load branch May 30, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

[Bug]: Movement distance not shown in player mode (either server client or "show as player")

2 participants