Repository navigation
Convert vectors correctly in nonorthogonal bases - #320
Merged
Merged
Conversation
Owner
|
Thanks! |
This file contains hidden or 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
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.
Vec2d.convert_to_basiscurrently computes two independent projections. These give basis coordinates only when the axes are perpendicular. For a common isometric basis:Solve the two-coordinate system using its determinant. Add a nonperpendicular doctest, clarify that the axes must be independent, and cover skewed, reversed, scaled and ordinary perpendicular bases. Dependent axes raise
ZeroDivisionError, as zero-length axes already do.The native picking check projects world positions to screen coordinates and converts them back before
Space.point_query_nearest. Across 30 isometric/skew/perpendicular view configurations, 4,278 wrong tile selections and 4,320 missed moving-body selections become zero. An independent NumPy dense solve agrees within2.9e-15; native trajectories and direct-query controls are unchanged. These are reproducible constructed game scenes, not a claim about an affected released game or extreme/near-singular coordinate ranges.Fresh Munk2D/CFFI source build, Python 3.12:
python -m pymunk.testsruns 296 tests with two existing skips, all others passing (base: 293 tests, two skips). The new regression fails before the change. Mypy passes forvec2d.py; the new tests and changed method pass Black. Whole-file Black reports the same two pre-existing assert-layout differences on both sources.