From cec7b618d09c1e008fd447e4f422c4f2b2ff6c08 Mon Sep 17 00:00:00 2001
From: Ivar Stefansson <ist050@uib.no>
Date: Wed, 21 Dec 2016 18:31:54 +0100
Subject: [PATCH] Replace intersections_of_cells.m

---
 scripts/intersections_of_cells.m | 79 ++++++++++++++++----------------
 1 file changed, 39 insertions(+), 40 deletions(-)

diff --git a/scripts/intersections_of_cells.m b/scripts/intersections_of_cells.m
index bcbce80..116bd91 100644
--- a/scripts/intersections_of_cells.m
+++ b/scripts/intersections_of_cells.m
@@ -1,40 +1,39 @@
-function [ int_points ] = intersections_of_cells( line_points, ... 
-                                        vertical_line,  c_p_on, c_p_nw_on )
-%UNTITLED5 The matrix int_points contains the intersections with the line
-%specified by line_points for each of the cells defined by the points in
-%c_p_on. The format for the intersection points is x1,y1,x2,y2
-int_points = zeros(length(c_p_on),4); 
-%length_on = zeros(length(c_p_on));
-for c = 1:length(c_p_on)
-    ind = 1; % places the points in the right position in the matrix line (c,:)
-    l = length(c_p_on{c});
-    for v = 1:l
-        if v < l
-            i = v+1; % could perhaps be handled with modulus, but =0 has to 
-            %be avoided
-        else
-            i = 1;
-        end
-        
-        % If the two points of a face are on opposite sides of the line,
-        % the face intersects the line:
-        if c_p_nw_on{c}(v) ~= c_p_nw_on{c}(i) 
-            face_points = [c_p_on{c}(v,:); c_p_on{c}(i,:)];
-            vertical_face = abs(c_p_on{c}(v,1)- c_p_on{c}(i,1)) < 5*eps;
-            %find intersection points:
-            int_points(c,ind:ind+1) = intersection(line_points, ...
-                                        vertical_line, face_points, ...
-                                        vertical_face);
-                  
-            ind = ind + 2;
-        end
-    end
-   
-end
-
-                                    
-                                    
-
-
-end
-
+function [ intersectionPoints ] = intersections_of_cells( linePoints, ... 
+                                  verticalLine,  cellPointsOn, cellPointsNortWestOn )
+%UNTITLED5 The matrix intersectionPoints contains the intersections with the line
+%specified by linePoints for each of the cells defined by the points in
+%cellPointsOn. The format for the intersection points is x1,y1,x2,y2
+
+intersectionPoints = zeros(length(cellPointsOn),4); 
+
+for c = 1:length(cellPointsOn)
+    ind = 1; % places the points in the right position in the matrix line (c,:)
+    l = length(cellPointsOn{c});
+    for v = 1:l
+        if v < l
+            i = v+1; % could perhaps be handled with modulus, but =0 has to 
+            %be avoided
+        else
+            i = 1;
+        end
+        
+        % If the two points of a face are on opposite sides of the line,
+        % the face intersects the line:
+        if cellPointsNortWestOn{c}(v) ~= cellPointsNortWestOn{c}(i) 
+            facePoints = [cellPointsOn{c}(v,:); cellPointsOn{c}(i,:)];
+            verticalFace = abs(cellPointsOn{c}(v,1)- cellPointsOn{c}(i,1)) < 5*eps;
+            %find intersection points:
+            intersectionPoints(c,ind:ind+1) = intersection(linePoints, ...
+                                        verticalLine, facePoints, ...
+                                        verticalFace);
+                  
+            ind = ind + 2;
+        end
+    end
+   
+end
+
+                                    
+                                   
+end
+
-- 
GitLab