Skip to content

Commit

Permalink
Merge pull request #6 from chintan369/feature_resolve_issues
Browse files Browse the repository at this point in the history
- Converted given Radius in meter
  • Loading branch information
chintan369 authored Aug 20, 2019
2 parents f506407 + 169daf0 commit e97eb47
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
30 changes: 30 additions & 0 deletions .idea/sonarIssues.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ class BoundingBoxUtils(private val distanceUnit: DistanceUnit) {
}

private fun pointAtDistance(queryLocation: QueryLocation, distance: Double): GeoPoint {
val sinLat = Math.sin(queryLocation.latitude)
val cosLat = Math.cos(queryLocation.latitude)
val sinLat = sin(queryLocation.latitude)
val cosLat = cos(queryLocation.latitude)

val bearing = Math.random().times(TWO_PI)
val theta = when (distanceUnit) {
DistanceUnit.KILOMETERS -> distance.div(EARTH_RADIUS_KM)
DistanceUnit.MILES -> distance.div(EARTH_RADIUS_MILES)
DistanceUnit.KILOMETERS -> distance.times(1000).div(EARTH_RADIUS_KM)
DistanceUnit.MILES -> distance.times(1000).div(EARTH_RADIUS_MILES)
}

val sinBearing = sin(bearing)
Expand All @@ -115,11 +115,11 @@ class BoundingBoxUtils(private val distanceUnit: DistanceUnit) {

companion object {

private val EARTH_RADIUS_KM = 6371.000//6371.001
private val EARTH_RADIUS_MILES = 3958.756
private const val EARTH_RADIUS_KM = 6371000//6371.001
private const val EARTH_RADIUS_MILES = 3958756

private val THREE_PI = Math.PI.times(3)
private val TWO_PI = Math.PI.times(2)
private const val THREE_PI = Math.PI.times(3)
private const val TWO_PI = Math.PI.times(2)

private val MINIMUM_LATITUDE = Math.toRadians(-90.0) // -PI/2
private val MAXIMUM_LATITUDE = Math.toRadians(90.0) // PI/2
Expand Down

0 comments on commit e97eb47

Please sign in to comment.