Changeset 10432


Ignore:
Timestamp:
11/02/11 12:05:27 (13 years ago)
Author:
Mathieu Morlighem
Message:

Support for 3d models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/model/plot/plot_referential.m

    r10429 r10432  
    4848        yend=ystart+len*Yhat(:,2);
    4949        hy=quiver(xstart,ystart,xend-xstart,yend-ystart,'Color','red','ShowArrowHead','on','AutoScale','off');
     50
     51        legend([hx,hy],'local X direction','local Y direction')
    5052else
    51         error('3d not supported yet')
     53        %plot mesh
     54        A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
     55        h1=patch( 'Faces', [A B C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
     56        patch( 'Faces', [D E F],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
     57        patch( 'Faces', [A B E D],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
     58        patch( 'Faces', [B E F C],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
     59        patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
     60        hold on;
     61
     62        xstart=x;
     63        ystart=y;
     64        zstart=z;
     65        edgex=max(md.mesh.x(elements),[],2)-min(md.mesh.x(elements),[],2);
     66        edgez=max(md.mesh.z(elements),[],2)-min(md.mesh.z(elements),[],2);
     67        len=min(edgex)/1.5;
     68        lenz=min(edgez)/1.5;
     69        %plot X axis
     70        xend=xstart+len*Xhat(:,1);
     71        yend=ystart+len*Xhat(:,2);
     72        zend=zstart+len*Xhat(:,3);
     73        hx=quiver3(xstart,ystart,zstart,xend-xstart,yend-ystart,zend-zstart,'Color','blue','ShowArrowHead','on','AutoScale','off');
     74        %plot Y axis
     75        xend=xstart+len*Yhat(:,1);
     76        yend=ystart+len*Yhat(:,2);
     77        zend=zstart+len*Yhat(:,3);
     78        hy=quiver3(xstart,ystart,zstart,xend-xstart,yend-ystart,zend-zstart,'Color','red','ShowArrowHead','on','AutoScale','off');
     79        %plot Z axis
     80        xend=xstart+lenz*Zhat(:,1);
     81        yend=ystart+lenz*Zhat(:,2);
     82        zend=zstart+lenz*Zhat(:,3);
     83        hz=quiver3(xstart,ystart,zstart,xend-xstart,yend-ystart,zend-zstart,'Color','green','ShowArrowHead','on','AutoScale','off');
     84
     85        legend([hx,hy,hz],'local X direction','local Y direction','local Z direction')
    5286end
    53 
    54 %legend (disable warnings)
    55 legend([hx,hy],'local X direction','local Y direction')
    5687
    5788%apply options
Note: See TracChangeset for help on using the changeset viewer.