summaryrefslogtreecommitdiff
path: root/vendor/github.com/golang/geo/s2/rect.go
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2017-03-19 15:19:42 +0000
committerFelix Hanley <felix@userspace.com.au>2017-03-19 15:19:42 +0000
commit8a541d499b6f117cd3a81e475ee779ba60fc0637 (patch)
tree7b3b5326235725ab93056b5ff4637d987fb0a7b6 /vendor/github.com/golang/geo/s2/rect.go
parentfe847b2d01060044274d20d2c35ae01a684d4ee3 (diff)
downloadcrjw-maps-8a541d499b6f117cd3a81e475ee779ba60fc0637.tar.gz
crjw-maps-8a541d499b6f117cd3a81e475ee779ba60fc0637.tar.bz2
use golang dep tool for depsHEADmaster
Diffstat (limited to 'vendor/github.com/golang/geo/s2/rect.go')
-rw-r--r--vendor/github.com/golang/geo/s2/rect.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/vendor/github.com/golang/geo/s2/rect.go b/vendor/github.com/golang/geo/s2/rect.go
index 134dc7e..6b5496a 100644
--- a/vendor/github.com/golang/geo/s2/rect.go
+++ b/vendor/github.com/golang/geo/s2/rect.go
@@ -21,6 +21,7 @@ import (
"math"
"github.com/golang/geo/r1"
+ "github.com/golang/geo/r3"
"github.com/golang/geo/s1"
)
@@ -239,7 +240,7 @@ func (r Rect) CapBound() Cap {
poleZ = 1
poleAngle = math.Pi/2 - r.Lat.Lo
}
- poleCap := CapFromCenterAngle(PointFromCoords(0, 0, poleZ), s1.Angle(poleAngle)*s1.Radian)
+ poleCap := CapFromCenterAngle(Point{r3.Vector{0, 0, poleZ}}, s1.Angle(poleAngle)*s1.Radian)
// For bounding rectangles that span 180 degrees or less in longitude, the
// maximum cap size is achieved at one of the rectangle vertices. For
@@ -298,14 +299,14 @@ func intersectsLatEdge(a, b Point, lat s1.Angle, lng s1.Interval) bool {
// the sphere. They can intersect a straight edge in 0, 1, or 2 points.
// First, compute the normal to the plane AB that points vaguely north.
- z := a.PointCross(b)
+ z := Point{a.PointCross(b).Normalize()}
if z.Z < 0 {
z = Point{z.Mul(-1)}
}
// Extend this to an orthonormal frame (x,y,z) where x is the direction
// where the great circle through AB achieves its maximium latitude.
- y := z.PointCross(PointFromCoords(0, 0, 1))
+ y := Point{z.PointCross(PointFromCoords(0, 0, 1)).Normalize()}
x := y.Cross(z.Vector)
// Compute the angle "theta" from the x-axis (in the x-y plane defined