-
Notifications
You must be signed in to change notification settings - Fork 189
Removing "earth" overlap from S2 tests #246
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
Open
benguild
wants to merge
1
commit into
golang:master
Choose a base branch
from
benguild:s2TestsNoEarth
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,8 +222,8 @@ const edgeQueryTestNumIndexes = 50 | |
| const edgeQueryTestNumEdges = 100 | ||
| const edgeQueryTestNumQueries = 200 | ||
|
|
||
| // The approximate radius of Cap from which query edges are chosen. | ||
| var testCapRadius = kmToAngle(10) | ||
| // testCapRadius is the angular radius of the Cap from which query edges are chosen. | ||
| var testCapRadius = testRadiusMedium | ||
|
|
||
| /* | ||
| // testEdgeQueryWithGenerator is used to perform high volume random testing on EdqeQuery | ||
|
|
@@ -340,7 +340,7 @@ func benchmarkEdgeQueryFindClosest(b *testing.B, bmOpts *edgeQueryBenchmarkOptio | |
| index := NewShapeIndex() | ||
| opts := NewClosestEdgeQueryOptions().MaxResults(1).IncludeInteriors(bmOpts.includeInteriors) | ||
|
|
||
| radius := kmToAngle(bmOpts.radiusKm.Radians()) | ||
| radius := bmOpts.radius | ||
| if bmOpts.maxDistanceFraction > 0 { | ||
| opts.DistanceLimit(s1.ChordAngleFromAngle(s1.Angle(bmOpts.maxDistanceFraction) * radius)) | ||
| } | ||
|
|
@@ -389,7 +389,7 @@ type edgeQueryBenchmarkOptions struct { | |
| targetType queryTargetType | ||
| numTargetEdges int | ||
| chooseTargetFromIndex bool | ||
| radiusKm s1.Angle | ||
| radius s1.Angle | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one looks reasonable to fix since km is not an angle |
||
| maxDistanceFraction float64 | ||
| maxErrorFraction float64 | ||
| targetRadiusFraction float64 | ||
|
|
@@ -402,7 +402,7 @@ type edgeQueryBenchmarkOptions struct { | |
| // | ||
| // Approximately numIndexEdges will be generated by the requested generator and | ||
| // inserted. The geometry is generated within a Cap of the radius specified | ||
| // by radiusKm (the index radius). Parameters with fraction in their | ||
| // by radius (the index radius). Parameters with fraction in their | ||
| // names are expressed as a fraction of this radius. | ||
| // | ||
| // Also generates a set of target geometries for the query, based on the | ||
|
|
@@ -436,7 +436,7 @@ func generateEdgeQueryWithTargets(opts *edgeQueryBenchmarkOptions, query *EdgeQu | |
| // Replace with r := rand.New(rand.NewSource(opts.randomSeed)) and pass through. | ||
| r := rand.New(rand.NewSource(opts.randomSeed)) | ||
| opts.randomSeed++ | ||
| indexCap := CapFromCenterAngle(randomPoint(r), opts.radiusKm) | ||
| indexCap := CapFromCenterAngle(randomPoint(r), opts.radius) | ||
|
|
||
| query.Reset() | ||
| queryIndex.Reset() | ||
|
|
@@ -452,10 +452,10 @@ func generateEdgeQueryWithTargets(opts *edgeQueryBenchmarkOptions, query *EdgeQu | |
| } | ||
|
|
||
| for i := 0; i < numTargets; i++ { | ||
| targetDist := fractionToRadius(opts.centerSeparationFraction, opts.radiusKm.Radians()) | ||
| targetDist := fractionToRadius(opts.centerSeparationFraction, opts.radius) | ||
| targetCap := CapFromCenterAngle( | ||
| sampleBoundaryFromCap(CapFromCenterAngle(indexCap.Center(), targetDist)), | ||
| fractionToRadius(opts.targetRadiusFraction, opts.radiusKm.Radians())) | ||
| fractionToRadius(opts.targetRadiusFraction, opts.radius)) | ||
|
|
||
| switch opts.targetType { | ||
| case queryTypePoint: | ||
|
|
@@ -535,9 +535,9 @@ func sampleCellFromIndex(index *ShapeIndex) CellID { | |
| return iter.CellID() | ||
| } | ||
|
|
||
| func fractionToRadius(fraction, radiusKm float64) s1.Angle { | ||
| func fractionToRadius(fraction float64, radius s1.Angle) s1.Angle { | ||
| if fraction < 0 { | ||
| fraction = -randomFloat64() * fraction | ||
| } | ||
| return s1.Angle(fraction) * kmToAngle(radiusKm) | ||
| return s1.Angle(fraction) * radius | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not really helpful to me as a reader of the code. I know what 10 km on the Earth is. I need to go look to find out what
testRadiusMediumis.What is the problem you're trying to solve?