exVScale = 1;
bNoninversion = 1;

% DataPath = './discBig/'; % <-------- update with your YALMIP path
% OBJFile = 'discBig.obj';
% nVt = 2483;
% exVScale = 5;

% DataPath = './quad25_180/'; % <-------- update with your YALMIP path
% OBJFile = 'quad25t.obj';
% nVt = 676;
% exVScale = 5;

% DataPath = './quad25_90/'; % <-------- update with your YALMIP path
% OBJFile = 'quad25t.obj';
% nVt = 676;
% exVScale = 5;

% DataPath = './quad100_360/'; % <-------- update with your YALMIP path
% OBJFile = 'quad100t.obj';
% nVt = 10201;

% DataPath = './quad50_t/'; % <-------- update with your YALMIP path
% OBJFile = 'quad50t.obj';
% nVt = 51*51;
% exVScale = 5;

% DataPath = './1_arm/'; % <-------- update with your YALMIP path
% OBJFile = 'rest.obj';
% nVt = 2135;

% DataPath = './2_disc/'; % <-------- update with your YALMIP path
% OBJFile = 'rest.obj';
% nVt = 2483;

% DataPath = './3_caterpillar/'; 
% OBJFile = 'rest.obj';
% nVt = 3744;

% DataPath = './7_starry_night/'; 
% OBJFile = 'rest.obj';
% nVt = 30502;

% DataPath = './6_yogurt_swirl/'; 
% OBJFile = 'rest.obj';
% nVt = 13122;
 
% DataPath = './5_woody/'; 
% OBJFile = 'rest.obj';
% nVt = 11290;

% DataPath = './4_worm/'; 
% OBJFile = 'rest.obj';
% nVt = 10208;

addpath(genpath(DataPath));

%load('G.mat');
rawExV = importdata('targetconstraints.txt');
rawExR = importdata('exrotation.txt');
rawOBJ = importdata(OBJFile);

sizeExV = size(rawExV, 1)/3;
sizeExR = size(rawExR, 1)/5;
%n = size(G,2);
n = nVt*2;
m = sizeExR;

VList = rawOBJ.data(1:n/2,1:2);
FList = rawOBJ.data(n/2+1:n/2+sizeExR,:);
G = extractG(VList, FList);

indices = zeros(2*sizeExV,1);
exV = zeros(n, 1);
for i=1:sizeExV
    indices(2*i-1) = 2*(rawExV(3*i-2)+1)-1; %0-based --> 1-based
    indices(2*i) = 2*(rawExV(3*i-2)+1); %0-based --> 1-based
    exV(2*(rawExV(3*i-2)+1)-1) = rawExV(3*i-1);
    exV(2*(rawExV(3*i-2)+1))   = rawExV(3*i);
end

exV = exV / exVScale;

exR = zeros(4*sizeExR,1);
for i=1:sizeExR
    exR(4*i-3) = rawExR(5*i-3);
    exR(4*i-2) = rawExR(5*i-1);
    exR(4*i-1) = rawExR(5*i-2);
    exR(4*i  ) = rawExR(5*i  );
end





