@@ -23,10 +23,10 @@ import (
23
23
"strconv"
24
24
"strings"
25
25
26
- "github.com/golang /geo/r1"
27
- "github.com/golang /geo/r2"
28
- "github.com/golang /geo/r3"
29
- "github.com/golang /geo/s1"
26
+ "github.com/philiphil /geo/r1"
27
+ "github.com/philiphil /geo/r2"
28
+ "github.com/philiphil /geo/r3"
29
+ "github.com/philiphil /geo/s1"
30
30
)
31
31
32
32
// CellID uniquely identifies a cell in the S2 cell decomposition.
@@ -39,15 +39,15 @@ import (
39
39
// Sequentially increasing cell IDs follow a continuous space-filling curve
40
40
// over the entire sphere. They have the following properties:
41
41
//
42
- // - The ID of a cell at level k consists of a 3-bit face number followed
43
- // by k bit pairs that recursively select one of the four children of
44
- // each cell. The next bit is always 1, and all other bits are 0.
45
- // Therefore, the level of a cell is determined by the position of its
46
- // lowest-numbered bit that is turned on (for a cell at level k, this
47
- // position is 2 * (maxLevel - k)).
42
+ // - The ID of a cell at level k consists of a 3-bit face number followed
43
+ // by k bit pairs that recursively select one of the four children of
44
+ // each cell. The next bit is always 1, and all other bits are 0.
45
+ // Therefore, the level of a cell is determined by the position of its
46
+ // lowest-numbered bit that is turned on (for a cell at level k, this
47
+ // position is 2 * (maxLevel - k)).
48
48
//
49
- // - The ID of a parent cell is at the midpoint of the range of IDs spanned
50
- // by its children (or by its descendants at any level).
49
+ // - The ID of a parent cell is at the midpoint of the range of IDs spanned
50
+ // by its children (or by its descendants at any level).
51
51
//
52
52
// Leaf cells are often used to represent points on the unit sphere, and
53
53
// this type provides methods for converting directly between these two
@@ -373,9 +373,9 @@ func (ci CellID) LatLng() LatLng { return LatLngFromPoint(Point{ci.rawPoint()})
373
373
374
374
// ChildBegin returns the first child in a traversal of the children of this cell, in Hilbert curve order.
375
375
//
376
- // for ci := c.ChildBegin(); ci != c.ChildEnd(); ci = ci.Next() {
377
- // ...
378
- // }
376
+ // for ci := c.ChildBegin(); ci != c.ChildEnd(); ci = ci.Next() {
377
+ // ...
378
+ // }
379
379
func (ci CellID ) ChildBegin () CellID {
380
380
ol := ci .lsb ()
381
381
return CellID (uint64 (ci ) - ol + ol >> 2 )
@@ -644,7 +644,7 @@ func stToIJ(s float64) int {
644
644
// s2.CellIDs are considered to be closed sets. The returned cell will
645
645
// always contain the given point, i.e.
646
646
//
647
- // CellFromPoint(p).ContainsPoint(p)
647
+ // CellFromPoint(p).ContainsPoint(p)
648
648
//
649
649
// is always true.
650
650
func cellIDFromPoint (p Point ) CellID {
@@ -839,19 +839,19 @@ func expandEndpoint(u, maxV, sinDist float64) float64 {
839
839
// it contains all points within 5km of the original cell. You can then
840
840
// test whether a point lies within the expanded bounds like this:
841
841
//
842
- // if u, v, ok := faceXYZtoUV(face, point); ok && bound.ContainsPoint(r2.Point{u,v}) { ... }
842
+ // if u, v, ok := faceXYZtoUV(face, point); ok && bound.ContainsPoint(r2.Point{u,v}) { ... }
843
843
//
844
844
// Limitations:
845
845
//
846
- // - Because the rectangle is drawn on one of the six cube-face planes
847
- // (i.e., {x,y,z} = +/-1), it can cover at most one hemisphere. This
848
- // limits the maximum amount that a rectangle can be expanded. For
849
- // example, CellID bounds can be expanded safely by at most 45 degrees
850
- // (about 5000 km on the Earth's surface).
846
+ // - Because the rectangle is drawn on one of the six cube-face planes
847
+ // (i.e., {x,y,z} = +/-1), it can cover at most one hemisphere. This
848
+ // limits the maximum amount that a rectangle can be expanded. For
849
+ // example, CellID bounds can be expanded safely by at most 45 degrees
850
+ // (about 5000 km on the Earth's surface).
851
851
//
852
- // - The implementation is not exact for negative distances. The resulting
853
- // rectangle will exclude all points within the given distance of the
854
- // boundary but may be slightly smaller than necessary.
852
+ // - The implementation is not exact for negative distances. The resulting
853
+ // rectangle will exclude all points within the given distance of the
854
+ // boundary but may be slightly smaller than necessary.
855
855
func expandedByDistanceUV (uv r2.Rect , distance s1.Angle ) r2.Rect {
856
856
// Expand each of the four sides of the rectangle just enough to include all
857
857
// points within the given distance of that side. (The rectangle may be
@@ -872,7 +872,7 @@ func expandedByDistanceUV(uv r2.Rect, distance s1.Angle) r2.Rect {
872
872
// a given range (a tiling). This example shows how to generate a tiling
873
873
// for a semi-open range of leaf cells [start, limit):
874
874
//
875
- // for id := start.MaxTile(limit); id != limit; id = id.Next().MaxTile(limit)) { ... }
875
+ // for id := start.MaxTile(limit); id != limit; id = id.Next().MaxTile(limit)) { ... }
876
876
//
877
877
// Note that in general the cells in the tiling will be of different sizes;
878
878
// they gradually get larger (near the middle of the range) and then
0 commit comments