
clear all, clc

typen=input('Ge typ: 1,2,3,4,5,6: ');

switch typen
    case 1
        rubrik='Natalina'; A=25; a=12; b=16; n=40; m=80; vw=[-19 30];
        alpha=80*pi/180; beta=40*pi/180; phi=55*pi/180; mu=10*pi/180; omega=30*pi/180;
        ta=-2*pi; tb=4*pi; sa=-270*pi/180; sb=80*pi/180;
    case 2
        rubrik='Turritella'; A=22.2; a=1.3; b=1.5; n=80; m=300; vw=[34 -2];
        alpha=88.9*pi/180; beta=4*pi/180; phi=55*pi/180; mu=1*pi/180; omega=-2*pi/180;
        ta=-35*pi; tb=4*pi; sa=-270*pi/180; sb=40*pi/180;
    case 3
        rubrik='Oxystele'; A=47; a=40; b=19; n=100; m=300; vw=[34 -2];
        alpha=85*pi/180; beta=7*pi/180; phi=-36*pi/180; mu=1*pi/180; omega=2*pi/180;
        ta=-20*pi; tb=4*pi; sa=-700*pi/180; sb=70*pi/180;
    case 4
        rubrik='Nautilus'; A=2; a=2; b=1.5; n=40; m=80; vw=[32 26];
        alpha=80*pi/180; beta=490*pi/180; phi=0*pi/180; mu=0*pi/180; omega=0*pi/180;
        ta=1*pi; tb=4*pi; sa=-170*pi/180; sb=170*pi/180;
    case 5
        rubrik='Planorbis'; A=45; a=20; b=30; n=80; m=300; vw=[-3 30];
        alpha=84*pi/180; beta=85*pi/180; phi=10*pi/180; mu=145*pi/180; omega=35*pi/180;
        ta=-15*pi; tb=4*pi; sa=-150*pi/180; sb=130*pi/180;
    case 6
        rubrik='Conus'; A=7; a=4.3; b=1; n=100; m=400; vw=[34 -2];
        alpha=87*pi/180; beta=7*pi/180; phi=78*pi/180; mu=0*pi/180; omega=0*pi/180;
        ta=-16*pi; tb=44*pi; sa=-180*pi/180; sb=2*pi/180;
    otherwise
        disp('Inget giltigt typ. Ge typ: 1,2,3,4,5,6'); break
end

clf
[S,T]=meshgrid(linspace(sa,sb,n),linspace(ta,tb,m));
R=1./sqrt(cos(S).^2/a^2+sin(S).^2/b^2); Q=exp(T.*cot(alpha));
X=( A.*sin(beta).*cos(T)+R.*cos(S+phi).*cos(T+omega)-R.*sin(mu).*sin(S+phi).*sin(T+omega)).*Q;
Y=(-A.*sin(beta).*sin(T)-R.*cos(S+phi).*sin(T+omega)-R.*sin(mu).*sin(S+phi).*cos(T+omega)).*Q;
Z=(-A.*cos(beta)+R.*sin(S+phi).*cos(mu)).*Q;

surf(X,Y,Z)
axis equal tight off vis3d, rotate3d on, view(vw)
shading interp % flat, interp, faceted
camlight right % left, right, headlight
lighting phong % none, flat, phong, gouraud
material shiny % shiny, dull, metal
colormap(pink)
title(rubrik)

