Skip to content

Commit e9efc9c

Browse files
author
Release Manager
committed
Trac #33586: Triangulation.polyhedral_complex, boundary_simplicial_complex, boundary_polyhedral_complex
`polyhedral_complex` creates a geometric polyhedral complex corresponding to the triangulation. `boundary_simplicial_complex` and `boundary_polyhedral_complex` are combinations of `boundary` (which gives a set of simplices) with `simplicial_complex` (which gives an abstract simplicial complex) and `polyhedral_complex`, respectively URL: https://trac.sagemath.org/33586 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): Yuan Zhou, John Palmieri
2 parents 5247961 + 65134f1 commit e9efc9c

File tree

1 file changed

+128
-14
lines changed

1 file changed

+128
-14
lines changed

src/sage/geometry/triangulation/element.py

+128-14
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,21 @@ class Triangulation(Element):
227227
"""
228228
def __init__(self, triangulation, parent, check=True):
229229
"""
230-
The constructor of a ``Triangulation`` object. Note that an
231-
internal reference to the underlying ``PointConfiguration`` is
230+
The constructor of a ``Triangulation`` object.
231+
232+
Note that an internal reference to the underlying ``PointConfiguration`` is
232233
kept.
233234
234235
INPUT:
235236
236237
- ``parent`` -- a
237238
:class:`~sage.geometry.triangulation.point_configuration.PointConfiguration`
238239
239-
- ``triangulation`` -- an iterable of integers or iterable of
240-
iterables (e.g. a list of lists). In the first case, the
241-
integers specify simplices via
242-
:meth:`PointConfiguration.simplex_to_int`. In the second
243-
case, the point indices of the maximal simplices of the
244-
triangulation.
240+
- ``triangulation`` -- an iterable of integers or an iterable of
241+
iterables (e.g. a list of lists), specifying the maximal simplices
242+
of the triangulation. In the first case, each integer specifies a simplex
243+
by the correspondence :meth:`PointConfiguration.simplex_to_int`. In the second
244+
case, a simplex is specified by listing the indices of the included points.
245245
246246
- ``check`` -- boolean. Whether to perform checks that the
247247
triangulation is, indeed, a triangulation of the point
@@ -370,7 +370,7 @@ def __getitem__(self, i):
370370

371371
def __len__(self):
372372
"""
373-
Returns the length of the triangulation.
373+
Return the length of the triangulation.
374374
375375
TESTS::
376376
@@ -572,8 +572,7 @@ def fan(self, origin=None):
572572
@cached_method
573573
def simplicial_complex(self):
574574
r"""
575-
Return a simplicial complex from a triangulation of the point
576-
configuration.
575+
Return ``self`` as an (abstract) simplicial complex.
577576
578577
OUTPUT:
579578
@@ -598,7 +597,7 @@ def simplicial_complex(self):
598597
@cached_method
599598
def _boundary_simplex_dictionary(self):
600599
"""
601-
Return facets and the simplices they bound
600+
Return facets and the simplices they bound.
602601
603602
TESTS::
604603
@@ -675,6 +674,38 @@ def boundary(self):
675674
in self._boundary_simplex_dictionary().items()
676675
if len(bounded_simplices) == 1)
677676

677+
@cached_method
678+
def boundary_simplicial_complex(self):
679+
r"""
680+
Return the boundary of ``self`` as an (abstract) simplicial complex.
681+
682+
OUTPUT:
683+
684+
A :class:`~sage.topology.simplicial_complex.SimplicialComplex`.
685+
686+
EXAMPLES::
687+
688+
sage: p = polytopes.cuboctahedron()
689+
sage: triangulation = p.triangulate(engine='internal')
690+
sage: bd_sc = triangulation.boundary_simplicial_complex()
691+
sage: bd_sc
692+
Simplicial complex with 12 vertices and 20 facets
693+
694+
The boundary of every convex set is a topological sphere, so it has
695+
spherical homology::
696+
697+
sage: bd_sc.homology()
698+
{0: 0, 1: 0, 2: Z}
699+
700+
It is a subcomplex of ``self`` as a :meth:`simplicial_complex`::
701+
702+
sage: sc = triangulation.simplicial_complex()
703+
sage: all(f in sc for f in bd_sc.maximal_faces())
704+
True
705+
"""
706+
from sage.topology.simplicial_complex import SimplicialComplex
707+
return SimplicialComplex(self.boundary(), maximality_check=False)
708+
678709
@cached_method
679710
def interior_facets(self):
680711
"""
@@ -711,6 +742,90 @@ def interior_facets(self):
711742
in self._boundary_simplex_dictionary().items()
712743
if len(bounded_simplices) == 2)
713744

