Add SAT collision detection - #58
Merged
Merged
Conversation
This took longer than expected, but it's the first pass at the documentation for the geometry module, which is going to be necessary to test some of the more complicated pathfinding algorithms which operate on entities of varying sizes rather than point particles. docs/Geometry.rst - Document vector2, line2, axisall, polygon2 docs/index.rst - Add geometry pygorithm/__init__.py - Add geometry pygorithm/geometry/__init__.py - Import vector2, axisall, line2, polygon2 pygorithm/geometry/axisall.py - Empty file pygorithm/geometry/line2.py - Empty file pygorithm/geometry/polygon2.py - Empty file pygorithm/geometry/vector2.py - Empty file tests/test_geometry.py - Empty file
This is an attempt to use autoclass for axis-aligned line. This should be nearly parity and, to help compare, includes both the auto generated documentation and the old style documentation. This also fixes some non-command wording in axis-aligned line * docs/Geometry.rst - Fix incorrect reST and minor wording improvements. Also add autoclass for AxisAlignedLine. * pygorithm/geometry/axisall.py - Add function skeletons and (hopefully) something resembling parity to documentation in Geometry.rst
This fixes the first wave of sphinx errors
The auto-class documentation is as good or better! Removing old style documentation for Axis-Aligned Line
This moves the Vector2 documentation to the source code and uses autoclass to generate it. There are minor language and formatting changes.
Fix more warnings from sphinx and change the output order to bysource * docs/Geometry.rst - Remove backticks where not allowed * docs/conf.py - Change output order to bysource from default
* docs/Geometry.rst - Use autoclass for Line2 * pygorithm/geometry/axisall.py - fix incorrect tuple syntax, add missing vartypes on ivars * pygorithm/geometry/line2.py - skeleton code * pygorithm/geometry/vector2.py - add missing vartypes on ivars, add magnitude_squared.
* pygorithm/geometry/line2.py - true -> True
Attempt fix failing references and try a different method of inline code highlighting in hopes it doesn't just use red text.
* pygorithm/geometry/line2.py As far as I can tell theres no way to easily get pretty inline code highlighting, so use the recommended double leading/trailing backticks. Also add missing function calculate_y_intercept
Creates skeleton for polygon2 * docs/Geometry.rst - Use autoclass instead of duplicated documentation * pygorithm/geometry/line2.py - Add spaces around default param values * pygorithm/geometry/polygon2.py - Add skeleton and docstrings
Pull from upstream
Add missing functions for the geometry example * docs/Geometry.rst - use from_regular rather than weird constructor * pygorithm/geometry/polygon2.py - Add form-regular and alternate tuple version for init
* docs/Geometry.rst - fix incorrect quick start comment * tests/test_geometry.py - add class TestVector2
* pygorithm/geometry/line2.py - minor documentation changes, add new method are_parallel(line1, line) * tests/test_geometry.py - add Line2 tests
* pygorithm/geometry/axisall.py - Minor documentation tweaks * tests/test_geometry.py - add tests for axis aligned line
First chunk of polygon tests * pygorithm/geometry/polygon2.py - normals cannot be a set (vector2 is not hashable). Improve documentation and add additional options for polygon2 from_regular. Add from_rotated and project_onto_axis * tests/test_geometry.py - add test polygon constructor, from_regular, from_rotated, area, and project_onto_axis. Add skeleton functions for remainder
Merge from upstream
* pygorithm/geometry/polygon2.py :py:attribute: -> :py:attr:
* pygorithm/geometry/polygon2.py - another attribute->attr and missing tick marks
Add tests for the various times polygons should raise an exception. * pygorithm/geometry/polygon2.py - minor documentation changes * tests/test_geometry.py - more polygon constructor tests
* pygorithm/geometry/polygon2.py - minor documentation changes * tests/test_geometry.py - finish polygon2.Polygon2 tests
* docs/Geometry.rst - fix outdated quick start guide * pygorithm/geometry/vector2.py - implement * test/test_geometry.py - fix incorrect tests
Currently I'm running py 3.4.4 which doesn't have math.isclose. I'm not sure the best place to put a similar method, right now I've replicated it to the two locations that need it. Polygon will also need it. I'll try to update python before pushing this upstream * pygorithm/geometry/axisall.py - Implement everything, change intersects return values and find_intersection return values (and update docs) * pygorithm/geometry/line2.py - Implement everything. find_intersection could be broken up but the subfunctions would need a lot of parameters or it would repeat a lot of math * tests/test_geometry.py - fix incorrect tests, use random.uniform instead of random.randrange
* pygorithm/geometry/polygon2.py - Improve documentation, finish implement- ing * pygorithm/geometry/vector2.py - Add cross product * tests/test_geometry.py - add cross product test, fix incorrect tests
Remove the _approx functions that I was using to delay updating * pygorithm/geometry/axisall.py - remove _approx * pygorithm/geometry/line2.py - remove _approx * pygorithm/geometry/polygon2.py - remove _approx
Needed the commit on github to realize that it has been changed to an alphabetical sort. Moved Geometry to its alphabetical location
* pygorithm/geometry/axisall.py - add __str__ and __repr__ * pygorithm/geometry/polygon2.py - document _create_links
* pygorithm/geometry/axisall.py - fix missing self. * tests/test_geometry.py - add tests for axisall repr and str
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.
Add convex polygons and helper classes (vectors, lines, axis aligned lines). All documented with sphinx auto-doc!
There is room for a few more tests (specifically line2.find_intersection doesn't have 100% coverage) but nearly every function has something. (Missing tests for polygon str, repr, and _create_link)
I should be able to continue onto the other pathfinding algorithms now.