Skip to content

Use standard Python operators for intersection of polyhedrons and membership testing #14176

@nthiery

Description

@nthiery

The attached patch enables & and in operators for polyhedrons::

            sage: cube = polytopes.n_cube(3)
            sage: oct = polytopes.cross_polytope(3)
            sage: cube.intersection(oct*2)
            A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 12 vertices
            sage: cube & oct*2
            A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 12 vertices
            sage: P = Polyhedron(vertices=[[1,1],[1,-1],[0,0]])
            sage: P.center() in P
            True
            sage: [-1,-1] in P
            False

CC: @sagetrac-sage-combinat

Component: geometry

Author: Nicolas M. Thiéry

Reviewer: Volker Braun

Merged: sage-5.8.beta2

Issue created by migration from https://trac.sagemath.org/ticket/14176

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions