% Input:
% directions: matrix
% values: vector
% dimensionality: integer (dimensionality of the system)

% Output:
% n_directions: matrix (normalized directions)
% n_values: vector (normalized values)

% Description:
% normalizes directions*x <= values such that the length of the vectors
% indirections equals 1 using the precision 10000 and changes the values
% accordingly

function [n_directions,n_values] = normalizeDirections(directions,values,dimensionality)
global precision;
factors = sqrt(sum(abs(directions).^2,2));
n_directions = [directions./repmat(factors,1,size(directions,2)) zeros(size(directions,1),dimensionality-size(directions,2))];
n_directions = round(n_directions*precision)/precision;

if ~isempty(values)
    n_values = values./factors;
else
    n_values = [];
end;