@@ -340,7 +340,7 @@ func benchmarkEdgeQueryFindClosest(b *testing.B, bmOpts *edgeQueryBenchmarkOptio
340340 index := NewShapeIndex ()
341341 opts := NewClosestEdgeQueryOptions ().MaxResults (1 ).IncludeInteriors (bmOpts .includeInteriors )
342342
343- radius := s1 .EarthAngleFromLength (unit . Length ( bmOpts .radiusKm ) * unit . Kilometer )
343+ radius := s1 .EarthAngleFromLength (bmOpts .radius )
344344 if bmOpts .maxDistanceFraction > 0 {
345345 opts .DistanceLimit (s1 .ChordAngleFromAngle (s1 .Angle (bmOpts .maxDistanceFraction ) * radius ))
346346 }
@@ -389,7 +389,7 @@ type edgeQueryBenchmarkOptions struct {
389389 targetType queryTargetType
390390 numTargetEdges int
391391 chooseTargetFromIndex bool
392- radiusKm float64
392+ radius unit. Length
393393 maxDistanceFraction float64
394394 maxErrorFraction float64
395395 targetRadiusFraction float64
@@ -401,8 +401,8 @@ type edgeQueryBenchmarkOptions struct {
401401// use in an edge query.
402402//
403403// Approximately numIndexEdges will be generated by the requested generator and
404- // inserted. The geometry is generated within a Cap of the radius specified
405- // by radiusKm (the index radius). Parameters with fraction in their
404+ // inserted. The geometry is generated within a Cap of the specified radius
405+ // (the index radius). Parameters with fraction in their
406406// names are expressed as a fraction of this radius.
407407//
408408// Also generates a set of target geometries for the query, based on the
@@ -438,7 +438,7 @@ func generateEdgeQueryWithTargets(opts *edgeQueryBenchmarkOptions, query *EdgeQu
438438 opts .randomSeed ++
439439 indexCap := CapFromCenterAngle (
440440 randomPoint (r ),
441- s1 .EarthAngleFromLength (unit . Length ( opts .radiusKm ) * unit . Kilometer ),
441+ s1 .EarthAngleFromLength (opts .radius ),
442442 )
443443
444444 query .Reset ()
@@ -455,10 +455,10 @@ func generateEdgeQueryWithTargets(opts *edgeQueryBenchmarkOptions, query *EdgeQu
455455 }
456456
457457 for i := 0 ; i < numTargets ; i ++ {
458- targetDist := fractionToRadius (opts .centerSeparationFraction , opts .radiusKm )
458+ targetDist := fractionToRadius (opts .centerSeparationFraction , opts .radius )
459459 targetCap := CapFromCenterAngle (
460460 sampleBoundaryFromCap (CapFromCenterAngle (indexCap .Center (), targetDist )),
461- fractionToRadius (opts .targetRadiusFraction , opts .radiusKm ),
461+ fractionToRadius (opts .targetRadiusFraction , opts .radius ),
462462 )
463463
464464 switch opts .targetType {
@@ -539,9 +539,9 @@ func sampleCellFromIndex(index *ShapeIndex) CellID {
539539 return iter .CellID ()
540540}
541541
542- func fractionToRadius (fraction , radiusKm float64 ) s1.Angle {
542+ func fractionToRadius (fraction float64 , radius unit. Length ) s1.Angle {
543543 if fraction < 0 {
544544 fraction = - randomFloat64 () * fraction
545545 }
546- return s1 .EarthAngleFromLength (unit .Length (fraction * radiusKm ) * unit . Kilometer )
546+ return s1 .EarthAngleFromLength (unit .Length (fraction ) * radius )
547547}
0 commit comments