Skip to content

all: fix some comments #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion s2/builder_snapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ func (sf CellIDSnapper) SnapPoint(point Point) Point {
}

const (
// The minum exponent supported for snapping.
// The minimum exponent supported for snapping.
minIntSnappingExponent = 0
// The maximum exponent supported for snapping.
maxIntSnappingExponent = 10
Expand Down
2 changes: 1 addition & 1 deletion s2/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (c Cell) VertexRaw(k int) Point {
return Point{faceUVToXYZ(int(c.face), c.uv.Vertices()[k].X, c.uv.Vertices()[k].Y)}
}

// Edge returns the nomalized inward-facing normal of the great circle passing through
// Edge returns the normalized inward-facing normal of the great circle passing through
// the CCW ordered edge from vertex k to vertex k+1 (mod 4) (for k = 0,1,2,3)
func (c Cell) Edge(k int) Point {
return Point{c.EdgeRaw(k).Normalize()}
Expand Down
2 changes: 1 addition & 1 deletion s2/edge_crossings.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func intersectionStableSorted(a0, a1, b0, b1 Point) (Point, bool) {
// is not guaranteed to have the correct sign (i.e., the return value may need
// to be negated).
func intersectionExact(a0, a1, b0, b1 Point) Point {
// Since we are using presice arithmetic, we don't need to worry about
// Since we are using precise arithmetic, we don't need to worry about
// numerical stability.
a0P := r3.PreciseVectorFromVector(a0.Vector)
a1P := r3.PreciseVectorFromVector(a1.Vector)
Expand Down
2 changes: 1 addition & 1 deletion s2/lexicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (l *sequenceLexicon) size() int {
return len(l.begins) - 1
}

// hash returns a hash of this sequence of int32s.
// hashSet returns a hash of this sequence of int32s.
func hashSet(s []int32) uint32 {
// TODO(roberts): We just need a way to nicely hash all the values down to
// a 32-bit value. To ensure no unnecessary dependencies we use the core
Expand Down
2 changes: 1 addition & 1 deletion s2/pointcompression.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func stToPiQi(s float64, level uint) uint32 {
return uint32(s * float64(int(1)<<level))
}

// siTiToPiQi returns the value transformed into the PiQi coordinate spade.
// siTitoPiQi returns the value transformed into the PiQi coordinate spade.
// encodeFirstPointFixedLength encodes the return value using level bits,
// so we clamp si to the range [0, 2**level - 1] before trying to encode
// it. This is okay because if si == maxSiTi, then it is not a cell center
Expand Down
6 changes: 3 additions & 3 deletions s2/polyline_alignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type columnStride struct {
end int
}

// inRange reports if the given index is in range of this stride.
// InRange reports if the given index is in range of this stride.
func (c columnStride) InRange(index int) bool {
return c.start <= index && index < c.end
}
Expand Down Expand Up @@ -235,7 +235,7 @@ func (w *window) checkedColumnStride(row int) columnStride {
return w.strides[row]
}

// upscale returns a new, larger window that is an upscaled version of this window.
// upsample returns a new, larger window that is an upscaled version of this window.
//
// Used by ApproximateAlignment window expansion step.
func (w *window) upsample(newRows, newCols int) *window {
Expand Down Expand Up @@ -402,7 +402,7 @@ func ExactVertexAlignmentCost(a, b *Polyline) float64 {
return cost[len(cost)-1]
}

// GetExactVertexAlignment takes two non-empty polylines as input, and returns
// ExactVertexAlignment takes two non-empty polylines as input, and returns
// the VertexAlignment corresponding to the optimal alignment between them. This
// method is quadratic O(A*B) in both space and time complexity.
func ExactVertexAlignment(a, b *Polyline) *vertexAlignment {
Expand Down
2 changes: 1 addition & 1 deletion s2/polyline_alignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,4 @@ func TestPolylineAlignmentExactAlignmentCost(t *testing.T) {

// TODO()rsned): Differences from C++
// Medoid tests
// Consensus testss
// Consensus tests
2 changes: 1 addition & 1 deletion s2/polyline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestPolylineBasics(t *testing.T) {
}
empty.Reverse()
if len(empty) != 0 {
t.Errorf("reveresed empty Polyline should have no vertices")
t.Errorf("reversed empty Polyline should have no vertices")
}

latlngs := []LatLng{
Expand Down
2 changes: 1 addition & 1 deletion s2/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func precSub(a, b *big.Float) *big.Float {
return new(big.Float).SetPrec(big.MaxPrec).Sub(a, b)
}

// precSub is a helper to wrap the boilerplate of multiplying two big.Floats.
// precMul is a helper to wrap the boilerplate of multiplying two big.Floats.
func precMul(a, b *big.Float) *big.Float {
return new(big.Float).SetPrec(big.MaxPrec).Mul(a, b)
}
Expand Down
4 changes: 2 additions & 2 deletions s2/predicates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ func testCompareDistancesConsistency(t *testing.T, x, a, b Point, distFunc compa
}

// choosePointNearPlaneOrAxes returns a random Point that is often near the
// intersection of one of the coodinates planes or coordinate axes with the unit
// intersection of one of the coordinates planes or coordinate axes with the unit
// sphere. (It is possible to represent very small perturbations near such points.)
func choosePointNearPlaneOrAxes() Point {
p := randomPoint()
Expand Down Expand Up @@ -1042,7 +1042,7 @@ func TestPredicatesSignDotProd(t *testing.T) {
for _, test := range tests {
got := SignDotProd(test.a, test.b)
if got != test.want {
t.Errorf("SignDotProd(%+v, %+v) = %d, wnat %d", test.a, test.b, got, test.want)
t.Errorf("SignDotProd(%+v, %+v) = %d, want %d", test.a, test.b, got, test.want)
}

gotPrec := "EXACT"
Expand Down
2 changes: 1 addition & 1 deletion s2/query_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestQueryQueueEntry(t *testing.T) {
t.Errorf("number of elements different: got %d, want %d", got, want)
}

// Take the items out and verfy the queue has them in the preferred order.
// Take the items out and verify the queue has them in the preferred order.
for i, cid := range expectedCellIDs {
item := q.pop()
if item.id != cid {
Expand Down
2 changes: 1 addition & 1 deletion s2/s2intersect/s2intersect.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func cellUnionToIntervalLimits(cu s2.CellUnion, idx int) []*limit {

// collapseLimits returns a slice of limits such that all of those of the same
// type at the same leaf CellID are grouped with their indices in the same
// slice. The returned slice will be sorted by CellID and tyoe,
// slice. The returned slice will be sorted by CellID and type,
//
// e.g. {leaf(x),start,indices[2]} and {leaf(x),start,indices[7]} will become
// {leaf(x),start,indices[2,7]}.
Expand Down
2 changes: 1 addition & 1 deletion s2/shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ type Shape interface {
// Chain(i).start + Chain(i).length == NumEdges(), for i == NumChains()-1
Chain(chainID int) Chain

// ChainEdgeReturns the edge at offset "offset" within edge chain "chainID".
// ChainEdge returns the edge at offset "offset" within edge chain "chainID".
// Equivalent to "shape.Edge(shape.Chain(chainID).start + offset)"
// but more efficient.
ChainEdge(chainID, offset int) Edge
Expand Down
2 changes: 1 addition & 1 deletion s2/shapeindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ func (s *ShapeIndex) clipVBound(edge *clippedEdge, vEnd int, v float64) *clipped
return s.updateBound(edge, uEnd, u, vEnd, v)
}

// cliupVAxis returns the given edge clipped to within the boundaries of the middle
// clipVAxis returns the given edge clipped to within the boundaries of the middle
// interval along the v-axis, and adds the result to its children.
func (s *ShapeIndex) clipVAxis(edge *clippedEdge, middle r1.Interval) (a, b *clippedEdge) {
if edge.bound.Y.Hi <= middle.Lo {
Expand Down
4 changes: 2 additions & 2 deletions s2/stuv.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import (
// (x, y, z)
// Direction vector (Point). Direction vectors are not necessarily unit
// length, and are often chosen to be points on the biunit cube
// [-1,+1]x[-1,+1]x[-1,+1]. They can be be normalized to obtain the
// [-1,+1]x[-1,+1]x[-1,+1]. They can be normalized to obtain the
// corresponding point on the unit sphere.
//
// (lat, lng)
Expand Down Expand Up @@ -427,7 +427,7 @@ func uvwAxis(face, axis int) Point {
return faceUVWAxes[face][axis]
}

// uvwFaces returns the face in the (u,v,w) coordinate system on the given axis
// uvwFace returns the face in the (u,v,w) coordinate system on the given axis
// in the given direction.
func uvwFace(face, axis, direction int) int {
return faceUVWFaces[face][axis][direction]
Expand Down