 import Foundation
 import CoreGraphics
 
-// MARK:- Clamp
+// MARK: - Clamp
 
 /// Clamp a float value to ensure it is between
 /// a minimum and maximum bounds (inclusive).

///
/// Use this method if all you need is to make a
/// comparison, but for actual distance use
/// `distance()` which is apparently less performant.
public func distanceSquared<F:BinaryFloatingPoint>(from point1:CGPoint, to point2:CGPoint) -> F {
    let xDistance = point2.x - point1.x
    let yDistance = point2.y - point1.y
    return F(pow(xDistance, 2)) + F(pow(yDistance, 2))
}

/// Get the absolute distance between two points.
///
/// Be wary of using this in critical/iterative code
/// because it must determine square root which is
/// apparently not-so-performant.
/// See also `distanceSquared()` if all you need is
/// to compare distances.
public func distance<F:BinaryFloatingPoint>(from point1:CGPoint, to point2:CGPoint) -> F {
    let xDistance = point2.x - point1.x
    let yDistance = point2.y - point1.y
    let distanceSquared = F(pow(xDistance, 2)) + F(pow(yDistance, 2))
    return distanceSquared.squareRoot()
    // (this could be replaced with hypotf(xDistance, yDistance)
    // if tests reveal any performance difference)
    // See C3.PointConvertible.delta() which uses hypotf()

    }
}

// MARK: - Angle

/// Simple struct representing an angle between 0º and 360º +/-
/// As this is ExpressibleByFloatLiteral, anywhere that takes
