Skip to content

Fix some small issues that were flagged by upcoming lint checks. #138

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 3 commits into from
Apr 3, 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: 0 additions & 2 deletions s2/cell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,6 @@ func TestCellDistanceToEdge(t *testing.T) {
expectedError = 3e-8
} else if expectedMin.Radians() <= math.Pi/3 {
expectedError = 1e-15
} else {
expectedError = 1e-12
}

if !float64Near(expectedMin.Radians(), actualMin.Radians(), expectedError) {
Expand Down
1 change: 0 additions & 1 deletion s2/edge_distances.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ func updateEdgePairMinDistance(a0, a1, b0, b1 Point, minDist s1.ChordAngle) (s1.
return 0, false
}
if CrossingSign(a0, a1, b0, b1) == Cross {
minDist = 0
return 0, true
}

Expand Down
2 changes: 1 addition & 1 deletion s2/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func (p Point) IsNormalizable() bool {
func (p Point) EnsureNormalizable() Point {
// TODO(rsned): Zero vector isn't normalizable, and we don't have DCHECK in Go.
// What is the appropriate return value in this case? Is it {NaN, NaN, NaN}?
if p == (Point{r3.Vector{0, 0, 0}}) {
if p == (Point{r3.Vector{X: 0, Y: 0, Z: 0}}) {
return p
}
if !p.IsNormalizable() {
Expand Down
6 changes: 4 additions & 2 deletions s2/shapeindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -1466,9 +1466,11 @@ func (s *ShapeIndex) absorbIndexCell(p *PaddedCell, iter *ShapeIndexIterator, ed
}

// Update the edge list and delete this cell from the index.
edges, newEdges = newEdges, edges
// TODO(rsned): Figure out best fix for this. Linters are
// flagging the swap because newEdges is no longer used after
// this.
edges, newEdges = newEdges, edges // nolint
delete(s.cellMap, p.id)
// TODO(roberts): delete from s.Cells
}

// testAllEdges calls the trackers testEdge on all edges from shapes that have interiors.
Expand Down