Skip to content

Commit

Permalink
Name change: midPoint -> approxMidpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilot-Marc committed Dec 1, 2019
1 parent 2ae4850 commit 2f5f292
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ public extension CLLocation {

/// Returns the midpoint between two locations
/// Note: Only usable for short distances like MKPolyline segments
func midPoint(to: CLLocation) -> CLLocation {
func approxMidpoint(to: CLLocation) -> CLLocation {
return CLLocation(
coordinate: CLLocationCoordinate2D(
latitude: (coordinate.latitude + to.coordinate.latitude) / 2,
longitude: (coordinate.longitude + to.coordinate.longitude) / 2
),
altitude: (altitude + to.altitude) / 2
)
} // midPoint
} // approxMidpoint(to:)

}

Expand Down
2 changes: 1 addition & 1 deletion Sources/ARKit-CoreLocation/Nodes/PolylineNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private extension PolylineNode {
for i in 0 ..< polyline.pointCount - 1 {
let currentLocation = CLLocation(coordinate: points[i].coordinate, altitude: altitude)
let nextLocation = CLLocation(coordinate: points[i + 1].coordinate, altitude: altitude)
let midLocation = currentLocation.midPoint(to: nextLocation)
let midLocation = currentLocation.approxMidpoint(to: nextLocation)

let distance = currentLocation.distance(from: nextLocation)

Expand Down

0 comments on commit 2f5f292

Please sign in to comment.