Skip to content

Commit 2a2bff3

Browse files
janbridleyb-butlervyasr
authored
Added new shape families for Archimedean, Catalan, Johnson, and other solids. (#177)
* test: Fix assumption on quaternions. Only test quaternions that are not effectively zero. * Added new classes to return the edges of polyhedra The new class ``polyhedron.edges`` returns the a list of the edges of a polyhedron as vertex-index pairs, similar to the current ``polyhedron.faces`` class. The class ``polyhedron.get_edge_vectors`` returns a list of edges as vectors in 3D space. * Added json files for new shape families as well as accompanying import functions. * Added new pytest marks and a few test functions. * New pytest marks have been created for the Archimedean, Catalan, and Johnson shape families. * A function has been written to combine multiple marks into a single mark for more compact testing of shape properties. * test_volume function for damasceno shapes has been adapted to test the new shape families * A test_surface_area method similar to test_volume has been added. * Tightnened tolerance for test_insphere and increased deadline Tightened ``atol`` of ``test_insphere``. Increased the deadline of the test to accommodate testing of shapes with many faces (e.g. disdyakis triacontahedron). * Applied test_bounding_sphere to archimedean solids * Tightened tolerance for test_bounding_sphere * Added marks for prism/antiprism and pyramid/dipyramid families * Applied test_get_set_minimal_centered_bounding_sphere_radius to all new shape families, including prism/antiprism and pyramid/dipyramid * Applied test_volume and test_surface_area to prism/antiprism and pyramid/dipyramid. Fixed typo in conftest * Formatted code with black. * Revert commit "Added new classes to return the edges of polyhedra" This commit reverts changes made in ab21279, which are included in a different PR. * Fixed docstring for common.py * Split test_insphere into multiple functions based on input data complexity. The Random3DRotationStrategy test varies widely in runtime based on the complexity of the input shape. Splitting the calling function into two tests (for simple Platonic shapes and more complex Catalan shapes) should solve this issue. * Increased resilience of minimal_bounding_sphere method The ``minimal_bounding_sphere`` method is reliant on the solution to a linear system of equations. For polyhedra with portions that protrude out from the main mass, this method can fail due to numerical instability in a small percent of cases. This fix double-checks that the calculated miniball contains all points on the polyhedron, and allows the method to make more attempts to find a correct answer before failing. * Revert "Increased resilience of minimal_bounding_sphere method" This reverts commit 40f500c, moving all miniball-related changes to #178. * Removed unnecessary print statement in the combine_mark function * Updated Credits.rst to not conflict with master * Fixed missing space in archimedean.json "Truncated Cuboctahedron" * Added additional pytest for json data and new families --------- Co-authored-by: Brandon Butler <[email protected]> Co-authored-by: Vyas Ramasubramani <[email protected]>
1 parent cfb4637 commit 2a2bff3

12 files changed

+18983
-123
lines changed

Credits.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,13 @@ Tobias Dwyer
105105
* Added examples for the shape classes.
106106

107107
Jen Bradley
108+
108109
* Bug fixes for ``gsd_shape_spec`` to correctly comply with GSD specifications.
109110
* Fixed error where ``__repr__`` would fail for polyhedra with multiple face types.
111+
* Increased accuracy of stored data for PlatonicFamily solids
112+
* Added shape families for Archimedean, Catalan, and Johnson solids.
113+
* Added shape family for prisms and antiprisms.
114+
* Added shape family for equilateral pyramids and dipyramids.
110115

111116
Source code
112117
-----------

coxeter/families/__init__.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@
1717
reproducing the exact set of shapes from publications.
1818
"""
1919

20-
from .common import PlatonicFamily, RegularNGonFamily
20+
from .common import (
21+
ArchimedeanFamily,
22+
CatalanFamily,
23+
JohnsonFamily,
24+
PlatonicFamily,
25+
PrismAntiprismFamily,
26+
PyramidDipyramidFamily,
27+
RegularNGonFamily,
28+
)
2129
from .doi_data_repositories import _doi_shape_collection_factory, _KeyedDefaultDict
2230
from .plane_shape_families import (
2331
Family323Plus,
@@ -53,6 +61,11 @@
5361
"Family423",
5462
"Family523",
5563
"PlatonicFamily",
64+
"ArchimedeanFamily",
65+
"CatalanFamily",
66+
"JohnsonFamily",
67+
"PrismAntiprismFamily",
68+
"PyramidDipyramidFamily",
5669
"RegularNGonFamily",
5770
"ShapeFamily",
5871
"TabulatedShapeFamily",

coxeter/families/common.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,74 @@ def make_vertices(cls, n):
8383
"Icosahedron", "Octahedron", and "Tetrahedron".
8484
""",
8585
)
86+
87+
ArchimedeanFamily = TabulatedGSDShapeFamily.from_json_file(
88+
os.path.join(_DATA_FOLDER, "archimedean.json"),
89+
classname="ArchimedeanFamily",
90+
docstring="""The family of Archimedean solids (13 total).
91+
The following parameters are required by this class:
92+
- name: The name of the ArchimedeanFamily solid. Options are "Cuboctahedron", \
93+
"Icosidodecahedron", "Truncated Tetrahedron", "Truncated Octahedron", \
94+
"Truncated Cube", "Truncated Icosahedron", "Truncated Dodecahedron", \
95+
"Rhombicuboctahedron", "Rhombicosidodecahedron", "Truncated \
96+
Cuboctahedron", "Truncated Icosidodecahedron", "Snub Cuboctahedron", \
97+
and "Snub Icosidodecahedron".
98+
""",
99+
)
100+
101+
CatalanFamily = TabulatedGSDShapeFamily.from_json_file(
102+
os.path.join(_DATA_FOLDER, "catalan.json"),
103+
classname="CatalanFamily",
104+
docstring="""The family of Catalan solids, also known as Archimedean duals
105+
(13 total).
106+
The following parameters are required by this class:
107+
- name: The name of the CatalanFamily solid. Options are "Deltoidal \
108+
Hexecontahedron", "DeltoidalIcositetrahedron", "Disdyakis \
109+
Dodecahedron", "Disdyakis Triacontahedron", "Pentagonal \
110+
Hexecontahedron", "Pentagonal Icositetrahedron", "Pentakis \
111+
Dodecahedron", "Rhombic Dodecahedron", "Rhombic \
112+
Triacontahedron", "Triakis Octahedron", "Tetrakis \
113+
Hexahedron", "Triakis Icosahedron", and "Triakis Tetrahedron".
114+
""",
115+
)
116+
117+
JohnsonFamily = TabulatedGSDShapeFamily.from_json_file(
118+
os.path.join(_DATA_FOLDER, "johnson.json"),
119+
classname="JohnsonFamily",
120+
docstring="""The family of Johnson solids (92 total).
121+
The following parameters are required by this class:
122+
- name: The name of the JohnsonFamily solid. A full list is available in \
123+
10.1126/science.1220869: :cite:`Damasceno2012`. In general, shape names \
124+
should have the first character of each word capitalized, with spaces \
125+
between words (e.g. "Elongated Triangular Cupola"). Pyramids and \
126+
dipyramids are named from their base polygon (e.g. "Square Pyramid" \
127+
or "Elongated Pentagonal Dipyramid").
128+
""",
129+
)
130+
131+
132+
PyramidDipyramidFamily = TabulatedGSDShapeFamily.from_json_file(
133+
os.path.join(_DATA_FOLDER, "pyramid_dipyramid.json"),
134+
classname="PyramidDipyramidFamily",
135+
docstring="""The family of regular equilateral pyramids and dipyramids (6 total).
136+
The following parameters are required by this class:
137+
- name: The name of the pyramid or dipyramid. Options are "Triangular Pyramid", \
138+
"Square Pyramid", "Pentagonal Pyramid", "Triangular Dipyramid", \
139+
"Square Dipyramid", and "Pentagonal Dipyramid".
140+
""",
141+
)
142+
143+
PrismAntiprismFamily = TabulatedGSDShapeFamily.from_json_file(
144+
os.path.join(_DATA_FOLDER, "prism_antiprism.json"),
145+
classname="PrismAntiprismFamily",
146+
docstring="""The family of n-gonal prisms and antiprisms with n∈[3,10] (16 total).
147+
The following parameters are required by this class:
148+
- name: The name of the prism or antiprism. Options for prisms are \
149+
"Triangular Prism", "Square Prism", "Pentagonal Prism", "Hexagonal Prism", \
150+
"Heptagonal Prism", "Octagonal Prism", "Nonagonal Prism", and \
151+
"Decagonal Prism". Options for antiprisms are "Triangular Antiprism", \
152+
"Square Antiprism", "Pentagonal Antiprism", "Hexagonal Antiprism", \
153+
"Heptagonal Antiprism", "Octagonal Antiprism","Nonagonal Antiprism", \
154+
and "Decagonal Antiprism".
155+
""",
156+
)

0 commit comments

Comments
 (0)