
function [aeM,reM,XW,nodes]=demo_cub_sphpgon0(domain_type,nV,function_typeV)

%--------------------------------------------------------------------------
% OBJECT:
% Demo of cubature over spherical triangles, in which the domains are
% coarse approximation of continents.
%--------------------------------------------------------------------------
% INPUT:
%
% domain_type     Define spherical polygon. Input values in "define_domain"
%                 0: Polygonal cap at North-Pole.
%                 1: Cardioid at North-Pole.
%                 2. Coarse Australia (no Tasmania, via data).
%                 3. Coarse Australia (no Tasmania, via polyshape).
%
% nV              Array that defines the algebraic degree of precision to
%                 be examined.
%
% function_type    Array that defines the functions to test:
%
% case 1, f=@(x,y,z) 1+x+y.^2+x.^2.*y+x.^4+y.^5+x.^2.*y.^2.*z.^2;
% case 2, f=@(x,y,z) cos(10*(x+y+z));
% case 3  x0=0; y0=0; z0=1;
%         g=@(x,y,z) (x-x0).^2 + (y-y0).^2 + (z-z0).^2;
%         f=@(x,y,z) exp( - g(x,y,z) );
% case 4  centroid=sum(vertices,1); centroid=centroid/norm(centroid);
%         x0=centroid(1); y0=centroid(2); z0=centroid(3);
%         g=@(x,y,z) (x-x0).^2 + (y-y0).^2 + (z-z0).^2;
%         f=@(x,y,z) exp( - g(x,y,z) );
% case 5  x0=0; y0=0; z0=1;
%         f=@(x,y,z) ((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2);
% case 6  centroid=sum(vertices,1); centroid=centroid/norm(centroid);
%         x0=centroid(1); y0=centroid(2); z0=centroid(3);
%         f=@(x,y,z) ((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2);
%--------------------------------------------------------------------------
% OUTPUT:
% aeM, reM      Estimated cubature absolute and relative errors.
%         Their component (i,j) is the abs./rel. error on integration the
%         "j"-th integral by our formula at degree "degV(i)".
%--------------------------------------------------------------------------
% Information:
% Authors: A. Sommariva and M. Vianello.
% Update: January 12, 2022.
%--------------------------------------------------------------------------
%% Copyright (C) 2021
%% Alvise Sommariva, Marco Vianello.
%%
%% This program is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2 of the License, or
%% (at your option) any later version.
%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
%%
%% Authors:
%% Alvise Sommariva, Marco Vianello.
%%
%% Date: JULY 13, 2021
%% Relevant update: January 12, 2022.
%--------------------------------------------------------------------------

%--------------------------------------------------------------------------
% Define spherical polygon. Input values in "define_domain":
%                 0: Polygonal cap at North-Pole.
%                 1: Cardioid at North-Pole.
%                 2. Coarse Australia (no Tasmania, via data).
%                 3. Coarse Australia (no Tasmania, via polyshape).
%--------------------------------------------------------------------------
if nargin < 1, domain_type=4; end


%--------------------------------------------------------------------------
% Define algebraic degree of precision.
%--------------------------------------------------------------------------
if nargin < 2, nV=1:4; end

%--------------------------------------------------------------------------
% Define function to test.
% case 1, f=@(x,y,z) 1+x+y.^2+x.^2.*y+x.^4+y.^5+x.^2.*y.^2.*z.^2;
% case 2, f=@(x,y,z) cos(10*(x+y+z));
% case 3  x0=0; y0=0; z0=1;
%         g=@(x,y,z) (x-x0).^2 + (y-y0).^2 + (z-z0).^2;
%         f=@(x,y,z) exp( - g(x,y,z) );
% case 4  centroid=sum(vertices,1); centroid=centroid/norm(centroid);
%         x0=centroid(1); y0=centroid(2); z0=centroid(3);
%         g=@(x,y,z) (x-x0).^2 + (y-y0).^2 + (z-z0).^2;
%         f=@(x,y,z) exp( - g(x,y,z) );
% case 5  x0=0; y0=0; z0=1;
%         f=@(x,y,z) ((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2);
% case 6  centroid=sum(vertices,1); centroid=centroid/norm(centroid);
%         x0=centroid(1); y0=centroid(2); z0=centroid(3);
%         f=@(x,y,z) ((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2);
%--------------------------------------------------------------------------
if nargin < 1,function_typeV=1:6; end



% .................. Numerical code starts here ...........................

[vertices,domain_str]=define_domain(domain_type);



% A. Compute all the exact integrals "I(k)" by adaptive code.

for k=1:length(function_typeV)

    function_type=function_typeV(k);

    % 3. Test integral quality on a function vs adaptive code.
    [f,fs]=define_function(function_type,vertices);

    % 3a. Integration by adaptive code.
    tol=10^(-12);
    [I(k),Ierr,flag,Ihigh,iters]=adaptive_cub_sphpgon(vertices,f,tol);

end


fprintf('\n \t Algebraic rules');
% B. Determine rule over sph. polygon with algebraic degree of prec. and
%    evaluate each integral as well as its errors.

for j=1:length(nV)

    n=nV(j);
    XW=cub_sphpgon(n,vertices);

    % 2. Caratheodory-Tchakaloff compression
    [nodes,w,momerr,dbox]=dCATCHsph(n,XW(:,1:3),XW(:,4));

    for k=1:length(function_typeV)

        function_type=function_typeV(k);

        % 3. Test integral quality on a function vs adaptive code.
        [f,fs]=define_function(function_type,vertices);


        % 3b. Integration by rule.
        fnodes=feval(f,nodes(:,1),nodes(:,2),nodes(:,3));
        I0=w'*fnodes;

        % 3c. Cubature errors.
        aeM(j,k)=abs(I0-I(k));
        if abs(I(k)) > 0,
            reM(j,k)=abs(I0-I(k))/abs(I(k));
        else
            reM(j,k)=NaN;
        end

    end

end


























function [f,fs]=define_function(function_type,parms)

%--------------------------------------------------------------------------
% Object:
% This routine, defines a function "f" to approximate and a string "fs" for
% possible messages to the user.
%--------------------------------------------------------------------------
% Input:
% function_type: determines the function to study.
% The first five functions has been used in the paper mentioned below.
%
% case 1, f=@(x,y,z) 1+x+y.^2+x.^2.*y+x.^4+y.^5+x.^2.*y.^2.*z.^2;
% case 2, f=@(x,y,z) cos(10*(x+y+z));
% case 3  x0=0; y0=0; z0=1;
%         g=@(x,y,z) (x-x0).^2 + (y-y0).^2 + (z-z0).^2;
%         f=@(x,y,z) exp( - g(x,y,z) );
% case 4  centroid=sum(vertices,1); centroid=centroid/norm(centroid);
%         x0=centroid(1); y0=centroid(2); z0=centroid(3);
%         g=@(x,y,z) (x-x0).^2 + (y-y0).^2 + (z-z0).^2;
%         f=@(x,y,z) exp( - g(x,y,z) );
% case 5  x0=0; y0=0; z0=1;
%         f=@(x,y,z) ((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2);
% case 6  centroid=sum(vertices,1); centroid=centroid/norm(centroid);
%         x0=centroid(1); y0=centroid(2); z0=centroid(3);
%         f=@(x,y,z) ((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2);
%--------------------------------------------------------------------------
% Output:
% f: defines a function "f" to approximate;
% fs: string with the content of the function "f".
%--------------------------------------------------------------------------
% Reference paper:
% A. Sommariva and M. Vianello
% Numerical hyperinterpolation overspherical triangles
%--------------------------------------------------------------------------

if nargin < 2
    vertices=[0 0 1; 1 0 0; 0 1 0];
else
    vertices=parms;
end

% ... centroid computation ...
ok_vertices=find( isnan(vertices(:,1))== 0 & ...
    isnan(vertices(:,2)) == 0 );
vertices=vertices(ok_vertices,:);
centroid=sum(vertices,1); centroid=centroid/norm(centroid);
x0=centroid(1); y0=centroid(2); z0=centroid(3);

switch function_type
    case 1 % Fornberg
        f=@(x,y,z) 1+x+y.^2+x.^2.*y+x.^4+y.^5+x.^2.*y.^2.*z.^2;
        fs='1+x+y.^2+x.^2.*y+x.^4+y.^5+x.^2.*y.^2.*z.^2';

    case 2
        f=@(x,y,z) cos(10*(x+y+z));
        fs='cos(10*(x+y+z))';

    case 3 % exp and - square pointt distance

        g=@(x,y,z) (x-x0).^2 + (y-y0).^2 + (z-z0).^2;
        f=@(x,y,z) sin( - g(x,y,z) );
        fs='exp(-g(x,y,z)), g=@(x,y,z) (x-x0).^2+(y-y0).^2+(z-z0).^2';

    case 4 % exp and - square point distance


        % ... function ...
        g=@(x,y,z) (x-x0).^2 + (y-y0).^2 + (z-z0).^2;
        f=@(x,y,z) exp( - g(x,y,z) );
        fs='exp(-g(x,y,z)), g=@(x,y,z) (x-x0).^2+(y-y0).^2+(z-z0).^2';

        % ... output string ...
        x0str=num2str(x0,'%1.3e');
        y0str=num2str(y0,'%1.3e');
        z0str=num2str(z0,'%1.3e');
        fs='exp(-g(x,y,z)), g=@(x,y,z) (x-x0).^2+(y-y0).^2+(z-z0).^2';
        fs=strcat(fs,'  centroid=(',x0str,',',y0str,',',z0str,')');

    case 5 % point distance like

        f=@(x,y,z) ((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(3/2);
        fs='((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2), x0=0; y0=0; z0=1;';

    case 6 % point distance like


        % ... function ...

        f=@(x,y,z) ((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2);

        % ... output string ...
        x0str=num2str(x0,'%1.3e');
        y0str=num2str(y0,'%1.3e');
        z0str=num2str(z0,'%1.3e');
        fs='((x-x0).^2 + (y-y0).^2 + (z-z0).^2).^(5/2), ';
        fs=strcat(fs,'  centroid=(',x0str,',',y0str,',',z0str,')');

end  % end: "define_function"









function [vertices,domain_str]=define_domain(example)

%--------------------------------------------------------------------------
% Object:
% This routine, defines the domain to analyse.
%--------------------------------------------------------------------------
% Input:
% example: determines the spherical triangle domain to be analysed. From 0
%   to 7, going from large domains to tiny ones (the higher "example", the
%   smaller the domain.
%--------------------------------------------------------------------------
% Output:
% vertices: it is a matrix whose rows are the vertices of the spherical
%           triangles.
% domain_str: string that stores the geometry of the region.
%--------------------------------------------------------------------------


switch example

    case 0
        % Define spherical polygon.
        factor=0.5;
        t=linspace(0,2*pi,10); t=(t(1:end-1))';
        XV=factor*cos(t); YV=factor*sin(t); ZV=sqrt(1-XV.^2-YV.^2);
        % Note: spherical polygon (first vertices not equal to last).
        vertices=[XV YV ZV];

        domain_str='Polygonal cap at North-Pole';

    case 1

        spec_settings=32;
        th=linspace(0,2*pi,spec_settings+1);
        %th=(th(1:end-1))';
        polygon_sides=[cos(th').*(1-cos(th')) sin(th').*(1-cos(th'))];
        polygon_sides=polygon_sides(1:end-1,:);
        XV=polygon_sides(:,1); XV=XV/2.1;
        YV=polygon_sides(:,2); YV=YV/2.1;
        ZV=sqrt(1-XV.^2-YV.^2);
        vertices=[XV YV ZV];

        domain_str='Polygonal cardioid at North-Pole';

    case 2

        % Australia island vertices in degrees.
        % Column 1: Longitude. Column 2: Latitude.
        vertices_degs=100*[1.462300280000000  -0.386970830000000
            1.451162780000000  -0.381483330000000
            1.396121110000000  -0.361567220000000
            1.385678610000000  -0.348266670000000
            1.374529440000000  -0.349083330000000
            1.359337220000000  -0.345341940000000
            1.340596110000000  -0.329141390000000
            1.235266670000000  -0.339379720000000
            1.150004170000000  -0.335283610000000
            1.131528610000000  -0.261491940000000
            1.142312220000000  -0.263158890000000
            1.168041670000000  -0.205237780000000
            1.221729170000000  -0.172633330000000
            1.239712780000000  -0.168258330000000
            1.243913060000000  -0.163392220000000
            1.252495830000000  -0.155816670000000
            1.259183610000000  -0.146770830000000
            1.268749720000000  -0.137471390000000
            1.283721390000000  -0.154966940000000
            1.292900000000000  -0.148620830000000
            1.303179720000000  -0.133733330000000
            1.308121390000000  -0.124083330000000
            1.317678890000000  -0.113258330000000
            1.347483890000000  -0.119512500000000
            1.360166940000000  -0.124987780000000
            1.359095560000000  -0.132850000000000
            1.395983610000000  -0.175387780000000
            1.415862220000000  -0.125583610000000
            1.437729170000000  -0.143991940000000
            1.462604440000000  -0.188633890000000
            1.500416670000000  -0.221254170000000
            1.531929440000000  -0.259316940000000
            1.525429440000000  -0.324442220000000
            1.499796110000000  -0.375050560000000
            1.462300280000000  -0.386970830000000];

        % Australia island vertices in radians.
        longitudes=deg2rad(vertices_degs(:,1));
        latitudes=deg2rad(vertices_degs(:,2));

        % Australia island vertices in cartesian coordinates.
        [XX,YY,ZZ] = sph2cart(longitudes,latitudes,1);
        vertices=[XX YY ZZ];

        domain_str='Australia as island (33 vertices, via data)';

    case 3


        % Australia island (no Tasmania), vertices in degrees.
        % Column 1: Longitude. Column 2: Latitude.
        % Planar domain in polyshape form.
        australia_pshape=coastline_australia(0);
        vertices_degs=australia_pshape.Vertices;

        % Australia & Tasmania vertices in radians.
        longitudes=deg2rad(vertices_degs(:,1));
        latitudes=deg2rad(vertices_degs(:,2));

        % Australia & Tasmania vertices in cartesian coordinates.
        [XX,YY,ZZ] = sph2cart(longitudes,latitudes,1);
        vertices=[XX YY ZZ];

        domain_str='Australia as island (170 vertices, via polyshape)';

    case 4
        vertices = [0.4789    0.3966   -0.7832
            0.2813   -0.5443   -0.7904
            0.1032   -0.9815    0.1615
            0.3007    0.7574    0.5796];

        domain_str='Quadrangle';

    case 5
        vertices =[-0.4886   -0.5505    0.6769
            -0.3390   -0.4644    0.8182
            -0.3114   -0.6887   -0.6547
            -0.5290   -0.3708   -0.7633
            0.5768    0.7093   -0.4053
            -0.9359   -0.2140   -0.2799
            -0.6399   -0.7358    0.2216];

        domain_str='Eptagon';

    case 6
        vertices_degs=[
            32.478361000000000 29.940417000000000
            32.625388999999998 28.976638999999999
            33.586221999999999 27.847500000000000
            35.138750000000002 24.513332999999999
            35.793749999999996 23.909222000000000
            35.476222000000000 23.934221999999998
            35.667888999999995 22.946610999999997
            36.895416999999995 22.063333000000000
            37.318750000000001 21.064999999999998
            37.111193999999998 21.214167000000000
            37.412056000000000 18.875000000000000
            38.557055999999996 18.060110999999999
            39.712027999999997 15.094999999999999
            39.875000000000000 15.507888999999999
            40.209972000000000 14.948722000000000
            41.189971999999997 14.623721999999999
            43.327027999999999 12.475778000000000
            43.376193999999998 11.988360999999999
            42.527471999999996 11.522888999999999
            43.156610999999998 11.612943999999999
            44.575806000000000 10.375389000000000
            45.805833000000000 10.867889000000000
            46.440805999999995 10.683750000000000
            47.412499999999994 11.179582999999999
            49.426666999999995 11.337888999999999
            50.797610999999996 11.986110999999999
            51.291249999999998 11.833306000000000
            51.022055999999999 10.420805999999999
            51.415416999999998 10.443332999999999
            50.902055999999995 10.314943999999999
            50.830416999999997 9.419167000000000
            47.965443999999998 4.477500000000000
            46.011666999999996 2.429528000000000
            43.559166999999995 0.714583000000000
            41.314971999999997 -1.961250000000000
            40.774555999999997 -1.934167000000000
            40.987916999999996 -2.264194000000000
            40.186278000000001 -2.735833000000000
            39.201943999999997 -4.680861000000000
            38.772888999999999 -6.052528000000000
            39.551249999999996 -7.017500000000000
            39.217110999999996 -7.850833000000000
            39.447055999999996 -7.813361000000000
            39.255389000000001 -8.292527999999999
            39.704443999999995 -10.031832999999999
            40.642055999999997 -10.684277999999999
            40.332082999999997 -11.313333000000000
            40.642083000000000 -12.746694000000000
            40.394556000000001 -12.928388999999999
            40.842110999999996 -14.832528000000000
            39.856639000000001 -16.438806000000000
            36.854971999999997 -17.878750000000000
            36.312500000000000 -18.877110999999999
            34.884999999999998 -19.852944000000001
            34.631222000000001 -19.650832999999999
            34.661221999999995 -20.555056000000000
            35.546222000000000 -22.171721999999999
            35.502055999999996 -24.107527999999999
            32.498666999999998 -25.960055999999998
            32.834055999999997 -26.292916999999999
            32.964388999999997 -26.084111000000000
            32.385388999999996 -28.549194000000000
            31.274555999999997 -29.454193999999998
            30.009166999999998 -31.297110999999997
            27.011638999999999 -33.565416999999997
            24.839971999999999 -34.206277999999998
            22.555833000000000 -33.978749999999998
            20.019971999999999 -34.830444000000000
            18.790806000000000 -34.080444000000000
            18.399943999999998 -34.302110999999996
            17.847888999999999 -32.820028000000001
            18.327082999999998 -32.530028000000001
            18.200443999999997 -31.682499999999997
            14.946249999999999 -26.317527999999999
            14.502027999999999 -22.542610999999997
            11.799500000000000 -17.979194000000000
            11.744555999999999 -15.835832999999999
            12.532888999999999 -13.418360999999999
            13.657055999999999 -12.235028000000000
            13.862833000000000 -11.008360999999999
            12.994582999999999 -9.087527999999999
            13.392111000000000 -8.388332999999999
            12.272917000000000 -6.140000000000000
            12.672943999999999 -6.010860999999999
            12.167916999999999 -5.727556000000000
            11.727860999999999 -4.450861000000000
            9.619583000000000 -2.408361000000000
            8.700388999999999 -0.668361000000000
            9.130417000000000 -0.714194000000000
            9.351638999999999 0.357917000000000
            9.501666999999999 0.050389000000000
            9.987083000000000 0.172500000000000
            9.309583000000000 0.512500000000000
            9.663750000000000 0.452500000000000
            9.695971999999999 1.078750000000000
            9.343722000000000 1.175833000000000
            9.975417000000000 3.079111000000000
            9.542916999999999 3.810833000000000
            9.833693999999999 3.809167000000000
            9.727943999999999 4.097500000000000
            9.214167000000000 3.941194000000000
            8.830389000000000 4.746667000000000
            8.554971999999999 4.482056000000000
            8.235778000000000 4.928750000000000
            8.278278000000000 4.536222000000000
            7.340000000000000 4.443722000000000
            7.075806000000000 4.737916999999999
            7.005777999999999 4.372917000000000
            6.779139000000000 4.667860999999999
            6.867471999999999 4.359583000000000
            6.723332999999999 4.612916999999999
            6.705028000000000 4.338722000000000
            5.983333000000000 4.310417000000000
            5.362083000000000 5.163306000000000
            5.680444000000000 5.540806000000000
            5.361667000000000 5.390416999999999
            5.176250000000000 5.568306000000000
            5.542860999999999 5.619193999999999
            5.080388999999999 5.718332999999999
            5.367083000000000 5.970000000000000
            5.064166999999999 5.764527999999999
            4.430833000000000 6.350389000000000
            3.401250000000000 6.395805999999999
            3.821639000000000 6.621194000000000
            1.343361000000000 6.161167000000000
            -1.981694000000005 4.754611000000000
            -4.016999999999996 5.258389000000000
            -6.124167000000000 4.997027999999999
            -7.480806000000030 4.360361000000000
            -8.717500000000030 4.807083000000000
            -11.230750000000000 6.789499999999999
            -12.521277999999995 7.384111000000000
            -12.456250000000011 7.766639000000000
            -13.293778000000032 8.421638999999999
            -12.837083000000007 8.560832999999999
            -13.174611000000027 8.531666999999999
            -13.303944000000001 9.334861000000000
            -13.723749999999995 9.506639000000000
            -13.537056000000007 9.796611000000000
            -14.455833000000041 10.208722000000000
            -14.697083000000021 11.076639000000000
            -15.078389000000016 10.918721999999999
            -15.004638999999997 11.183306000000000
            -15.235000000000014 10.997916999999999
            -15.504611000000011 11.328332999999999
            -15.033749999999998 11.643277999999999
            -15.509583000000021 11.789166999999999
            -14.939166999999998 11.988721999999999
            -15.955833000000041 11.734556000000000
            -15.853778000000034 11.992471999999999
            -16.352082999999993 12.096667000000000
            -16.014194000000032 12.345388999999999
            -16.776250000000005 12.406639000000000
            -16.220472000000029 12.609971999999999
            -16.763778000000002 12.571610999999999
            -16.717943999999989 13.459999999999999
            -16.355028000000004 13.249582999999999
            -15.574611000000004 13.515806000000000
            -16.506666999999993 13.361250000000000
            -16.513778000000002 13.879166999999999
            -17.533778000000041 14.741667000000000
            -16.577056000000027 15.697471999999999
            -16.043749999999989 17.747499999999999
            -16.547917000000041 19.379999999999999
            -16.197917000000018 20.224971999999998
            -16.912528000000009 21.161193999999998
            -17.107222000000036 20.837527999999999
            -16.983000000000004 21.798138999999999
            -15.704583000000014 23.972500000000000
            -15.915416999999991 23.803305999999999
            -14.903777999999988 24.685860999999999
            -14.465417000000002 26.196666999999998
            -13.651250000000005 26.659193999999999
            -12.915861000000007 27.956249999999997
            -11.525000000000034 28.298749999999998
            -10.217943999999989 29.309138999999998
            -9.662944000000039 30.071638999999998
            -9.846222000000012 31.397499999999997
            -9.287111000000039 32.545833000000002
            -6.812500000000000 34.025388999999997
            -5.934639000000004 35.790777999999996
            -5.470861000000014 35.917110999999998
            -4.688389000000029 35.206277999999998
            -2.979139000000032 35.441972000000000
            -2.830083000000002 35.108666999999997
            -1.957500000000039 35.075389000000001
            -0.937528000000043 35.727916999999998
            0.000000000000000 35.842889000000000
            1.084139000000000 36.493749999999999
            3.895861000000000 36.925388999999996
            5.344139000000000 36.641193999999999
            6.415806000000000 37.086250000000000
            7.899972000000000 36.842917000000000
            9.744999999999999 37.349556000000000
            10.431611000000000 36.712888999999997
            11.039138999999999 37.089582999999998
            10.467832999999999 36.135777999999995
            11.162917000000000 35.215832999999996
            10.017861000000000 34.187528000000000
            10.214138999999999 33.797083000000001
            12.299139000000000 32.837888999999997
            13.388306000000000 32.897860999999999
            15.205027999999999 32.382055999999999
            15.741667000000000 31.397888999999999
            17.853306000000000 30.925388999999999
            18.989971999999998 30.274583000000000
            20.057082999999999 30.850860999999998
            20.099999999999998 32.182055999999996
            21.708306000000000 32.941221999999996
            23.107471999999998 32.635388999999996
            23.319944000000000 32.152889000000002
            24.979832999999999 31.971055999999997
            25.200832999999999 31.523638999999999
            26.982471999999998 31.442055999999997
            29.064943999999997 30.822056000000000
            31.028305999999997 31.600389000000000
            31.919166999999998 31.531222000000000
            32.478361000000000 29.940417000000000];

        longitudes=deg2rad(vertices_degs(:,1));
        latitudes=deg2rad(vertices_degs(:,2));

        % Australia island vertices in cartesian coordinates.
        [XX,YY,ZZ] = sph2cart(longitudes,latitudes,1);
        vertices=[XX YY ZZ];

        domain_str='Africa (33 vertices, via data)';





end
