TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0.2 |
SPMSupports SPM | ✗ |
Maintained by Louis Dhauwe.
This project provides a simple API to get the length of either a UIBezierPath
or NSBezierPath
. Example:
let rect = CGRect(origin: .zero, size: CGSize(width: 100, height: 300))
let path = UIBezierPath(ovalIn: rect)
// Length in pt.
let length = path.length
There's also an API for getting a point on a path at a certain percentage, example:
// CGPoint at 50% of path
let point = path.point(at: 0.5)
The actual calculations are implemented on a CGPath
extension, but a [UI/NS]BezierPath
extension is available for convenience.
Any CGPath
can be split into subpaths. Of which there are three types:
See calculations.md for a detailed mathematical explanation of how the length of these three can be calculated.
This project is available under the MIT license. See the LICENSE file for more info.