rgeo 0.3.19 → 0.3.20
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +4 -0
- data/README.rdoc +1 -1
- data/Version +1 -1
- data/lib/rgeo/geographic/spherical_math.rb +10 -6
- data/test/spherical_geographic/tc_calculations.rb +21 -0
- metadata +2 -2
data/History.rdoc
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
=== 0.3.20 / 2012-12-08
|
2
|
+
|
3
|
+
* Distances computed by the spherical factory were incorrect when covering more than 90 degrees of the globe. Fixed. (reported by exoth)
|
4
|
+
|
1
5
|
=== 0.3.19 / 2012-09-20
|
2
6
|
|
3
7
|
* The Geos factories, as well as the projected geographic convenience factories such as simple_mercator, now support the :uses_lenient_assertions option.
|
data/README.rdoc
CHANGED
@@ -61,7 +61,7 @@ Some features also require the following:
|
|
61
61
|
may be available via your operating system's package manager, or from
|
62
62
|
http://trac.osgeo.org/proj
|
63
63
|
* On some platforms, you should install the ffi-geos gem (version 0.0.6
|
64
|
-
or later recommended.) JRuby requires this gem to properly
|
64
|
+
or later recommended.) JRuby requires this gem to link properly with
|
65
65
|
Geos, and Windows builds probably do as well.
|
66
66
|
|
67
67
|
Note: The build system assumes a unix-like environment. Windows builds
|
data/Version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.20
|
@@ -118,12 +118,16 @@ module RGeo
|
|
118
118
|
rx_ = rhs_.x
|
119
119
|
ry_ = rhs_.y
|
120
120
|
rz_ = rhs_.z
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
121
|
+
dot_ = @x * rx_ + @y * ry_ + @z * rz_
|
122
|
+
if dot_ > -0.8 && dot_ < 0.8
|
123
|
+
::Math.acos(dot_)
|
124
|
+
else
|
125
|
+
x_ = @y*rz_-@z*ry_
|
126
|
+
y_ = @z*rx_-@x*rz_
|
127
|
+
z_ = @x*ry_-@y*rx_
|
128
|
+
as_ = ::Math.asin(::Math.sqrt(x_*x_ + y_*y_ + z_*z_))
|
129
|
+
dot_ > 0.0 ? as_ : ::Math::PI - as_
|
130
|
+
end
|
127
131
|
end
|
128
132
|
|
129
133
|
|
@@ -110,6 +110,27 @@ module RGeo
|
|
110
110
|
end
|
111
111
|
|
112
112
|
|
113
|
+
def test_distance_coincident
|
114
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
115
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
116
|
+
assert_equal(0.0, point1_.dist_to_point(point2_))
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
def test_distance_opposite
|
121
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
122
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(-1, 0, 0)
|
123
|
+
assert_close_enough(::Math::PI, point1_.dist_to_point(point2_))
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
def test_distance_right_angle
|
128
|
+
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 0, 0)
|
129
|
+
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(0, -1, 0)
|
130
|
+
assert_close_enough(::Math::PI / 2, point1_.dist_to_point(point2_))
|
131
|
+
end
|
132
|
+
|
133
|
+
|
113
134
|
def test_arc_axis
|
114
135
|
point1_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, 1, 0)
|
115
136
|
point2_ = ::RGeo::Geographic::SphericalMath::PointXYZ.new(1, -1, 0)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: RGeo is a geospatial data library for Ruby. It provides an implementation
|
15
15
|
of the Open Geospatial Consortium's Simple Features Specification, used by most
|