+ "source": "# Example: Adding 3-cells to create a tetrahedron\\nK_tetra = EmbeddedCW() # Still works - now creates EmbeddedComplex\\n\\n# Add tetrahedron vertices\\ntetra_vertices = {\\n 'A': [0, 0, 0],\\n 'B': [1, 0, 0],\\n 'C': [0.5, 0.866, 0],\\n 'D': [0.5, 0.289, 0.816]\\n}\\n\\nfor name, coord in tetra_vertices.items():\\n K_tetra.add_node(name, coord)\\n\\n# Add all edges\\nfrom itertools import combinations\\nfor edge in combinations(['A', 'B', 'C', 'D'], 2):\\n K_tetra.add_edge(*edge)\\n\\n# Add all triangular faces (2-cells)\\nfor face in combinations(['A', 'B', 'C', 'D'], 3):\\n K_tetra.add_face(list(face)) # Using the familiar add_face method\\n\\n# NEW: Add the 3-cell (volume)\\nK_tetra.add_cell(['A', 'B', 'C', 'D'], dim=3)\\n\\nprint(f\\\"Tetrahedron complex:\\\")\\nprint(f\\\" 0-cells (vertices): {len(K_tetra.nodes())}\\\")\\nprint(f\\\" 1-cells (edges): {len(K_tetra.edges())}\\\")\\nprint(f\\\" 2-cells (faces): {len(K_tetra.faces)}\\\")\\nprint(f\\\" 3-cells (volumes): {len(K_tetra.cells[3])}\\\")\\n\\n# Plot the tetrahedron\\nfig = plt.figure(figsize=(8, 6))\\nax = fig.add_subplot(111, projection='3d')\\nK_tetra.plot(ax=ax, face_alpha=0.3, node_size=100)\\nax.set_title('Tetrahedron with 3-cell')\\nplt.show()\\n\\n# Compute ECT (now includes the 3-cell in the calculation!)\\nect_tetra = ECT(num_dirs=20, num_thresh=30)\\nresult_tetra = ect_tetra.calculate(K_tetra)\\nresult_tetra.plot()\\nplt.title('ECT of Tetrahedron (includes 3-cell contribution)')\\nplt.show()\"",
0 commit comments