function trygencyl()
%   Testing gencyl.
%
%   Copyright 2011 Jonathan Hadida
%   ETS Montreal, Canada
%   Interventional Medical Imaging Laboratory
%
%   Contact: ariel dot hadida [a] google mail

    N = 30; % 60 points on the centerline
    
    % Centerline points: half-circle in the plane Y=1
    u = linspace(-1,1,N);
    v = ones(1,N);
    w = sqrt(1-u.^2);
    
    % Centerline points matrix and associated radius
    P = vertcat( u , v , w );
    R = .1*(2+cos( 4*pi*u ));
    
    % Generate surface
    [x y z] = gencyl( P , R , 10 );
    
    % Show the surface
    figure('DoubleBuffer','on','Renderer','zbuffer')
        surf(x,y,z,'FaceColor','interp','FaceLighting','phong','EdgeColor','none');
        axis equal;
        hold on;
        plot3( P(1,:) , P(2,:) , P(3,:) , 'r-d' , 'LineWidth' , 3 );
        hold off;
        material metal;
        camlight headlight;

end