Changeset 26220


Ignore:
Timestamp:
04/29/21 11:51:25 (4 years ago)
Author:
Eric.Larour
Message:

CHG: make sure gmshplanet returns a round planet :) Not a tessalated set of triangle
planar faces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m

    r26184 r26220  
    178178        %}}}
    179179
    180         %figure out other fields in mesh3dsurface:
     180        %a little technicality here. the mesh generate is not exactly on the
     181        %sphere. we create lat,long coordinates, and reproject on an exact sphere.
    181182        mesh.r=sqrt(mesh.x.^2+mesh.y.^2+mesh.z.^2);
    182         mesh.lat = asin(mesh.z./mesh.r)/pi*180;
    183         mesh.long = atan2(mesh.y,mesh.x)/pi*180;
     183
     184        %make sure we don't have south and north pole:
     185        pos=find(mesh.x==0 & mesh.y==0);
     186        mesh.lat = asind(mesh.z./mesh.r);
     187        mesh.long = atan2d(mesh.y,mesh.x);
     188        pos=find(mesh.lat==90); mesh.lat(pos)=90-.01;
     189        pos=find(mesh.lat==-90); mesh.lat(pos)=-90+.01;
     190
     191        mesh.r=radius*ones(mesh.numberofvertices,1);
     192        mesh.x=radius*cosd(mesh.lat).*cosd(mesh.long);
     193        mesh.y=radius*cosd(mesh.lat).*sind(mesh.long);
     194        mesh.z=radius*sind(mesh.lat);
     195
    184196
    185197        %erase files:
Note: See TracChangeset for help on using the changeset viewer.