Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance-focused rewrite of the ConvexPolyhedron class (#188)
* Updated documentation for ConvexPolyhedron rewrite * Updated __init__ and shape creation helpers * Updated centroid getter and setter * Updated volume getter, setter, and _rescale function * Improved _find_equations method * Added equations property * Updated faces property to work with optional sorting * Added normals property * Updated sort_faces * Updated neighbors property * Added simplices property and updated _surface_triangulation * Added _find_triangle_array_area helper * Add faster surface area getter, setter, and calculation * Added get_face_area method * Added face_centroids property and _get_face_centroids * Updated inertia_tensor property + _compute and diagonalize methods Compute_inertia_tensor needed to be updated because the previous algorithm does not work if the tetrahedral decomposition of the shape includes tetrahedra with negative volumes. This new method, implemented based on an algorithm published by A. M. Messner in 1980 is significantly faster and provides slightly more accurate results. Because of this, the relevant pytest has been updated to better check the method. * Added get_dihedral * Added more stringent pytests for centroid and centroid setter The centroid methods are core functionality to this class, and prior to this commit was not being tested. This fixes that, with a two-part test that checks for initial and repeated setting behavior. The monte carlo centroid compute has also been updated to test more samples on CircleCI. Test sampling has been tuned to account for the tighter tolerances * Added in-depth tests for surface area and volume setters * Added circleci checker function to speed up local pytest runs * Added Truncated Icosahedron to bad_shapes for test MOI This shape is individually responsible for ~25% of the total runtime of the test. The test passes (even at high precisions) but it has been marked bad due to the poor performance * Added pytest for test_face_centroids and fixes for shape creation with Fast=True * Set fast flag to properly default to False * Fix typo in _consume_hull * Fixed documentation for Polyhedron class The Polyhedron example bases the input off of a ConvexPolyhedron object. Because of this, the ordering of faces can be different. Documentation has been updated to match * Docstring fixes * Added tests for simplex equations, face equations, and normals * Combined pytest marks to clean up testing code * Update Credits.rst * Added test for heavily degenerate input vertices Also checks appropriate warning behavior for such a case * Changed [test] to [tests] * Updated ConvexPolyhedron to properly handle nonconvex inputs. * Removed use of Fast flag from class * Removed fast flag from credits * Updated ci flags for pytest * Fixed D202 in convex_polyhedron * Added ci check to MI test * [pre-commit.ci] auto fixes from pre-commit.com hooks * Updated tests * Updated docstring for _calculate_signed_volume * Removed degenerate cube test * Removed remaining circleci files * Update changelog * Clarified language on faces breaking change * Cleaned up convex hull handling * Update coxeter/shapes/convex_polyhedron.py Co-authored-by: Domagoj Fijan <[email protected]> * Removed unnecessary call to principal_moments * Fixed pytest fixture call * Fixed bug in _find_coplanar_simplices * Removed copy of inherited method get_dihedral --------- Co-authored-by: Brandon Butler <[email protected]> Co-authored-by: Vyas Ramasubramani <[email protected]> Co-authored-by: Bradley Dice <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Domagoj Fijan <[email protected]>
- Loading branch information