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
Branches
Tags
No related merge requests found
...@@ -89,8 +89,8 @@ SPoint3 gmshPolarSphere::point(double parA, double parB) const ...@@ -89,8 +89,8 @@ SPoint3 gmshPolarSphere::point(double parA, double parB) const
//at the center of the sphere //at the center of the sphere
//parA=2rx/(r+z) parB=2ry/(r+z) //parA=2rx/(r+z) parB=2ry/(r+z)
double rp2 = parA * parA + parB * parB; double rp2 = parA * parA + parB * parB;
SPoint3 p(2*parA/(1+rp2),2*parB/(1+rp2),(rp2-1)/(rp2+1)); double z=r*(4*r*r-rp2)/(4*r*r+rp2);
p *= -r; SPoint3 p(parA*(r+z)/(2*r),parB*(r+z)/(2*r),z);
p += o; p += o;
return p; return p;
} }
...@@ -135,7 +135,7 @@ SPoint3 gmshParametricSurface::point(double par1, double par2) const ...@@ -135,7 +135,7 @@ SPoint3 gmshParametricSurface::point(double par1, double par2) const
Msg::Error("MathEval is not compiled in this version of Gmsh"); Msg::Error("MathEval is not compiled in this version of Gmsh");
return SPoint3(0.,0.,0.); return SPoint3(0.,0.,0.);
#else #else
char *names[2] = {"u", "v"}; char *names[2] = {(char*)"u", (char*)"v"};
double values [2] = {par1, par2}; double values [2] = {par1, par2};
const double x = evaluator_evaluate(evalX, 2, names, values); const double x = evaluator_evaluate(evalX, 2, names, values);
const double y = evaluator_evaluate(evalY, 2, names, values); const double y = evaluator_evaluate(evalY, 2, names, values);
......
...@@ -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.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 * Include file defining structures used in gshhs.c
* *
...@@ -766,8 +766,8 @@ class GMSH_GSHHSPlugin:public GMSH_Post_Plugin ...@@ -766,8 +766,8 @@ class GMSH_GSHHSPlugin:public GMSH_Post_Plugin
file->close(); file->close();
} }
void add_point(SPoint3 point){ void add_point(SPoint3 point){
SPoint3 pll; double r=sqrt(point.x()*point.x()+point.y()*point.y()+point.z()*point.z());
SPoint2 stereo(-point.x() / (1 + point.z()), -point.y() / (1 + point.z())); SPoint2 stereo(2*r*point.x() / (r + point.z()), 2*r*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