Skip to content

drewcrawford/blitcurve

Repository files navigation

blitcurve

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.

status xcode platforms license

Installation

See the Installation page.

Using blitcurve

For more examples, see the Wiki and the Playgrounds directory.

Demos

Rect intersection

Intersecting rects at 4 gigaintersections/sec:

intersect

This demo is located here. For more details, see this blogpost.

Cubic drawing

24M paths per second

intersect This demo is located here

SwiftUI

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.

Drawing curves

See the LineShader demo.

About

A fast, GPU-ready bezier-curve implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published