Changeset 21456
- Timestamp:
- 12/31/16 17:55:07 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/plot_contour.m
r16592 r21456 14 14 15 15 %check is2d 16 if ~is2d ,16 if ~is2d & ~isplanet, 17 17 error('plot_contour error message: contour not supported for 3d meshes, project on a layer'); 18 18 end … … 115 115 y1=zeros(numelems,1); 116 116 y2=zeros(numelems,1); 117 z1=zeros(numelems,1); 118 z2=zeros(numelems,1); 119 117 120 edge_l=zeros(numelems,2); 118 121 … … 129 132 y1(j)=y(Seg1(poselem(j),1))+weight1*(y(Seg1(poselem(j),2))-y(Seg1(poselem(j),1))); 130 133 y2(j)=y(Seg2(poselem(j),1))+weight2*(y(Seg2(poselem(j),2))-y(Seg2(poselem(j),1))); 134 z1(j)=z(Seg1(poselem(j),1))+weight1*(z(Seg1(poselem(j),2))-z(Seg1(poselem(j),1))); 135 z2(j)=z(Seg2(poselem(j),1))+weight2*(z(Seg2(poselem(j),2))-z(Seg2(poselem(j),1))); 131 136 edge_l(j,1)=Seg1_num(poselem(j)); 132 137 edge_l(j,2)=Seg2_num(poselem(j)); … … 138 143 y1(j)=y(Seg1(poselem(j),1))+weight1*(y(Seg1(poselem(j),2))-y(Seg1(poselem(j),1))); 139 144 y2(j)=y(Seg3(poselem(j),1))+weight3*(y(Seg3(poselem(j),2))-y(Seg3(poselem(j),1))); 145 z1(j)=z(Seg1(poselem(j),1))+weight1*(z(Seg1(poselem(j),2))-z(Seg1(poselem(j),1))); 146 z2(j)=z(Seg3(poselem(j),1))+weight3*(z(Seg3(poselem(j),2))-z(Seg3(poselem(j),1))); 147 140 148 edge_l(j,1)=Seg1_num(poselem(j)); 141 149 edge_l(j,2)=Seg3_num(poselem(j)); … … 147 155 y1(j)=y(Seg2(poselem(j),1))+weight2*(y(Seg2(poselem(j),2))-y(Seg2(poselem(j),1))); 148 156 y2(j)=y(Seg3(poselem(j),1))+weight3*(y(Seg3(poselem(j),2))-y(Seg3(poselem(j),1))); 157 z1(j)=z(Seg2(poselem(j),1))+weight2*(z(Seg2(poselem(j),2))-z(Seg2(poselem(j),1))); 158 z2(j)=z(Seg3(poselem(j),1))+weight3*(z(Seg3(poselem(j),2))-z(Seg3(poselem(j),1))); 149 159 edge_l(j,1)=Seg2_num(poselem(j)); 150 160 edge_l(j,2)=Seg3_num(poselem(j)); … … 161 171 %take the right edge of the second segment and connect it to the next segments if any 162 172 e1=edge_l(1,1); e2=edge_l(1,2); 163 xc=[x1(1);x2(1)]; yc=[y1(1);y2(1)]; 173 xc=[x1(1);x2(1)]; yc=[y1(1);y2(1)]; zc=[z1(1);z2(1)]; 164 174 165 175 %erase the lines corresponding to this edge … … 167 177 x1(1)=[]; x2(1)=[]; 168 178 y1(1)=[]; y2(1)=[]; 179 z1(1)=[]; z2(1)=[]; 169 180 170 181 [ro1,co1]=find(edge_l==e1); … … 173 184 174 185 if co1==1, 175 xc=[x2(ro1);xc]; yc=[y2(ro1);yc]; 186 xc=[x2(ro1);xc]; yc=[y2(ro1);yc]; zc=[z2(ro1);zc]; 176 187 177 188 %next edge: … … 179 190 180 191 else 181 xc=[x1(ro1);xc]; yc=[y1(ro1);yc]; 192 xc=[x1(ro1);xc]; yc=[y1(ro1);yc]; zc=[z1(ro1);zc]; 182 193 183 194 %next edge: … … 189 200 x1(ro1)=[]; x2(ro1)=[]; 190 201 y1(ro1)=[]; y2(ro1)=[]; 202 z1(ro1)=[]; z2(ro1)=[]; 191 203 192 204 %next connection … … 200 212 201 213 if co2==1, 202 xc=[xc;x2(ro2)]; yc=[yc;y2(ro2)]; 214 xc=[xc;x2(ro2)]; yc=[yc;y2(ro2)]; zc=[zc;z2(ro2)]; 203 215 204 216 %next edge: 205 217 e2=edge_l(ro2,2); 206 218 else 207 xc=[xc;x1(ro2)]; yc=[yc;y1(ro2)]; 219 xc=[xc;x1(ro2)]; yc=[yc;y1(ro2)]; zc=[zc;z1(ro2)]; 208 220 209 221 %next edge: … … 215 227 x1(ro2)=[]; x2(ro2)=[]; 216 228 y1(ro2)=[]; y2(ro2)=[]; 229 z1(ro2)=[]; z2(ro2)=[]; 217 230 218 231 %next connection … … 221 234 222 235 %we now have one subcontour ready to be plotted 223 zc=level*ones(length(xc)+1,1);224 236 if getfieldvalue(options,'contouronly',0), 225 h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',zc,'Cdata',zc,'facecolor','none','edgecolor','flat','linewidth',linewidth)]; 237 if isplanet, 238 h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',[zc;NaN],'facecolor','none','linewidth',linewidth)]; 239 else 240 h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',zc,'Cdata',zc,'facecolor','none','edgecolor','flat','linewidth',linewidth)]; 241 end 226 242 hold on 227 243 else 228 244 dist = 5000; 229 if (max(xc)-min(xc)+max(yc)-min(yc))<dist, continue; end 230 h=patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'facecolor','none','edgecolor',color,'linewidth',linewidth); 231 c = horzcat([level, xc'; length(xc), yc']); 245 if isplanet, 246 if (max(xc)-min(xc)+max(yc)-min(yc)+max(zc)-min(zc))<dist, continue; end 247 h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',[zc;NaN],'facecolor','none','linewidth',linewidth)]; 248 c = horzcat([level, xc'; length(xc), yc'; length(xc), zc']); 249 else 250 if (max(xc)-min(xc)+max(yc)-min(yc))<dist, continue; end 251 h=patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'facecolor','none','edgecolor',color,'linewidth',linewidth); 252 c = horzcat([level, xc'; length(xc), yc']); 253 end 232 254 %clabel(c,h,'FontSize',10,'labelspacing',20000,'color',color); 233 255 hold on … … 247 269 else 248 270 %clabel(c,h,'color',color,'FontSize',10,'labelspacing',20000); 249 clabel(c,h,'FontSize',10,'labelspacing',20000);250 end 251 end 271 %clabel(c,h,'FontSize',10,'labelspacing',20000); 272 end 273 end
Note:
See TracChangeset
for help on using the changeset viewer.