All Projects → louisdh → Bezierpath Length

louisdh / Bezierpath Length

Licence: mit
A simple API to get the length of a CGPath, UIBezierPath or NSBezierPath, written in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Bezierpath Length

Bezierpath Polygons
Adds a convenience initalizer to UIBezierPath for generating n-sided regular polygon paths – with rounded corners support – in Swift!
Stars: ✭ 138 (+76.92%)
Mutual labels:  graphics, math, bezier
Wechart
Create all the [ch]arts by cax or three.js - Cax 和 three.js 创造一切图[表]
Stars: ✭ 152 (+94.87%)
Mutual labels:  graphics, bezier
Aardvark.base
Aardvark is an open-source platform for visual computing, real-time graphics and visualization. This repository is the basis for most platform libraries and provides basic functionality such as data-structures, math and much more.
Stars: ✭ 117 (+50%)
Mutual labels:  graphics, math
Animated Timeline
🔥 Create timeline and playback based animations in React
Stars: ✭ 197 (+152.56%)
Mutual labels:  graphics, bezier
Awesome Computer Graphics
🔺😎 A curated list of awesome stuff to learn computer graphics
Stars: ✭ 154 (+97.44%)
Mutual labels:  graphics, math
Cglm
📽 Highly Optimized Graphics Math (glm) for C
Stars: ✭ 887 (+1037.18%)
Mutual labels:  math, bezier
Ugm
Ubpa Graphics Mathematics
Stars: ✭ 178 (+128.21%)
Mutual labels:  graphics, math
Mathc
Pure C math library for 2D and 3D programming
Stars: ✭ 504 (+546.15%)
Mutual labels:  graphics, math
Macsvg
macSVG - An open-source macOS app for designing HTML5 SVG (Scalable Vector Graphics) art and animation with a WebKit web view ➤➤➤
Stars: ✭ 789 (+911.54%)
Mutual labels:  graphics, bezier
Handmade Math
A simple math library for games and computer graphics. Compatible with both C and C++.
Stars: ✭ 517 (+562.82%)
Mutual labels:  graphics, math
Sophus
C++ implementation of Lie Groups using Eigen.
Stars: ✭ 1,048 (+1243.59%)
Mutual labels:  graphics, math
Jglm
Java OpenGL Mathematics Library
Stars: ✭ 44 (-43.59%)
Mutual labels:  graphics, math
Spatialmath Python
Create, manipulate and convert representations of position and orientation in 2D or 3D using Python
Stars: ✭ 78 (+0%)
Mutual labels:  graphics, math
Algorithm
📌 Notes and Codes for studying data structures and algorithm
Stars: ✭ 71 (-8.97%)
Mutual labels:  math
Gpcs4
A Playstation 4 emulator just begin
Stars: ✭ 1,186 (+1420.51%)
Mutual labels:  graphics
Images example
A simple example program made for the 42 students going into the graphic branch. Its purpose is to help them understanding the way images are working in the MLX (the graphcal lib we use).
Stars: ✭ 69 (-11.54%)
Mutual labels:  graphics
Maths
Linear algebra library with vector swizzling, intersection tests and useful functions for games and graphics dev.
Stars: ✭ 69 (-11.54%)
Mutual labels:  math
Identikon
Racket scripts for generating identicons
Stars: ✭ 77 (-1.28%)
Mutual labels:  graphics
Maker.js
📐⚙ 2D vector line drawing and shape modeling for CNC and laser cutters.
Stars: ✭ 1,185 (+1419.23%)
Mutual labels:  bezier
Axis3d
Functional 3d graphics library
Stars: ✭ 67 (-14.1%)
Mutual labels:  graphics

[UI/NS]BezierPath + Length

Build Status codecov Code Climate Swift PodVersion platform Twitter Donate

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)

Requirements

  • iOS 8.0+ / macOS 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 9.0+

Installation

CocoaPods

To install, add the following line to your Podfile:

pod 'BezierPathLength', '~> 1.0.0'

How does it work?

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:

  • Linear
  • Quadratic curve
  • Cubic curve

See calculations.md for a detailed mathematical explanation of how the length of these three can be calculated.

License

This project is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].