745+
def polyhedral_complex(self, **kwds):
746+
"""
747+
Return ``self`` as a :class:`~sage.geometry.polyhedral_complex.PolyhedralComplex`.
748+
749+
OUTPUT:
750+
751+
A :class:`~sage.geometry.polyhedral_complex.PolyhedralComplex` whose maximal cells
752+
are the simplices of the triangulation.
753+
754+
EXAMPLES::
755+
756+
sage: P = polytopes.cube()
757+
sage: pc = PointConfiguration(P.vertices())
758+
sage: T = pc.placing_triangulation(); T
759+
(<0,1,2,7>, <0,1,5,7>, <0,2,3,7>, <0,3,4,7>, <0,4,5,7>, <1,5,6,7>)
760+
sage: C = T.polyhedral_complex(); C
761+
Polyhedral complex with 6 maximal cells
762+
sage: [P.vertices_list() for P in C.maximal_cells_sorted()]
763+
[[[-1, -1, -1], [-1, -1, 1], [-1, 1, 1], [1, -1, -1]],
764+
[[-1, -1, -1], [-1, 1, -1], [-1, 1, 1], [1, 1, -1]],
765+
[[-1, -1, -1], [-1, 1, 1], [1, -1, -1], [1, 1, -1]],
766+
[[-1, -1, 1], [-1, 1, 1], [1, -1, -1], [1, -1, 1]],
767+
[[-1, 1, 1], [1, -1, -1], [1, -1, 1], [1, 1, 1]],
768+
[[-1, 1, 1], [1, -1, -1], [1, 1, -1], [1, 1, 1]]]
769+
"""
770+
from sage.geometry.polyhedral_complex import PolyhedralComplex
771+
from sage.geometry.polyhedron.constructor import Polyhedron
772+
ambient_dim = self.point_configuration().ambient_dim()
773+
points = self.point_configuration().points()
774+
return PolyhedralComplex([Polyhedron(vertices=[points[i] for i in simplex])
775+
for simplex in self],
776+
ambient_dim=ambient_dim,
777+
maximality_check=False,
778+
face_to_face_check=False,
779+
**kwds)
780+
781+
def boundary_polyhedral_complex(self, **kwds):
782+
r"""
783+
Return the boundary of ``self`` as a :class:`~sage.geometry.polyhedral_complex.PolyhedralComplex`.
784+
785+
OUTPUT:
786+
787+
A :class:`~sage.geometry.polyhedral_complex.PolyhedralComplex` whose maximal cells
788+
are the simplices of the boundary of ``self``.
789+
790+
EXAMPLES::
791+
792+
sage: P = polytopes.cube()
793+
sage: pc = PointConfiguration(P.vertices())
794+
sage: T = pc.placing_triangulation(); T
795+
(<0,1,2,7>, <0,1,5,7>, <0,2,3,7>, <0,3,4,7>, <0,4,5,7>, <1,5,6,7>)
796+
sage: bd_C = T.boundary_polyhedral_complex(); bd_C
797+
Polyhedral complex with 12 maximal cells
798+
sage: [P.vertices_list() for P in bd_C.maximal_cells_sorted()]
799+
[[[-1, -1, -1], [-1, -1, 1], [-1, 1, 1]],
800+
[[-1, -1, -1], [-1, -1, 1], [1, -1, -1]],
801+
[[-1, -1, -1], [-1, 1, -1], [-1, 1, 1]],
802+
[[-1, -1, -1], [-1, 1, -1], [1, 1, -1]],
803+
[[-1, -1, -1], [1, -1, -1], [1, 1, -1]],
804+
[[-1, -1, 1], [-1, 1, 1], [1, -1, 1]],
805+
[[-1, -1, 1], [1, -1, -1], [1, -1, 1]],
806+
[[-1, 1, -1], [-1, 1, 1], [1, 1, -1]],
807+
[[-1, 1, 1], [1, -1, 1], [1, 1, 1]],
808+
[[-1, 1, 1], [1, 1, -1], [1, 1, 1]],
809+
[[1, -1, -1], [1, -1, 1], [1, 1, 1]],
810+
[[1, -1, -1], [1, 1, -1], [1, 1, 1]]]
811+
812+
It is a subcomplex of ``self`` as a :meth:`polyhedral_complex`::
813+
814+
sage: C = T.polyhedral_complex()
815+
sage: bd_C.is_subcomplex(C)
816+
True
817+
"""
818+
from sage.geometry.polyhedral_complex import PolyhedralComplex
819+
from sage.geometry.polyhedron.constructor import Polyhedron
820+
ambient_dim = self.point_configuration().ambient_dim()
821+
points = self.point_configuration().points()
822+
return PolyhedralComplex([Polyhedron(vertices=[points[i] for i in simplex])
823+
for simplex in self.boundary()],
824+
ambient_dim=ambient_dim,
825+
maximality_check=False,
826+
face_to_face_check=False,
827+
**kwds)
828+
714829
@cached_method
715830
def normal_cone(self):
716831
r"""
@@ -798,8 +913,7 @@ def normal_cone(self):
798913

799914
def adjacency_graph(self):
800915
"""
801-
Returns a graph showing which simplices are adjacent in the
802-
triangulation
916+
Return a graph showing which simplices are adjacent in the triangulation.
803917
804918
OUTPUT:
805919

0 commit comments

Comments
 (0)