[go: nahoru, domu]

Skip to content

Commit

Permalink
s2: Clarify docs on CellID.distanceFromBegin.
Browse files Browse the repository at this point in the history
Signed-off-by: David Symonds <dsymonds@golang.org>
  • Loading branch information
rsned authored and dsymonds committed Jul 30, 2020
1 parent 34624d3 commit 90a6f84
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions s2/cellid.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,10 @@ func (ci *CellID) decode(d *decoder) {
// TODO: the methods below are not exported yet. Settle on the entire API design
// before doing this. Do we want to mirror the C++ one as closely as possible?

// distanceFromBegin returns the number of steps that this cell is from the first
// node in the S2 hierarchy at our level. (i.e., FromFace(0).ChildBeginAtLevel(ci.Level())).
// distanceFromBegin returns the number of steps along the Hilbert curve that
// this cell is from the first node in the S2 hierarchy at our level. (i.e.,
// FromFace(0).ChildBeginAtLevel(ci.Level())). This is analogous to Pos(), but
// for this cell's level.
// The return value is always non-negative.
func (ci CellID) distanceFromBegin() int64 {
return int64(ci >> uint64(2*(maxLevel-ci.Level())+1))
Expand Down

0 comments on commit 90a6f84

Please sign in to comment.