# HG changeset patch
# User Jeroen Demeyer <jdemeyer@cage.ugent.be>
# Date 1340717603 7200
# Node ID 451b9a38ead82c9d44b976cdc496a929a8c3cbfa
# Parent 9be990d611b1c5d7cac94f1290c2f064ea2313f9
Rephrase some comments concerning the Delaunay algorithm
diff git a/sage/plot/plot3d/list_plot3d.py b/sage/plot/plot3d/list_plot3d.py
a

b


428  428  y=[float(p[1]) for p in v] 
429  429  z=[float(p[2]) for p in v] 
430  430  
431   corr_matrix=numpy.corrcoef(x,y) 
 431  # If the (x,y)coordinates lie in a onedimensional subspace, the 
 432  # matplotlib Delaunay code segfaults. Therefore, we compute the 
 433  # correlation of the x and ycoordinates and add small random 
 434  # noise to avoid the problem if needed. 
 435  corr_matrix = numpy.corrcoef(x,y) 
 436  if corr_matrix[0,1] > 0.9 or corr_matrix[0,1] < 0.9: 
 437  ep = float(.000001) 
 438  x = [float(p[0]) + random()*ep for p in v] 
 439  y = [float(p[1]) + random()*ep for p in v] 
432  440  
433   if corr_matrix[0,1] > .9 or corr_matrix[0,1] < .9: 
434   # If the x,y coordinates lie in a onedimensional subspace 
435   # The scipy delauney code segfaults 
436   # We compute the correlation of the x and y coordinates 
437   # and add small random noise to avoid the problem 
438   # if it looks like there is an issue 
439  441  
440   ep=float(.000001) 
441   x=[float(p[0])+random()*ep for p in v] 
442   y=[float(p[1])+random()*ep for p in v] 
443   
444   
445   #If the list of data points has two points with the exact same x,y coordinate and different z coordinates 
446   #then scipy sometimes segfaults. The following block checks for this. alternatively the code in the if block 
447   #above which adds random error could be applied to perturb the points, but probably an exception should be raised 
448   #The code also removes duplicate points which scipy can't handle. 
449   
 442  # If the list of data points has two points with the exact same 
 443  # (x,y)coordinate but different zcoordinates, then we sometimes 
 444  # get segfaults. The following block checks for this and raises 
 445  # an exception if this is the case. 
 446  # We also remove duplicate points (which matplotlib can't handle). 
 447  # Alternatively, the code in the if block above which adds random 
 448  # error could be applied to perturb the points. 
450  449  drop_list=[] 
451   
452  450  for i in range(len(x)): 
453  451  for j in range(i+1,len(x)): 
454  452  if x[i]==x[j] and y[i]==y[j]: 