Skip to content

Dual Shapes for Convex Polyhedra #1

Open

Description

@bdice

Original report by RoseCers (Bitbucket: RoseCers, ).


Activity

  1. b-butler commented on Nov 14, 2019

    @b-butler
    Member

    @bdice could you flesh this out potentially for the hackathon? I agree that this would be a good feature to have.

  2. bdice commented on Nov 16, 2019

    @bdice
    MemberAuthor

    @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 scipy.spatial.HalfspaceIntersection code (see here for docs).

    Sample dual generator script

    import 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 output

    Convex 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:

  3. b-butler commented on Nov 16, 2019

    @b-butler
    Member

    @bdice thanks!

  4. self-assigned this
    on Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions