diff options
author | Mathias Stearn <mathias@10gen.com> | 2010-08-16 20:15:31 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2010-08-24 14:06:47 -0400 |
commit | 4e234c4959e379e2b1ad43745a7a98df32a2b17b (patch) | |
tree | cfd553b5eeff824305e2fd384a840d8699463139 /db/geo/core.h | |
parent | 54572e15b6c8f0484932da032ff9a3b1db8a9a7d (diff) | |
download | mongo-4e234c4959e379e2b1ad43745a7a98df32a2b17b.tar.gz |
$centerSphere test and fixes to make it pass
Diffstat (limited to 'db/geo/core.h')
-rw-r--r-- | db/geo/core.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/db/geo/core.h b/db/geo/core.h index 6d3c037f588..e0e39c13b1c 100644 --- a/db/geo/core.h +++ b/db/geo/core.h @@ -415,6 +415,12 @@ namespace mongo { (cos_y1*cos_x1 * cos_y2*cos_x2) + (cos_y1*sin_x1 * cos_y2*sin_x2) + (sin_y1 * sin_y2); + + if (cross_prod >= 1 || cross_prod <= -1){ + // fun with floats + assert( fabs(cross_prod)-1 < 1e-6 ); + return cross_prod > 0 ? 0 : M_PI; + } return acos(cross_prod); } |