% Input:
% L: Matrix (containing row-wise 2 dimensional direction vectors)
% spvalues: vector (containing the evaluation values in directions from L
% of the considered support function)

% Output:
% A: Matrix (containing the vertices of the specified polytope)

% Description:
% Computes the vertices of a 2-dimensional polyheder (in dimensions
% x_param, y_param)

function [A] = calcPolytopeVertices(L,spvalues)

A = zeros(2,size(L,1)); % Matrix containing the ordered intersection points

[~,k_old,t_old,~] = plothalfspaceEXT(L(1,:),spvalues(1)); % generate line equation

for i=1:1:size(L,1)
    l = L(mod(i,size(L,1))+1,:);
    
    [~,k,t,~] = plothalfspaceEXT(l,spvalues(mod(i,size(L,1))+1)); %  generate line equation
    A(:,i) = intersectLines(k_old,t_old,k,t); % compute intersection
 
    k_old = k;
    t_old = t;
end;