Diff of /devel/graphs/clipGraph.m [0a4fe7] .. [79637f]  Maximize  Restore

Switch to side-by-side view

--- a/devel/graphs/clipGraph.m
+++ b/devel/graphs/clipGraph.m
@@ -2,16 +2,16 @@
 ## Copyright (C) 2004-2011 INRA - CEPIA Nantes - MIAJ (Jouy-en-Josas)
 ## Copyright (C) 2012 Adapted to Octave by Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
 ## All rights reserved.
-## 
+##
 ## Redistribution and use in source and binary forms, with or without
 ## modification, are permitted provided that the following conditions are met:
-## 
+##
 ##     1 Redistributions of source code must retain the above copyright notice,
 ##       this list of conditions and the following disclaimer.
 ##     2 Redistributions in binary form must reproduce the above copyright
 ##       notice, this list of conditions and the following disclaimer in the
 ##       documentation and/or other materials provided with the distribution.
-## 
+##
 ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS''
 ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -113,14 +113,14 @@
 
 
 # iterate over each edge
-for e=1:size(edges, 1)    
+for e=1:size(edges, 1)
     # current edge
     edge = [nodes(edges(e, 1), :) nodes(edges(e, 2), :)];
-    
+
     # flags to indicate whether nodes are inside box or not
     in1 = ismember(edges(e, 1), indNodes);
     in2 = ismember(edges(e, 2), indNodes);
-    
+
     # check if edge is totally inside window -> no clip
     if in1 && in2
         edges2 = [edges2; hashNodes(edges(e, :))']; ##ok<AGROW>
@@ -133,13 +133,13 @@
     if edge(1)-xmax>ACC && edge(3)-xmax>ACC, continue; end
     if edge(2)-ymin<ACC && edge(4)-ymin<ACC, continue; end
     if edge(2)-ymax>ACC && edge(4)-ymax>ACC, continue; end
-   
+
     # otherwise, we have to clip the edge !
     edge = clipEdge(edge, [box(1) box(2); box(3) box(4)]);
-    
+
     # display debug info
-    #disp(sprintf('clip edge n�#2d, from #2d to #2d', e, edges(e,1), edges(e,2)));
-    
+    #disp(sprintf('clip edge n�%2d, from %2d to %2d', e, edges(e,1), edges(e,2)));
+
     # Node for first vertex
     if ~in1
         nodes2 = [nodes2; edge([1 2])]; ##ok<AGROW>
@@ -147,7 +147,7 @@
     else
         indN1 = hashNodes(edges(e, 1));
     end
-    
+
     # Node for second vertex
     if ~in2
         nodes2 = [nodes2; edge([3 4])]; ##ok<AGROW>
@@ -155,44 +155,44 @@
     else
         indN2 = hashNodes(edges(e, 2));
     end
-    
+
     # add clipped edge to the list
     edges2 = [edges2; indN1 indN2]; ##ok<AGROW>
     hashEdges(e) = size(edges2, 1);
 end
-    
+
 
 ## Clip the faces
 faces2 = {};
 for f = 1:length(faces)
     # indices of vertices of current face
     face = faces{f};
-    
+
     # if the face is not clipped, use directly new indices of nodes
     face2 = hashNodes(face)';
     if ~ismember(0, face2)
         faces2 = [faces2, {face2}]; ##ok<AGROW>
         continue;
     end
-    
+
     # At least one vertex is clipped. Here is some more special processing
-    
+
     # edges of current face
     faceEdges = sort([face' face([2:end 1])'], 2);
-    
+
     # indices of face edges in edges array
     indEdges = ismember(edges, faceEdges, 'rows');
-    
+
     # convert to indices of edges in clipped edges array. indEdges with
     # value=0 correspond to totally clipped edges, and can be removed.
     indEdges = hashEdges(indEdges);
     indEdges = indEdges(indEdges~=0);
-    
+
     # case of face totally clipped: break and continuue with next face
     if isempty(indEdges)
         continue;
     end
-    
+
     # extract indices of vertices of the clipped face
     face2 = edges2(indEdges, :);
     face2 = unique(face2(:));
@@ -204,13 +204,13 @@
         nodes2 = [nodes2; corners(ind, :)]; ##ok<AGROW>
         face2 = [face2; size(nodes2, 1)]; ##ok<AGROW>
     end
-    
+
     # vertices of the face, as points
     faceNodes = nodes2(face2, :);
 
     # sort vertices according to their angle around the centroid
     [faceNodes I] = angleSort(faceNodes, centroid(faceNodes)); ##ok<ASGLU>
-    
+
     # add current face to list of faces
     faces2 = [faces2, {face2(I)'}]; ##ok<AGROW>
 end
@@ -229,5 +229,4 @@
     varargout{1} = nodes2;
     varargout{2} = edges2;
     varargout{3} = faces2;
-end    
-
+end

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks