function plotafsRAY(parentfig, data, AxesAFS, AxesSOL, lcs)

for i=1:4
    plot3(AxesAFS, data.InitT(i,2), data.InitT(i,3), data.InitT(i,4), '*', 'color', lcs(i,:), 'Markersize', 10, 'Linewidth', 2);
    hold(AxesAFS, 'on');
end

for i=1:data.afs.nseg
    plaplot = 0;
    if data.afs.SegStruc(i,1) == 2
        if isfield(data.afs.seg{i},'isplane') && data.afs.seg{i}.isplane
            axes(AxesAFS);
            fill3(data.afs.seg{i}.plane(:,1), data.afs.seg{i}.plane(:,2), data.afs.seg{i}.plane(:,3), lcs(data.afs.seg{i}.col,:), 'facealpha',.15);
            plaplot = 1;
        end
    elseif data.afs.SegStruc(i,1) == 3
        pts = data.afs.lines{data.afs.SegStruc(i,2)}.pts;
        plot3(pts(:,1), pts(:,2), pts(:,3), 'color', lcs(data.afs.seg{i}.col,:), 'Linewidth',3);
    end
    for j=1:length(data.afs.seg{i}.line)
        if data.afs.seg{i}.col <= size(lcs,1)
            plot3(AxesAFS, data.afs.pts(data.afs.seg{i}.line{j}.lin,1), data.afs.pts(data.afs.seg{i}.line{j}.lin,2), data.afs.pts(data.afs.seg{i}.line{j}.lin,3), 'color', lcs(data.afs.seg{i}.col,:));
        else
            plot3(AxesAFS, data.afs.pts(data.afs.seg{i}.line{j}.lin,1), data.afs.pts(data.afs.seg{i}.line{j}.lin,2), data.afs.pts(data.afs.seg{i}.line{j}.lin,3), 'k');
        end
        hold(AxesAFS, 'on');
    end
end

if data.plotIP
    axes(AxesAFS);
    trisurf(data.INNPOL.surf,data.INNPOL.t(:,1),data.INNPOL.t(:,2),data.INNPOL.t(:,3), 'Facecolor','r');
end
if data.plotFP
    axes(AxesAFS);
    trisurf(data.FIRPOL.surf,data.FIRPOL.t(:,1),data.FIRPOL.t(:,2),data.FIRPOL.t(:,3), 'Facecolor','k', 'Facealpha', 0.1);
end

set(AxesAFS,'XLim',data.xm,'YLim',data.ym,'ZLim',data.zm);
xlabel(AxesAFS, '\alpha')
ylabel(AxesAFS, '\beta')
zlabel(AxesAFS, '\gamma')

hold(AxesAFS,'off');
