function demo_linear_blending
% Object: Example of integration over a sector.
% Settings.
ade=10; f_example=1;
% Main code below.
switch f_example
    case 1
        f=@(x,y) (x+0.5*y).^10; % integrand
        Iex=1.792695693383881e-01; % numerically exact integral
    otherwise
        f=@(x,y) (1+x+0.5*y).^11; % integrand
        Iex=4.313845631275915e+02; % numerically exact integral
end
% Domain.
beta=pi/3; alpha=0; % examples: pi/4, pi/3, pi/2, pi.
r1=0; r2=1; 
A1=[r1 0]; B1=[0 r1]; C1=[0 0];
A2=[r2 0]; B2=[0 r2]; C2=[0 0];
% Cubature formula
A=[A1; A2]; B=[B1; B2]; C=[C1; C2];
xyw = gqellblend(ade,A,B,C,alpha,beta); x=xyw(:,1); y=xyw(:,2); w=xyw(:,3);
% Integral computation.
fxy=feval(f,x,y); Inum=w'*fxy;
% Statistics
fprintf('\n \t * # : %-8.0f',length(w));
fprintf('\n \t * I : %-1.15e',Inum);
fprintf('\n \t * AE: %-1.3e',abs(Inum-Iex));
fprintf('\n \t * RE: %-1.3e \n',abs(Inum-Iex)/abs(Iex));
% Plot arcs
plot_linear_blending(A1,B1,C1,A2,B2,C2,alpha,beta);
hold on;
plot(x,y,'go','MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',6);
axis equal; axis tight;hold off;