function k = STPoint( name, type, c, j, a, b )
% STPoint returns such a translation parameter k that f(a^j*x-b*k) is the first function
% having non-trivial intersection with the point c
%
% Usage:    k = STPoint( name, type, c, j, a, b );
%
% Inputs:
%   name    order of splines (positive integer) or 'chui_cubic' (string)
%   type    string, 'scal.f.' for scaling functions, 'wavelet' for wavelets
%   c       left point of the given interval
%   j       scale level (a^j is the dilation)
%   a       scaling factor
%   b       translation factor
%
% Output:
%   k       desired translation parameter such that f(a^j*x-b*k) is the first function 
%           having non-trivial intersection with the point c

% See http://www.ncrg.aston.ac.uk/Projects/BiOrthog/ for more details


switch type
    case 'scal.f.'
        if isnumeric(name)
            supp=name;
            k=floor((c*(a^j)-supp)/b)+1;
        elseif strcmp(name,'chui_cubic')
            supp=4;
            k=floor((c*(a^j)-supp)/b)+1;
        else
            error('Unknown function family')
        end
    case 'wavelet'
        if isnumeric(name)
            supp=2*name-1;
            k=floor((c*(a^j)-supp)/b)+1;
        elseif strcmp(name,'chui_cubic')
            k=-3;
        else
            error('Unknown function family')
        end
    otherwise
        error('Unknown type of function sent to STPOINT')
end


%Copyright (C) 2006 Miroslav ANDRLE and Laura REBOLLO-NEIRA
%
%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., 51 Franklin Street, Fifth Floor,
%Boston, MA  02110-1301, USA.
