Code covered by the BSD License  

Highlights from
LISQ - A toolbox for the lifting scheme on 2D quincunx grids

image thumbnail
from LISQ - A toolbox for the lifting scheme on 2D quincunx grids by Paul De Zeeuw
A toolbox for the lifting scheme on 2D quincunx grids and for the computation of moment invariants

stencilR2Q(Stencil, Center)
function [StencilQ, CenterQ] = stencilR2Q(Stencil, Center)
%------------------------------------------------------------------------------
%
% This function transforms a stencil on an ordinary rectangular grid into a 
% corresponding stencil on a quincunx grid.
%
% Stencil  = input stencil
%
% Center   = center of Stencil
%
% StencilQ = output stencil at quincunx grid
%
% CenterQ  = center of StencilQ
%
% See also: stencilUPSaVC
%
% Design and implementation by:
% Dr. Paul M. de Zeeuw <Paul.de.Zeeuw@cwi.nl>  http://homepages.cwi.nl/~pauldz/
% Last Revision: November 20, 2000.
% (c) 1999-2002 Stichting CWI, Amsterdam.
%------------------------------------------------------------------------------
o=[0 0];
if ~all(size(o) == size(Center))
  error(' stencilR2Q - unexpected dimensions of Center ')
else
  clear o;
end
[n, m] = size(Stencil);
CenterQ = [(Center(1)-Center(2)+m) (Center(1)+Center(2)-1)];
nQ = n+m-1;
StencilQ = reshape(linspace(0,0,nQ*nQ),nQ,nQ);
for i=1:n
   for j=1:m
      StencilQ(i-j+m, i+j-1) = Stencil(i, j);
   end
end
%------------------------------------------------------------------------------

Contact us at files@mathworks.com