# HG changeset patch
# User Jason Grout <jasonsage@creativetrax.com>
# Date 1207730743 18000
# Node ID f18d3a3a19d2957354277a18a94b4d7c26bb2f83
# Parent 38f4b4ba3dd854e3fa30843703bc162dde901849
[mq]: trac2859arrow3d.patch
diff r 38f4b4ba3dd8 r f18d3a3a19d2 sage/modules/free_module_element.pyx
a

b


753  753  INPUT: 
754  754  
755  755  plot_type  (default: 'arrow' if v has 3 or fewer components, 
756   otherwise 'step') type of plot. Options are 'arrow' to an 
 756  otherwise 'step') type of plot. Options are 'arrow' to draw an 
757  757  arrow; 'point' to draw a point at the coordinates 
758  758  specified by the vector; 'step' to draw a step function 
759  759  representing the coordinates of the vector. Both 'arrow' 
diff r 38f4b4ba3dd8 r f18d3a3a19d2 sage/plot/plot3d/shapes.pyx
a

b


339  339  1 
340  340  sage: type(a.all[0]) 
341  341  <type 'sage.plot.plot3d.shapes.Cone'> 
 342  
 343  Arrows are always constructed pointing up in the z direction from 
 344  the origin, and then rotated/translated into place. This works for 
 345  every arrow direction except the z direction. We take care of the 
 346  anomoly by testing to see if the arrow should point in the z 
 347  direction, and if it should, just scaling the constructed arrow by 
 348  1 (i.e., every point is sent to its negative). The scaled arrow 
 349  then points downwards. The doctest just tests that the scale of 1 
 350  is applied to the arrow. 
 351  
 352  sage: a = arrow3d((0,0,0), (0,0,1)) 
 353  sage: a.all[0].get_transformation().transform_point((0,0,1)) 
 354  (0.0, 0.0, 1.0) 
342  355  """ 
343  356  if radius is None: 
344  357  radius = thickness/50.0 
… 
… 

358  371  + Cone(head_radius, head_len, **kwds).translate(0, 0, lengthhead_len) 
359  372  axis = zaxis.cross_product(diff) 
360  373  if axis == 0: 
361   return arrow.translate(start) 
 374  if diff[2] >= 0: 
 375  return arrow.translate(start) 
 376  else: 
 377  return arrow.scale(1).translate(start) 
362  378  else: 
363  379  theta = acos(diff[2]/length) 
364  380  return arrow.rotate(axis, theta).translate(start) 