function DOP = wamdopeval(deg,R1,R2,pts,rect);

% by Alvise Sommariva and Marco Vianello, University of Padova
% October 2014

% computes the Vandermonde matrix of degree deg at the points pts 
% in a discrete orthogonal polynomial basis  

if isempty(rect) 
rect(1)=min(pts(:,1));
rect(2)=max(pts(:,1));
rect(3)=min(pts(:,2));
rect(4)=max(pts(:,2));
if length(pts(1,:)) == 3
rect(5)=min(pts(:,3));
rect(6)=max(pts(:,3));
end;    
end

W=chebvand(deg,pts,rect);
DOP=(W/R1)/R2;

end




