%script to plot the Rickard's triangular grid
%Rickard, M. J., 1971, A classification diagram for fold 
%orientations: Geological Magazine, v. 108(1), p. 23-26.
%Basic coordinate system comes from Middleton's triplot.m
%Written by JRA 7/1/03, modified by DMR 7/10/03

clf
xscale = 2/sqrt(3);
x = [0 xscale/2 xscale 0];        % define coordinates of apices
y = [-1 0 -1 -1];
plot(x,y,'k-','LineWidth',0.5);   % plot triangle
axis('equal');
axis off
hold on

%DIP of axial plane:
for i = 1:8
   x1 = i*xscale/18;                    
   x2 = (18-i)*xscale/18;
   x3 = i*xscale/9;
   xx3 = [x3 (xscale/2 + x1)];
   y2 = -i/9;
   yy3 = [-1 y2];
   plot(xx3,yy3,'k-','LineWidth',0.25);
   s = sprintf('%d\n',(90-i*10));
   text((x3),-1.05,s) 
end   
text(xscale/2, -1.1,'Axial Plane Dip','HorizontalAlignment','center')

%PITCH of axis:
for i = 1:8
   x1 = i*xscale/18;
   y1 = -1 + i/9;
   xx1=[x1 xscale];
   yy1=[y1 -1];
   plot(xx1,yy1,'k-','LineWidth',0.25);
   s = sprintf('%d\n',(i*10));
   text((x1-0.05),y1,s)
end   
text((xscale/4)-0.1,-0.5,'Pitch','HorizontalAlignment','center','Rotation',60)

%PLUNGE of axis: sin(rake) = sin(plunge)/sin(dip)
for plunge=10:10:80;
   locx=[];
   locy=[];
   for dip = plunge:0.25:90 %step <0.5 to smooth curves (but big file)
      rake = asin(sin(plunge*pi/180)./sin(dip*pi/180))*180/pi;
      loc = pt(dip,rake);
      locx = [locx loc(1)];
      locy = [locy loc(2)];   
      if dip == plunge
         s = sprintf('%d\n',plunge);
         text(loc(1), loc(2), s)
      end
   end   
   plot(locx,locy,'k-','LineWidth',0.25)
end
text(((3/4).*xscale+0.1),-0.5,'Plunge','HorizontalAlignment','center','Rotation',-60)

print -depsc rickard.eps 