Changeset 3666
- Timestamp:
- 05/06/10 10:23:52 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/processgeometry.m
r3658 r3666 14 14 x2=geom.Vertices(geom.Edges(i,2),1); 15 15 y2=geom.Vertices(geom.Edges(i,2),2); 16 color1=geom.Edges(i,3); 16 17 17 j=i +1; %test edges located AFTER i only18 j=i; %test edges located AFTER i only 18 19 while (j<size(geom.Edges,1)), 19 20 … … 31 32 x4=geom.Vertices(geom.Edges(j,2),1); 32 33 y4=geom.Vertices(geom.Edges(j,2),2); 34 color2=geom.Edges(j,3); 33 35 34 36 %Check if the two edges are crossing one another … … 40 42 41 43 %Add vertex to the list of vertices 42 geom.Vertices(end+1,:)=[x y 1];44 geom.Vertices(end+1,:)=[x y min(color1,color2)]; 43 45 id=size(geom.Vertices,1); 44 46 … … 56 58 end 57 59 60 end 61 62 %Check point outside 63 disp('Checking for points outside the domain...'); 64 i=0; 65 num=0; 66 while (i<size(geom.Vertices,1)), 67 68 %vertex counter 69 i=i+1; 70 71 %Get coordinates 72 x=geom.Vertices(i,1); 73 y=geom.Vertices(i,2); 74 color=geom.Vertices(i,3); 75 76 %Check that the point is inside the domain 77 if (color~=1 & ~ContourToNodes(x,y,outline(1),1)), 78 79 %Remove points from list of Vertices 80 num=num+1; 81 geom.Vertices(i,:)=[]; 82 83 %update edges 84 [posedges dummy]=find(geom.Edges==i); 85 geom.Edges(posedges,:)=[]; 86 posedges=find(geom.Edges>i); 87 geom.Edges(posedges)=geom.Edges(posedges)-1; 88 89 %update counter 90 i=i-1; 91 end 92 end 93 if num, 94 disp(['WARNING: ' num2str(num) ' points outside the domain outline have been removed']); 58 95 end 59 96 … … 102 139 %remove empty edges 103 140 geom.Edges(find(geom.Edges(:,1)==geom.Edges(:,2)),:)=[]; 104 105 %Check point outside106 disp('Checking for points outside the domain...');107 i=0;108 num=0;109 while (i<size(geom.Vertices,1)),110 111 %vertex counter112 i=i+1;113 114 %Get coordinates115 x=geom.Vertices(i,1);116 y=geom.Vertices(i,2);117 118 %Check that the point is inside the domain119 if (~ContourToNodes(x,y,outline(1),1)),120 121 %Remove points from list of Vertices122 num=num+1;123 geom.Vertices(i,:)=[];124 125 %update edges126 [posedges dummy]=find(geom.Edges==i);127 geom.Edges(posedges,:)=[];128 posedges=find(geom.Edges>i);129 geom.Edges(posedges)=geom.Edges(posedges)-1;130 131 %update counter132 i=i-1;133 end134 end135 if num,136 disp(['WARNING: ' num2str(num) 'points outside the domain outline have been removed']);137 end
Note:
See TracChangeset
for help on using the changeset viewer.