 	}
 	
 	func distanceAtBestAngle(_ path: [CGPoint], template: [CGPoint]) -> CGFloat {
-		var a: CGFloat = -0.25 * CGFloat(M_PI)
+		var a: CGFloat = -0.25 * CGFloat(Double.pi)
 		var b: CGFloat = -a
 		let threshold: CGFloat = 0.1
 		let phi: CGFloat = 0.5 * (-1.0 + sqrt(5.0)) // Golden Ratio

		let boundariesDeltaX = boundaries.topRight.x - boundaries.bottomLeft.x
		let boundariesDeltaY = boundaries.topRight.y - boundaries.bottomLeft.y
		let scale = 2.0 / (boundariesDeltaX < boundariesDeltaY ? boundariesDeltaY : boundariesDeltaX )

		sample = self.scale(sample, xScale: scale, yScale: scale)

		center = self.centroid(sample)
		sample = self.translate(sample, deltaX: -center.x, deltaY: -center.y)
		

		for index in 0..<self.points.count {
			let computedIndex = (self.points.count - 1) * index / (size - 1)
			let newIndex = 0 < computedIndex ? computedIndex : 0
			
			if newIndex < self.points.count {
				let newPoint = self.points[newIndex]
				
				newSample.append(newPoint)
			}
		}
		
		return newSample
