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

back to old stereo projection

parent 0f099411
No related branches found
No related tags found
No related merge requests found
...@@ -83,14 +83,13 @@ gmshSurface *gmshPolarSphere::NewPolarSphere(int iSphere, double x, double y, do ...@@ -83,14 +83,13 @@ gmshSurface *gmshPolarSphere::NewPolarSphere(int iSphere, double x, double y, do
gmshPolarSphere::gmshPolarSphere(double x, double y, double z, double _r) : r(_r), o(x,y,z) { gmshPolarSphere::gmshPolarSphere(double x, double y, double z, double _r) : r(_r), o(x,y,z) {
} }
SPoint3 gmshPolarSphere::point(double parA, double parB) const SPoint3 gmshPolarSphere::point(double u, double v) const
{ {
//stereographic projection from the south pole, origin of the axis //stereographic projection from the south pole, origin of the axis
//at the center of the sphere //at the center of the sphere
//parA=2rx/(r+z) parB=2ry/(r+z) //u=-x/(r+z) v=-y/(r+z)
double rp2 = parA * parA + parB * parB; double rp2 = u*u+v*v;
double z=r*(4*r*r-rp2)/(4*r*r+rp2); SPoint3 p(-2*r*u/(1+rp2),-2*r*v/(1+rp2),r*(1-rp2)/(1+rp2));
SPoint3 p(parA*(r+z)/(2*r),parB*(r+z)/(2*r),z);
p += o; p += o;
return p; return p;
} }
......
...@@ -1346,6 +1346,7 @@ void Field::put_on_view(PView *view, int comp) ...@@ -1346,6 +1346,7 @@ void Field::put_on_view(PView *view, int comp)
data->setName(oss.str()); data->setName(oss.str());
data->finalize(); data->finalize();
view->setChanged(true); view->setChanged(true);
data->destroyAdaptiveData();
} }
#endif #endif
......
...@@ -51,7 +51,7 @@ class GMSH_GSHHSPlugin:public GMSH_Post_Plugin ...@@ -51,7 +51,7 @@ class GMSH_GSHHSPlugin:public GMSH_Post_Plugin
} }
}; };
class reader_gshhs:public reader{ class reader_gshhs:public reader{
/* $Id: GSHHS.cpp,v 1.23 2009-01-15 13:28:30 remacle Exp $ /* $Id: GSHHS.cpp,v 1.24 2009-01-19 11:57:29 remacle Exp $
* *
* Include file defining structures used in gshhs.c * Include file defining structures used in gshhs.c
* *
...@@ -767,7 +767,7 @@ class GMSH_GSHHSPlugin:public GMSH_Post_Plugin ...@@ -767,7 +767,7 @@ class GMSH_GSHHSPlugin:public GMSH_Post_Plugin
} }
void add_point(SPoint3 point){ void add_point(SPoint3 point){
double r=sqrt(point.x()*point.x()+point.y()*point.y()+point.z()*point.z()); double r=sqrt(point.x()*point.x()+point.y()*point.y()+point.z()*point.z());
SPoint2 stereo(2*r*point.x() / (r + point.z()), 2*r*point.y() / (r + point.z())); SPoint2 stereo(-point.x() / (r + point.z()), -point.y() / (r + point.z()));
loop_buff << "Point ( IP + " << ip++ << " ) = {" << stereo. loop_buff << "Point ( IP + " << ip++ << " ) = {" << stereo.
x() << ", " << stereo.y() << ", " << 0 << " };\n"; x() << ", " << stereo.y() << ", " << 0 << " };\n";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment