Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Commit

Permalink
Revert "[Pravish|Deva] Changing the order of bbox returned by Surroun…
Browse files Browse the repository at this point in the history
…d and Added test to check Overlap when one bbox contains another bbox"

This reverts commit 3d8ffc7.
  • Loading branch information
dvrajan committed Jul 27, 2016
1 parent 3d8ffc7 commit 84909ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion measurement.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func Surround(point *Point, width float64) []float64 {
bottomLeft := translate(point, -width, -width)
topRight := translate(point, width, width)

bbox := []float64{bottomLeft.Lat, bottomLeft.Lng, topRight.Lat, topRight.Lng}
bbox := []float64{bottomLeft.Lng, bottomLeft.Lat, topRight.Lng, topRight.Lat}

return bbox
}
23 changes: 8 additions & 15 deletions measurement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,6 @@ func TestOverlap(t *testing.T) {
So(err, ShouldBeNil)
So(b, ShouldBeTrue)

// overlap where a bbox encloses another bbox
b1 = []float64{13.078112803113676, 80.26982402002491, 13.087103196886325, 80.27905397997509}
b2 = []float64{13.082897, 80.274340, 13.082769, 80.273581}
b, err = Overlap(b1, b2)
So(err, ShouldBeNil)
So(b, ShouldBeTrue)

// overlap where no point of either bbox reside inside any bbox
b1 = []float64{-0.2197265625, 19.31114335506464, 13.447265624999998, 28.304380682962783}
b2 = []float64{-4.2197265625, 21.24997445586331, 26.876953125, 24.88905007936091}
Expand All @@ -265,10 +258,10 @@ func TestSurround(t *testing.T) {

bBox := Surround(point, width)

So(bBox[0], ShouldEqual, 13.040144803113675)
So(bBox[1], ShouldEqual, 80.2622657295878)
So(bBox[2], ShouldEqual, 13.049135196886324)
So(bBox[3], ShouldEqual, 80.2714942704122)
So(bBox[0], ShouldEqual, 80.2622657295878)
So(bBox[1], ShouldEqual, 13.040144803113675)
So(bBox[2], ShouldEqual, 80.2714942704122)
So(bBox[3], ShouldEqual, 13.049135196886324)
})

Convey("Given a point and bbox width as zero, should return the same point as bbox", t, func() {
Expand All @@ -277,9 +270,9 @@ func TestSurround(t *testing.T) {

bBox := Surround(point, width)

So(bBox[0], ShouldEqual, 35.4691)
So(bBox[1], ShouldEqual, -97.522259)
So(bBox[2], ShouldEqual, 35.4691)
So(bBox[3], ShouldEqual, -97.522259)
So(bBox[0], ShouldEqual, -97.522259)
So(bBox[1], ShouldEqual, 35.4691)
So(bBox[2], ShouldEqual, -97.522259)
So(bBox[3], ShouldEqual, 35.4691)
})
}

0 comments on commit 84909ed

Please sign in to comment.