 	}
 	
 	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 point in sample {
			let newPoint = CGPoint(x: point.x+deltaX, y: point.y+deltaY)
			
			newSample.append(newPoint)
		}
		return newSample
	}
	
	func rotate(_ sample: [CGPoint], angle: CGFloat) -> [CGPoint] {
		let rotationTransform = CGAffineTransform(rotationAngle: angle)
		
