ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 09 Aug 2020 14:34:54 +0200Unexpected intersection between parallel polygons.https://ask.sagemath.org/question/52910/unexpected-intersection-between-parallel-polygons/The `intersection` function returns a non-empty intersection for two polygons that are separated in space.
The following is a reproducible example:
# Define parallel polygons.
a = Polyhedron([[0, -1, 1], [1, -1, 1], [1, 1, -1]])
b = Polyhedron([[0.0, -0.5, 1.5], [1.0, -0.5, 1.5], [1.0, 1.5, -0.5]])
# Intersection.
c = a.intersection(b)
# c ->
# `A 2-dimensional polyhedron in RDF^3 defined as the convex hull of 3
# vertices (use the .plot() method to plot)`
a.plot(fill='green') + b.plot(fill='red') + c.plot(fill='orange')
Fri, 07 Aug 2020 22:00:13 +0200https://ask.sagemath.org/question/52910/unexpected-intersection-between-parallel-polygons/Comment by Emmanuel Charpentier for <p>The <code>intersection</code> function returns a non-empty intersection for two polygons that are separated in space. </p>
<p>The following is a reproducible example: </p>
<pre><code># Define parallel polygons.
a = Polyhedron([[0, -1, 1], [1, -1, 1], [1, 1, -1]])
b = Polyhedron([[0.0, -0.5, 1.5], [1.0, -0.5, 1.5], [1.0, 1.5, -0.5]])
# Intersection.
c = a.intersection(b)
# c ->
# `A 2-dimensional polyhedron in RDF^3 defined as the convex hull of 3
# vertices (use the .plot() method to plot)`
a.plot(fill='green') + b.plot(fill='red') + c.plot(fill='orange')
</code></pre>
https://ask.sagemath.org/question/52910/unexpected-intersection-between-parallel-polygons/?comment=52918#post-id-52918Same here (Sage 9.2.beta7). `c` has the same vertices as `b` :
sage: bool(set(c.vertices())==set(b.vertices()))
True
Curiouser and curiouser :
sage: a.intersection(b).vertices()
(A vertex at (1.0, 1.5, -0.5),
A vertex at (1.0, -0.5, 1.5),
A vertex at (0.0, -0.5, 1.5))
sage: b.intersection(a).vertices()
(A vertex at (1.0, 2.0, -1.0),
A vertex at (0.0, 0.0, 1.0),
A vertex at (1.0, 0.0, 1.0))
I'm tempted to say it's a bug, but I knows *silch* about polyhedra...Sun, 09 Aug 2020 01:09:05 +0200https://ask.sagemath.org/question/52910/unexpected-intersection-between-parallel-polygons/?comment=52918#post-id-52918Comment by slelievre for <p>The <code>intersection</code> function returns a non-empty intersection for two polygons that are separated in space. </p>
<p>The following is a reproducible example: </p>
<pre><code># Define parallel polygons.
a = Polyhedron([[0, -1, 1], [1, -1, 1], [1, 1, -1]])
b = Polyhedron([[0.0, -0.5, 1.5], [1.0, -0.5, 1.5], [1.0, 1.5, -0.5]])
# Intersection.
c = a.intersection(b)
# c ->
# `A 2-dimensional polyhedron in RDF^3 defined as the convex hull of 3
# vertices (use the .plot() method to plot)`
a.plot(fill='green') + b.plot(fill='red') + c.plot(fill='orange')
</code></pre>
https://ask.sagemath.org/question/52910/unexpected-intersection-between-parallel-polygons/?comment=52921#post-id-52921Note: also asked, and answered, on the sage-devel mailing list:
- [sage-devel, 2020-08, Incorrect intersection](https://groups.google.com/d/topic/sage-devel/514hUpM7pBY/discussion)
Now tracked at
- [Sage Trac ticket 30319: Wrong intersection of polytopes](https://trac.sagemath.org/ticket/30319)Sun, 09 Aug 2020 14:34:54 +0200https://ask.sagemath.org/question/52910/unexpected-intersection-between-parallel-polygons/?comment=52921#post-id-52921