Skip to content

Lint fixes. #123

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
Mar 23, 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
5 changes: 3 additions & 2 deletions s2/cellid.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,9 @@ func CellIDFromString(s string) CellID {
}
id := CellIDFromFace(face)
for i := 2; i < len(s); i++ {
childPos := s[i] - '0'
if childPos < 0 || childPos > 3 {
var childPos byte = s[i] - '0'
// Bytes are non-negative.
if childPos > 3 {
return CellID(0)
}
id = id.Children()[childPos]
Expand Down
27 changes: 15 additions & 12 deletions s2/edge_distances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ func TestEdgeDistanceUpdateMinInteriorDistanceMaxError(t *testing.T) {
}
a1 := PointOnLine(a0, randomPoint(), length)

// TODO(ericv): The error bound holds for antipodal points, but the S2
// TODO(rsned): The error bound holds for antipodal points, but the S2
// predicates used to test the error do not support antipodal points yet.
if a1.Vector == a0.Mul(-1) {
continue
Expand All @@ -545,22 +545,25 @@ func TestEdgeDistanceUpdateMinInteriorDistanceMaxError(t *testing.T) {
minDist := s1.InfChordAngle()

var ok bool
if minDist, ok = UpdateMinInteriorDistance(x, a0, a1, minDist); !ok {
// TODO(rsned): The first param here should be minDist which is needed
// for the two commented out tests below. When they are implemented
// return this to "if minDist, ok == Update...."
if _, ok = UpdateMinInteriorDistance(x, a0, a1, minDist); !ok {
iter--
continue
}
// TODO(rsned): Uncomment once predicates has CompareEdgeDistance
/*
maxErr := minUpdateDistanceMaxError(minDist)
if got := CompareEdgeDistance(x, a0, a1, minDist.Expanded(maxErr)); got > 0 {
t.Errorf("CompareEdgeDistance(%v, %v, %v, %v) = got, want <= 0",
x, a0, a1, minDist.Expanded(maxErr), got)

}
if got := CompareEdgeDistance(x, a0, a1, minDist.Expanded(-maxErr)); got < 0 {
t.Errorf("CompareEdgeDistance(%v, %v, %v, %v) = got, want >= 0",
x, a0, a1, minDist.Expanded(-maxErr), got)
}
maxErr := minUpdateDistanceMaxError(minDist)
if got := CompareEdgeDistance(x, a0, a1, minDist.Expanded(maxErr)); got > 0 {
t.Errorf("CompareEdgeDistance(%v, %v, %v, %v) = got, want <= 0",
x, a0, a1, minDist.Expanded(maxErr), got)

}
if got := CompareEdgeDistance(x, a0, a1, minDist.Expanded(-maxErr)); got < 0 {
t.Errorf("CompareEdgeDistance(%v, %v, %v, %v) = got, want >= 0",
x, a0, a1, minDist.Expanded(-maxErr), got)
}
*/
}
}
Expand Down
2 changes: 1 addition & 1 deletion s2/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ func exactIntersectionOrdering(a, b, c, d, m, n r3.PreciseVector) int {
//
// > gappa proof.gappa
// Results:
//| diff_ - diff| in [0, 1145679351550454559b-107 {7.06079e-15, 2^(-47.0091)}]
// | diff_ - diff| in [0, 1145679351550454559b-107 {7.06079e-15, 2^(-47.0091)}]
//
// >>> 1145679351550454559*2**-107/2**-52
// 31.79898987322334
Expand Down