


INSIDEHULL - return wheter target belongs to the convex hull of X,Y or not.
Usage:
bool=insidehull(X,Y,target)

0001 function bool=insidehull(X,Y,target); 0002 %INSIDEHULL - return wheter target belongs to the convex hull of X,Y or not. 0003 % 0004 % Usage: 0005 % bool=insidehull(X,Y,target) 0006 0007 %INPUT X,Y, target 0008 X_exp=[X;target(1)]; 0009 Y_exp=[Y;target(2)]; 0010 0011 K=convhull(X,Y); 0012 K_exp=convhull(X_exp,Y_exp); 0013 K_area=polyarea(X(K),Y(K)); 0014 K_exp_area=polyarea(X_exp(K_exp),Y_exp(K_exp)); 0015 0016 bool=(K_exp_area<=K_area); 0017 0018