These are the functions availabe right now:
distanceBetweenPoints(point1: CGPoint, point2: CGPoint) -> CGFloat
getAngleBetweenPoints(p1:CGPoint, p2: CGPoint, p3:CGPoint) -> Double
getAngleBetweenPointsInDegrees(p1:CGPoint, p2: CGPoint, p3:CGPoint) -> Double
arePointsCollinear(points:[CGPoint]) -> Bool
shortestDistanceBetweenLineAndPoint(point:CGPoint, l1:CGPoint, l2:CGPoint) -> CGFloat
isPointOnLine(point:CGPoint, l1:CGPoint, l2:CGPoint) -> Bool
doLineSegmentsIntersect(l1:CGPoint, l2:CGPoint, m1:CGPoint, m2:CGPoint) -> Bool
isQuadrilateral(points:[CGPoint])
reorderToConvexQuadrilateral(corners:[CGPoint]) -> [CGPoint]?
getCGRectFromPoints(topLeft: CGPoint,topRight: CGPoint,bottomRight: CGPoint,bottomLeft: CGPoint) -> CGRect?
isConvex(corners:[CGPoint]) -> Bool
isConcave(corners:[CGPoint]) -> Bool
isQuadrilateralRectangle(corners:[CGPoint]) -> Bool
isQuadrilateralSquare(corners:[CGPoint]) -> Bool
isQuadrilateralRhombus(corners:[CGPoint]) -> Bool
isPointInsideCircle(point:CGPoint, center:CGPoint, radius:CGFloat) -> Bool
isPointOnCircle(point:CGPoint, center:CGPoint, radius:CGFloat) -> Bool
isPointOnPolygon(point:CGPoint, polygon:[CGPoint]) -> Bool
isPointInsidePolygon(point:CGPoint, polygon:[CGPoint]) -> Bool
More functions on the way!
To run the example project, clone the repo, and run pod install
from the Example directory first.
Move the different points in the example around to see various functions being used.
To install with CocoaPods, simply add the following line to your Podfile:
pod 'SAGeometry'
Add the 'SAGeometry.swift file into your project
Srinija Ammapalli
SAGeometry is available under the MIT license. See the LICENSE file for more info.