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

Propagate origin displacements of child structures to parent #2150

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

kostmo
Copy link
Member

@kostmo kostmo commented Sep 19, 2024

Builds upon #2127 to fix the remaining issues with #1826.

If a structure incorporates sub-placements entailing northwesterly offsets, its "coordinate origin" will be shifted relative to the top-left cell in the grid. This updated coordinate origin should be propagated to parent structures for use when placing it. This includes placement of the main "area" onto the toplevel world map. This is essential when composing a large scene that needs to line up with features generated by the DSL.

Another bug fixed in this PR involved incorrect "area" computation within sibling placements when both a "northward" and "westward" offset were used; existing tests only covered each of these directions separately.

Changes in this PR

  • Refactoring for readability
  • Improved naming
    • Fixed typo padSouthwest -> padNorthwest
  • Export some functions for unit tests
  • Utilize propagated coordinate offset in WorldDescription

Testing

Unit tests

scripts/test/run-tests.sh swarm-unit --test-options '--pattern "Overlay"'

Scenarios

scripts/play.sh -i data/scenarios/Testing/1780-structure-merge-expansion/coordinate-offset-propagation.yaml --hide-goal
Before After
Screenshot from 2024-09-22 19-54-13 Screenshot from 2024-09-22 19-50-10
scripts/play.sh -i data/scenarios/Testing/1780-structure-merge-expansion/simultaneous-north-and-west-offset.yaml --hide-goal
Before After
Screenshot from 2024-09-22 19-53-50 Screenshot from 2024-09-22 19-53-07

@kostmo kostmo force-pushed the structures/coordinate-offset branch 2 times, most recently from ce7480d to edc8671 Compare September 23, 2024 02:45
@kostmo kostmo force-pushed the structures/coordinate-offset branch 3 times, most recently from d6dd1c6 to 0580d7d Compare September 23, 2024 04:18
@kostmo kostmo changed the title fix placement offsets Propagate origin displacements of child structures to parent Sep 23, 2024
@kostmo kostmo requested a review from byorgey September 23, 2024 05:05
@kostmo kostmo marked this pull request as ready for review September 23, 2024 05:06
@kostmo kostmo added the Bug The observed behaviour is incorrect or unexpected. label Sep 23, 2024
@kostmo kostmo requested a review from xsebek September 23, 2024 15:38
@kostmo kostmo added the merge me Trigger the merge process of the Pull request. label Sep 23, 2024
@mergify mergify bot merged commit b2983b9 into main Sep 23, 2024
14 checks passed
@mergify mergify bot deleted the structures/coordinate-offset branch September 23, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The observed behaviour is incorrect or unexpected. merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants