SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <js...@us...> - 2010年12月30日 16:14:25
Revision: 8868
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8868&view=rev
Author: jswhit
Date: 2010年12月30日 16:14:19 +0000 (2010年12月30日)
Log Message:
-----------
detect projection out of range, set error flag.
Modified Paths:
--------------
 trunk/toolkits/basemap/src/PJ_hammer.c
Modified: trunk/toolkits/basemap/src/PJ_hammer.c
===================================================================
--- trunk/toolkits/basemap/src/PJ_hammer.c	2010年12月30日 13:09:06 UTC (rev 8867)
+++ trunk/toolkits/basemap/src/PJ_hammer.c	2010年12月30日 16:14:19 UTC (rev 8868)
@@ -2,6 +2,7 @@
 	double w; \
 	double m, rm;
 #define PJ_LIB__
+# define EPS 1.0e-10
 # include	<projects.h>
 PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff")
 	"\n\tMisc Sph, \n\tW= M=";
@@ -15,9 +16,15 @@
 }
 INVERSE(s_inverse); /* spheroid */
 double z;
-	z = sqrt(1. - (0.5 * P->w * xy.x) * (0.5 * P->w * xy.x) - (0.5 * xy.y) * (0.5 * xy.y));
-	lp.lam = aatan2(P->w * xy.x * z,2. * z * z - 1)/P->w;
-	lp.phi = aasin(z * xy.y);
+	z = sqrt(1. - 0.25*P->w*P->w*xy.x*xy.x - 0.25*xy.y*xy.y);
+	if (fabs(2.*z*z-1.) < EPS) {
+ lp.lam = HUGE_VAL;
+ lp.phi = HUGE_VAL;
+ pj_errno = -14;
+	} else {
+	 lp.lam = aatan2(P->w * xy.x * z,2. * z * z - 1)/P->w;
+	 lp.phi = aasin(z * xy.y);
+ }
 	return (lp);
 }
 FREEUP; if (P) pj_dalloc(P); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /