# HG changeset patch
# User Volker Braun <vbraun@stp.dias.ie>
# Date 1333047604 3600
# Node ID b761d33b069327daef5c241ff5041606972c4881
# Parent fb63d3700b566a500926c2f34be80c16399e2a0d
Trac #11763: relax typechecks
Some plotting commands needlessly require that the
input is a Python list. This patch relaxes typechecks
to allow arbitrary iterables.
diff git a/sage/plot/plot3d/shapes2.py b/sage/plot/plot3d/shapes2.py
a

b


984  984  
985  985  INPUT: 
986  986  
 987   ``v``  a point or list of points 
987  988  
988    ``v``  a point or list of points 
989   
990    ``size``  (default: 5) size of the point (or 
 989   ``size``  (default: 5) size of the point (or 
991  990  points) 
992  991  
993    ``color``  a word that describes a color 
 992   ``color``  a word that describes a color 
994  993  
995    ``rgbcolor``  (r,g,b) with r, g, b between 0 and 1 
 994   ``rgbcolor``  (r,g,b) with r, g, b between 0 and 1 
996  995  that describes a color 
997  996  
998    ``opacity``  (default: 1) if less than 1 then is 
 997   ``opacity``  (default: 1) if less than 1 then is 
999  998  transparent 
1000  999  
1001   
1002  1000  EXAMPLES:: 
1003  1001  
1004  1002  sage: sum([point3d((i,i^2,i^3), size=5) for i in range(10)]) 
1005  1003  
1006   We check to make sure this works with vectors:: 
 1004  We check to make sure this works with vectors and other iterables 
1007  1005  
1008  1006  sage: pl = point3d([vector(ZZ,(1, 0, 0)), vector(ZZ,(0, 1, 0)), (1, 1, 0)]) 
1009   sage: p = point(vector((2,3,4))) 
1010   sage: print p 
 1007  sage: print point(vector((2,3,4))) 
1011  1008  Graphics3d Object 
1012   
 1009  
 1010  sage: c = polytopes.n_cube(3) 
 1011  sage: v = c.vertices()[0]; v 
 1012  A vertex at (1, 1, 1) 
 1013  sage: print point(v) 
 1014  Graphics3d Object 
1013  1015  
1014  1016  We check to make sure the options work:: 
1015  1017  
1016  1018  sage: point3d((4,3,2),size=20,color='red',opacity=.5) 
1017   
1018  1019  """ 
1019   if (isinstance(v,(list,tuple)) or is_Vector(v)) and len(v) == 3 and not (isinstance(v[0],(list,tuple)) or is_Vector(v[0])): 
 1020  if len(v) == 3 and v[0] in RDF: 
1020  1021  return Point(v, size, **kwds) 
1021  1022  else: 
1022  1023  A = sum([Point(z, size, **kwds) for z in v]) 