diff --git a/scripts/area_on_coarse_point.m b/scripts/area_on_coarse_point.m deleted file mode 100644 index 951c9443c73ad58b58124be284bb92c06c112b7e..0000000000000000000000000000000000000000 --- a/scripts/area_on_coarse_point.m +++ /dev/null @@ -1,57 +0,0 @@ -function [ a ] = area_on_coarse_point( pol,Pol,Point ) -% Calculates intersection areas of convex polygons -% For a small polygon surrounding a point in a much coarser triangulation, -% this function calculates the intersection area with the coarse polygon -% Pol. Point is one of the points defining Pol. Note that both size -% difference and convexity assumptions must hold! -% f1 er point 1 og point 2, f2 er p2 og p3 ... fn er pn og p1 -N = size(Pol,1); -n = size(pol,1); -inPol = find(ismember(Pol,Point,'rows')); - -% Find the faces of Pol adjacent to Point -if inPol == 1 - Firstface = [Pol(N,:);Pol(1,:)]; -else - Firstface = [Pol(inPol-1,:);Pol(inPol,:)]; -end -if inPol == N - Secondface = [Pol(N,:);Pol(1,:)]; -else - Secondface = [Pol(inPol,:);Pol(inPol+1,:)]; -end - -pol2 = [pol;pol(1,:)]; -for i = 1:n - face = [pol2(i,:);pol2(i+1,:)]; - intersection1 = intersection_between_inclusive(Firstface, ... - Firstface(1)==Firstface(2), face, face(1)==face(2),true); - if ~isempty(intersection1) - break - end -end -for j = 1:n - face = [pol2(j,:);pol2(j+1,:)]; - intersection2 = intersection_between_inclusive(Secondface, ... - Secondface(1)==Secondface(2), face, face(1)==face(2),true); - if ~isempty(intersection2) - break - end -end -if i ~= j - smallpointsinside = inpolygon(pol(:,1),pol(:,2),Pol(:,1),Pol(:,2)); - smallpointsinside = pol(find(smallpointsinside),:); -else - smallpointsinside = []; -end -newpoints = [Point; intersection1;intersection2;smallpointsinside]; - - -if size( unique( [ newpoints(:,1) newpoints(:,2) ], 'rows' ), 1 ) > 2 - [~, a] = convhull(newpoints(:,1),newpoints(:,2)); -else - a = 0; -end - -end -