function CompruebaDobleNada2(t)
x = [0 0.5 1];
y = [0 1 0];

p_dentro = [0.574102276104258,0.771420530842383;
0.604602673421474,0.757108645426780;
0.271557409020821,0.532665847109396;
0.204112180559705,0.336219938679294;
0.785766591148992,0.396844803715677;
0.698212061908802,0.317186123033300;
0.429549540004404,0.627481421287314;
0.407870230954201,0.766042902137375;
0.293000821373213,0.321338288198057;
0.293270337734379,0.388944956383355;
0.767095182387775,0.257578732130072;
0.414001961471342,0.662171844620343;
0.668912150959573,0.266147485938185;
0.142290314346012,0.025985599900859;
0.433123187479379,0.756172745621586;
0.827155788564163,0.271286475644056;
0.348223200463630,0.290909809478611;
0.464627994889837,0.527252498140696;
0.192962871860857,0.344079326997459;
0.788719434119799,0.399834608289921;
0.341787832974354,0.528330610173266;
0.324970435813672,0.321746867106619;
0.130676733692223,0.219556981962158;
0.344874942530708,0.158180811116059;
0.381175499312969,0.200000329845576;
0.298714228197770,0.517433676421901;
0.543557449047564,0.876901441774142;
0.349490121180175,0.523817354884053;
0.849399440783848,0.133477743496402;
0.162452355264524,0.313274105421376;
0.140502741145711,0.018964781979768;
0.247546067261820,0.472106028171964;
0.528164334585356,0.929088188476471;
0.337963181052739,0.048808812941340;
0.583337336574557,0.516475302137834;
0.192204588106001,0.068796987396127;
0.549080025824967,0.824508745748749;
0.475921028196650,0.024716393246973;
0.986834541095640,0.005766551621505];
disp('Probando puntos interiores en triangulo...');
compruebaDentro(p_dentro, t);

p_fuera = [0.587967418828164,0.710000102759317;
0.462369681084311,0.389499637500239;
0.455667438533465,0.309199541858545;
0.503207012212203,0.836673089823347;
0.372236323379379,0.039352048735556;
0.404663209854967,0.372439275734548;
0.901530472888693,0.113103734268947;
0.467320990035161,0.225443407166775;
0.793823487402762,0.234602117979400;
0.332311078002375,0.231295935446431;
0.783681849183409,0.173118547196525;
0.617535942184362,0.066086303620671;
0.582112226151627,0.195172082381487;
0.298351678077606,0.047360227822558;
0.519062876105943,0.433258263935090;
0.580084360916773,0.279507312371688;
0.132535318273005,0.045211075557775;
0.706969752573685,0.482635256272993;
0.202685756069852,0.112254271561886;
0.560773796309899,0.670322228846931;
0.751476526154914,0.127878883822476;
0.155027385228440,0.104817000195493;
0.655041007784505,0.351393381812304;
0.598170791874232,0.456462961555017;
0.875274714930067,0.179332035556167;
0.383163274019771,0.243556412764423;
0.723092036375873,0.201505938968189;
0.734799419134593,0.209482046177626;
0.841165765464036,0.083829396134260;
0.685950578686332,0.213889013211907;
0.753733899882690,0.265067304009200;
0.553184272819584,0.342461963287336;
0.644202692203575,0.439827519657497;
0.277402123780912,0.358612429393628;
0.275316648162033,0.341224898373115;
0.513900699358577,0.594963231690586;
0.629520406649931,0.443591141461051;
0.233032416191194,0.053422030180882;
0.516475836604846,0.331011182854632;
0.169825791451964,0.225105500071105;
0.336552543467475,0.190722351740035;
0.635036887171691,0.650725693482023;
0.656110286844614,0.071852313438074;
0.575312175431303,0.061710899118409;
0.346218497892980,0.586990507081226;
0.692413666914383,0.310860149751975;
0.456312455882748,0.198651711844318;
0.513030759318934,0.298536822974757;
0.759482714330276,0.213441431102673;
0.637243038971835,0.438848480868785;
0.264848315247707,0.148108546098912;
0.633337059138638,0.480793572450891;
0.584117075694286,0.316354111776769;
0.629896308990429,0.075706440120485;
0.426602245949883,0.651749653018629;
0.861885798571956,0.186167157694524;
0.338730374581319,0.429357392641389];
disp('Probando puntos exteriores en triangulo...');
compruebaFuera(p_fuera, t);
end

function disp1(x)
    global correcto;
    correcto = correcto + strcmpi(x,'El iman continua dentro del poligono. Has perdido :(');
end    

function disp2(x)
    global correcto;
    correcto = correcto + strcmpi(x,'El iman ha salido del poligono. Has ganado!');
end

function compruebaDentro(p_dentro, t)
N = size(p_dentro,1);
global correcto;
correcto = 0;

for k=1:N
  f = p_dentro(k,:);
  input = @() f;
  disp = @disp1;
  eval(t);
  clear input disp;
  close all;  
end
fprintf(' ---> %.2f%% Correctos   %.2f%% Mal\n', correcto/N*100, (N-correcto)/N*100);
end

function compruebaFuera(p_fuera, t)
N = size(p_fuera,1);
global correcto;
correcto = 0;

for k=1:N
  f = p_fuera(k,:);
  input = @() f;
  disp = @disp2;
  eval(t);
  clear input disp;
  close all;  
end

fprintf(' ---> %.2f%% Correctos   %.2f%% Mal\n', correcto/N*100, (N-correcto)/N*100);
end