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

use correct PolarSphere projection when r!=1

parent 4123df81
No related branches found
No related tags found
No related merge requests found
......@@ -89,8 +89,8 @@ SPoint3 gmshPolarSphere::point(double parA, double parB) const
//at the center of the sphere
//parA=2rx/(r+z) parB=2ry/(r+z)
double rp2 = parA * parA + parB * parB;
SPoint3 p(2*parA/(1+rp2),2*parB/(1+rp2),(rp2-1)/(rp2+1));
p *= -r;
double z=r*(4*r*r-rp2)/(4*r*r+rp2);
SPoint3 p(parA*(r+z)/(2*r),parB*(r+z)/(2*r),z);
p += o;
return p;
}
......@@ -135,7 +135,7 @@ SPoint3 gmshParametricSurface::point(double par1, double par2) const
Msg::Error("MathEval is not compiled in this version of Gmsh");
return SPoint3(0.,0.,0.);
#else
char *names[2] = {"u", "v"};
char *names[2] = {(char*)"u", (char*)"v"};
double values [2] = {par1, par2};
const double x = evaluator_evaluate(evalX, 2, names, values);
const double y = evaluator_evaluate(evalY, 2, names, values);
......
......@@ -51,7 +51,7 @@ class GMSH_GSHHSPlugin:public GMSH_Post_Plugin
}
};
class reader_gshhs:public reader{
/* $Id: GSHHS.cpp,v 1.20 2009-01-12 16:17:37 remacle Exp $
/* $Id: GSHHS.cpp,v 1.21 2009-01-13 11:11:39 remacle Exp $
*
* Include file defining structures used in gshhs.c
*
......@@ -766,8 +766,8 @@ class GMSH_GSHHSPlugin:public GMSH_Post_Plugin
file->close();
}
void add_point(SPoint3 point){
SPoint3 pll;
SPoint2 stereo(-point.x() / (1 + point.z()), -point.y() / (1 + 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()));
loop_buff << "Point ( IP + " << ip++ << " ) = {" << stereo.
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