-
Notifications
You must be signed in to change notification settings - Fork 5
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
Dual Shapes for Convex Polyhedra #1
Comments
@bdice could you flesh this out potentially for the hackathon? I agree that this would be a good feature to have. |
@b-butler Here's a starting point. This needs to be tested (with actual tests written) and visually inspected for a few known cases (tetrahedron ↔ tetrahedron, cube ↔ octahedron, dodecahedron ↔ icosahedron). I used the Sample dual generator scriptimport numpy as np
import scipy.spatial
tetrahedron_vertices = [[0.5, 0.5, 0.5],
[-0.5, -0.5, 0.5],
[-0.5, 0.5, -0.5],
[0.5, -0.5, -0.5]]
hull = scipy.spatial.ConvexHull(tetrahedron_vertices)
print(f'Convex Hull Vertices:\n{hull.points}')
print(f'Convex Hull Volume: {hull.volume}')
print(f'Convex Hull Equations:\n{hull.equations}')
dual = scipy.spatial.HalfspaceIntersection(
halfspaces=hull.equations, interior_point=np.zeros(3))
print(f'Dual Vertices:\n{dual.dual_points}')
print(f'Dual Surface Area: {dual.dual_area}')
print(f'Dual Volume: {dual.dual_volume}')
print(f'Dual Equations:\n{dual.dual_equations}')
print(f'Dual Facets: {dual.dual_facets}') Sample dual outputConvex Hull Vertices:
[[ 0.5 0.5 0.5]
[-0.5 -0.5 0.5]
[-0.5 0.5 -0.5]
[ 0.5 -0.5 -0.5]]
Convex Hull Volume: 0.3333333333333334
Convex Hull Equations:
[[-0.57735027 0.57735027 0.57735027 -0.28867513]
[ 0.57735027 -0.57735027 0.57735027 -0.28867513]
[-0.57735027 -0.57735027 -0.57735027 -0.28867513]
[ 0.57735027 0.57735027 -0.57735027 -0.28867513]]
Dual Vertices:
[[-2. 2. 2.]
[ 2. -2. 2.]
[-2. -2. -2.]
[ 2. 2. -2.]]
Dual Surface Area: 55.425625842204084
Dual Volume: 21.33333333333334
Dual Equations:
[[-0.57735027 -0.57735027 0.57735027 -1.15470054]
[ 0.57735027 0.57735027 0.57735027 -1.15470054]
[-0.57735027 0.57735027 -0.57735027 -1.15470054]
[ 0.57735027 -0.57735027 -0.57735027 -1.15470054]]
Dual Facets: [[2, 1, 0], [3, 1, 0], [3, 2, 0], [3, 2, 1]] Additional references: |
@bdice thanks! |
Original report by RoseCers (Bitbucket: RoseCers, ).
The text was updated successfully, but these errors were encountered: