function plotlines( ax, ends, vxs, varargin )
    if ~isempty(ends)
        x = reshape( vxs(ends',1), 2, [] );
        y = reshape( vxs(ends',2), 2, [] );
        if size(vxs,2)==2
            plot( ax, x, y, varargin{:} );
        else
            z = reshape( vxs(ends',3), 2, [] );
            plot3( ax, x, y, z, varargin{:} );
        end
    end
end
