#4875: Polyhedron.show(fill=True) fails
-----------------------+----------------------------------------------------
 Reporter:  abergeron  |       Owner:  was       
     Type:  defect     |      Status:  new       
 Priority:  major      |   Milestone:  sage-3.4.1
Component:  graphics   |    Keywords:            
-----------------------+----------------------------------------------------
Changes (by wcauchois):

 * cc: wcauchois (added)


Comment:

 This bug was hard to track down! But I believe the root cause is in
 Polyhedron.render_solid(), when the method gives invalid faces to
 IndexFaceSet. This causes issues later on, inside IndexFaceSet, when
 certain CPython methods with little to no error checking index into those
 faces.

 These faces are incorrect because
 Polyhedron.triangulated_facial_incidences() does not properly triangulate
 the facial incidences. Look at this:

 {{{
 sage: Polyhedron(vertices = [[1, 2, 3], [0,1,0],
 [1,1,1]]).triangulated_facial_incidences()
 [[0, [0, 2]], [1, [0, 1]], [2, [1, 2]]]
 }}}

 Triangles in 3-space should consist of 3 vertices, not 2!

 triangulated_facial_incidences() naively handles the case where
 `vert_number != self.dim()` (see polyhedra.py:678) by simply appending the
 original facial incidence.

 The output from facial_incidences() looks like this:

 {{{
 sage: Polyhedron(vertices = [[1, 2, 3], [0,1,0],
 [1,1,1]]).facial_incidences()
 [[0, [0, 2]], [1, [0, 1]], [2, [1, 2]]]
 }}}

 Just FYI, the facial incidences are computed using cddlib. Here's a log of
 Sage's interaction with cddlib:

 {{{
 sage: P = Polyhedron(vertices = [[1, 2, 3], [0,1,0], [1,1,1]])
 sage: vert_to_ieq(P._vertices, rays=P._rays, cdd_type=P._cdd_type,
 verbose=True)
 V-representation
 begin
 3 4 rational
 1 1 2 3
 1 0 1 0
 1 1 1 1
 end


 Input is a V-representation
 H-representation
 linearity 1  4
 begin
  4 4 rational
  1 -1 0 0
  1 1 -1 0
  -1 0 1 0
  2 -1 -2 1
 end

 V-representation
 begin
  3 4 rational
  1 1 2 3
  1 0 1 0
  1 1 1 1
 end

 Here is the incidence list:
 begin
   4    3
  1 2 : 1 3
  2 2 : 1 2
  3 2 : 2 3
  4 3 : 1 2 3
 end

 Here is the adjacency list:
 begin
   4    4
  1 2 : 2 3
  2 2 : 1 3
  3 2 : 1 2
  4 0 :
 end

 A Polyhedron with 3 vertices.
 }}}

 I would love to fix this bug, but unfortunately I don't have the
 mathematical knowledge to improve triangulated_facial_incidences().
 Hopefully now that the source of the bug is clear, someone with more
 intimate knowledge of polyhedra can fix it!

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4875#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to