#4182: [with patch, needs review] plot3d fails with 'IndexError: list index out 
of
range'
------------------------+---------------------------------------------------
 Reporter:  jhpalmieri  |        Owner:  was     
     Type:  defect      |       Status:  new     
 Priority:  minor       |    Milestone:  sage-3.2
Component:  graphics    |   Resolution:          
 Keywords:              |  
------------------------+---------------------------------------------------
Changes (by jhpalmieri):

  * summary:  plot3d fails with 'IndexError: list index out of range' =>
              [with patch, needs review] plot3d fails with
              'IndexError: list index out of range'

Comment:

 Here's a patch.  I was getting an index error in the last line in this
 code snippet:
 {{{
                 span = len(texture) / (max_z - min_z)    # max to avoid
 dividing by 0
             parts = P.partition(lambda x,y,z: int((z-min_z)*span))
         all = []
         for k, G in parts.iteritems():
             G.set_texture(texture[k], opacity=opacity)
 }}}
 The function g(x,y) described above is discontinuous at various places,
 and I think this was making the {{{k}}} in the last line of this snippet
 equal to 128 while {{{len(texture)}}} was also 128. Changing the
 definition of {{{span}}} in the first line, as this patch does, I hope
 should make {{{k}}} always strictly less than {{{len(texture)}}}.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4182#comment:1>
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