blitcurve is a C/C++ library for bezier curves and similar 2D geometric primitives, including common algorithms.
These mathematical objects have applications in games, animations, physical behaviors, simulations, etc.
blitcurve has a first-class Swift API for use in iOS and macOS applications. It also cross-compiles for Metal and can be used entirely on-GPU, in which case it is many orders-of-magnitude faster than alternative bezier curve approaches.
See the Installation page.
For more examples, see the Wiki and the Playgrounds directory.
Intersecting rects at 4 gigaintersections/sec:
This demo is located here. For more details, see this blogpost.
24M paths per second
This demo is located here
Many types embed a View
type which is a SwiftUI view.
let cubic = Cubic(a: .zero, b: SIMD2<Float>(20,10),c: SIMD2<Float>(7,7),d: SIMD2<Float>(5,5))
struct Demo: View {
var body: some View {
ZStack {
Cubic.View(cubic).scale(by: 5)
}
}
}
For more examples, see the Playgrounds folder.
See the LineShader demo.