#4465: zero-length errors give division error instead of just drawing a point.
----------------------+-----------------------------------------------------
 Reporter:  jason     |       Owner:  was     
     Type:  defect    |      Status:  new     
 Priority:  major     |   Milestone:  sage-3.2
Component:  graphics  |    Keywords:          
----------------------+-----------------------------------------------------
 This is an error to a custom patch that we have to the matplotlib code so
 that we can have arrows that are shortened by a certain number of points.

 {{{
 This week, I was drawing plot vector field using two ways : (1)
 plot_vector_field and (2) by simply suming up plenty of arrows as I
 wished. Since their was a fixed point somewhere, I came up with the
 problem of drawing a zero length arrow. Using sage 3.1.4, I get a zero
 division error. Where is this division from? The example below show that
 it is not from the slope as it can draw a vertical arrow.

 sage: arrow((1, 1), (2, 1))
 sage: arrow((1, 1), (1, 2))
 sage: arrow((1, 1), (1, 1))
 ---------------------------------------------------------------------------
 ZeroDivisionError                         Traceback (most recent call
 last) :
 ...
 /home/slabbe/sage/local/lib/python2.5/site-
 packages/matplotlib/arrow_line.pyc in draw(self, renderer)
     100         pixel_vector = (orig_t.transform_point(points[1]) -
 orig_t.transform_point(points[0]))
     101         pixel_length=math.sqrt(sum(pixel_vector**2))
 --> 102         clip_fraction =
 renderer.points_to_pixels(self._arrowshorten)/pixel_length
     103         head_clip_fraction =
 
renderer.points_to_pixels(self._arrowshorten+self._arrowheadlength*0.8)/pixel_length
     104

 ZeroDivisionError: float division

 In my problem, I would have been happy if arrow(x,x) would draw simply a
 point. I know I can define my own arrow but maybe sage's arrow could
 behave like myarrow ?
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4465>
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