Skip to content

Update Polygons' bounding box calculations #128

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

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

anderoonies
Copy link
Contributor

Resolves #119

Summary

This updates the way Polygon's bounding boxes are calculated to account for the possibility of negative points. Additionally, when drawing bounding boxes in debug mode, draw the absolute bounds rather than a square with the width/height of the AABB around the x,y position to account for the possibility of negative points.

Changes:

  • Polygon now implements _updateBounds to manually calculate its bounding box
  • Thing's draw method now will draw a debug bounding box with no context translation at the bounds' position. This is to handle negative coordinates (relative to the shapes' x, y position) in the bounding box.

Screenshots of the change:

polyspin

Checklist

  • npm test passes
  • Unit tests are included / updated
  • Documentation has been updated where relevant

…lity of negative points. Additionally, when drawing bounding boxes in debug mode, draw the absolute bounds rather than a square with the width/height of the AABB around the x,y position to account for the possibility of negative points.
@anderoonies anderoonies merged commit 68d2cca into codehs:main Feb 21, 2022
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

Successfully merging this pull request may close these issues.

Bounding box for Polygons incorrect
1 participant