function points = stanfordpoints(incr1, incr2, incr3, plotit, d1, d2, LINKLENGTH3)
%usage - p = stanfordpoints(15,15,1) to generate points and plot result
%usage - p = stanfordpoints(15,15,1,0) to generate points and not plot result

  if nargin < 5
    d1 = 10;
  end
  if nargin < 6
    d2 = 4;
  end
  if nargin < 7      
    LINKLENGTH3 = 10;
  end
  
  
  points = [];
  if nargin() < 4
      plotit = 1;
  end
  
  for i=0:incr1:360
    for j=0:incr2:360
       for k=0:incr3:LINKLENGTH3
          t1=i*(pi/180.0);
          t2=j*(pi/180.0);
          d3=k;
          x=cos(t1)*sin(t2)*d3-sin(t1)*d2;
          y=sin(t1)*sin(t2)*d3+cos(t1)*d2;
          z=cos(t2)*d3+d1;
          points(end + 1,:) = [x, y ,z];
       end
     end
  end
   
  if plotit
      scatter3(points(:,1), points(:,2), points(:,3));
  end
 end    
    
