Skip to content
Snippets Groups Projects
Commit c1d231cc authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

correct stereo projection while checking loops orientation in GSHHS plugin

parent 286a025f
Branches
Tags
No related merge requests found
...@@ -51,7 +51,7 @@ class GMSH_GSHHSPlugin:public GMSH_PostPlugin ...@@ -51,7 +51,7 @@ class GMSH_GSHHSPlugin:public GMSH_PostPlugin
} }
}; };
class reader_gshhs:public reader{ class reader_gshhs:public reader{
/* $Id: GSHHS.cpp,v 1.28 2009-01-31 18:30:40 geuzaine Exp $ /* $Id: GSHHS.cpp,v 1.29 2009-02-18 11:21:44 remacle Exp $
* *
* Include file defining structures used in gshhs.c * Include file defining structures used in gshhs.c
* *
...@@ -353,12 +353,13 @@ class GMSH_GSHHSPlugin:public GMSH_PostPlugin ...@@ -353,12 +353,13 @@ class GMSH_GSHHSPlugin:public GMSH_PostPlugin
+(v[2]-p.v[2])*(v[2]-p.v[2])); +(v[2]-p.v[2])*(v[2]-p.v[2]));
} }
void to_stereo(double &xp,double &yp,bool inverse_stereo=false){ void to_stereo(double &xp,double &yp,bool inverse_stereo=false){
double r=sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
if(inverse_stereo){ if(inverse_stereo){
yp=v[1]/(1-v[2]); xp=v[1]/(r-v[2]);
xp=v[0]/(1-v[2]); yp=v[0]/(r-v[2]);
}else{ }else{
xp=-v[1]/(1+v[2]); xp=-v[0]/(r+v[2]);
yp=-v[0]/(1+v[2]); yp=-v[1]/(r+v[2]);
} }
} }
void to_latlon(double &lat,double &lon){ void to_latlon(double &lat,double &lon){
...@@ -644,7 +645,7 @@ class GMSH_GSHHSPlugin:public GMSH_PostPlugin ...@@ -644,7 +645,7 @@ class GMSH_GSHHSPlugin:public GMSH_PostPlugin
i=l->remove_range(i,id1); i=l->remove_range(i,id1);
result=true; result=true;
} }
if(not_a_loop!=1 &&(l->orientation(id1,i,reverse_stereo)==-1 || l->length(id1,i)<3)){ if(not_a_loop!=1 && (l->orientation(id1,i,reverse_stereo)==-1 || l->length(id1,i)<3)){
i=l->remove_range(id1,i); i=l->remove_range(id1,i);
result=true; result=true;
}else }else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment