%--------------------------------------------------------------------------
% COMPUTING WAM.
%--------------------------------------------------------------------------

function pts=simplex_wam(deg)

%--------------------------------------------------------------------------
% OBJECT.
%----------
%
% COMPUTE WAM POINTS FOR UNIT SYMPLEX [0 0; 1 0; 0 1].
%
%--------------------------------------------------------------------------
% INPUT.
%----------
%
% deg:  WAM DEGREE.
%
%--------------------------------------------------------------------------
% OUTPUT.
%----------
%
% pts: WAM POINTS ON THE UNIT SYMPLEX [0 0; 1 0; 0 1].
%--------------------------------------------------------------------------

%--------------------------------------------------------------------------
%% Copyright (C) 2010 
%% Len Bos, Stefano De Marchi, 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
%%
%% Author:  
%%          Len Bos           <leonardpeter.bos@univr.it>
%%          Stefano De Marchi <demarchi@math.unipd.it>
%%          Alvise Sommariva  <alvise@math.unipd.it>
%%          Marco Vianello    <marcov@math.unipd.it>    
%%
%% Date: May 25, 2010.
%--------------------------------------------------------------------------

n1=2*deg;
n2=n1;
j1=(0:1:deg-1);
j2=(0:1:deg);
[rho,theta]=meshgrid(cos(j1*pi/n1),j2*pi/n2);

% Mapping to the simplex
B=[rho(:).*cos(theta(:)) rho(:).*sin(theta(:))];
meshT=[B(:,1).^2 B(:,2).^2];

nodes_x=meshT(:,1);
nodes_y=meshT(:,2);

pts=[nodes_x nodes_y; 0 0];


