Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
check sign of circumcenter using all vertices of simplex
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Jan 31, 2020
1 parent 2cbd93e commit 3f9cc75
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2819,6 +2819,19 @@ def is_inscribed(self, certificate=False):
....: [+1, 0, 0, 0]])
sage: P.is_inscribed()
True
We check that :trac:`29125` is fixed::
sage: P = Polyhedron(vertices=[[-2,-1], [-2,1], [0,-1], [0,1]], backend='field')
sage: P.is_inscribed()
True
sage: V = P.Vrepresentation()
sage: H = P.Hrepresentation()
sage: parent = P.parent()
sage: for V1 in Permutations(V):
....: P1 = parent._element_constructor_(
....: [V1, [], []], [H, []], Vrep_minimal=True, Hrep_minimal=True)
....: assert P1.is_inscribed()
"""

if not self.is_compact():
Expand Down Expand Up @@ -2863,8 +2876,8 @@ def is_inscribed(self, certificate=False):
squared_circumradius = (sum(m**2 for m in minors) - 4 * a * c) / (4*a**2)

# Checking if the circumcenter has the correct sign
test_vector = vertex.vector() - circumcenter
if sum(i**2 for i in test_vector) != squared_circumradius:
if not all(sum(i**2 for i in v.vector() - circumcenter) == squared_circumradius
for v in vertices if v in simplex_vertices):
circumcenter = - circumcenter

is_inscribed = all(sum(i**2 for i in v.vector() - circumcenter) == squared_circumradius
Expand Down

0 comments on commit 3f9cc75

Please sign in to comment.