Qaws (قوس) Arabic for *arc*, *bow*, *curve*. A dependency-free C11
library for creating, evaluating, sampling, traversing, and inspecting
parametric curves and surfaces in 2D and 3D.

A dependency-free C11 library for parametric curves and surfaces in 2D/3D.
1/13

A dependency-free C11 library for parametric curves and surfaces in 2D/3D.

13 curve families, 5 surface types, one source that compiles as C, HLSL, GLSL, and Halide.

github.com/soufianekhiat/qaws
2/13

Curve families:

Bezier, Hermite, Catmull-Rom, B-Spline, NURBS, Trajectory, Yuksel C2, Rational Bezier, Arc, Polynomial, Clothoid, Subdivision, Composite.

All share the same eval/sample/traverse/inspect API after creation.
3/13

Surfaces:

Bezier patch, B-Spline, NURBS, Swept (profile along path), Ruled (linear blend of two curves).

Evaluation gives you the surface point, partial derivatives, and normal in one call.
4/13

Evaluation:

- Position + derivatives up to D3
- Per-span eval for splines
- SIMD batch eval (AVX2, SSE2, NEON)
- float or double via compile-time switch
5/13

Sampling modes:

- Uniform
- Adaptive (error-tolerance)
- Curvature-weighted
- Feature-preserving (catches inflections)
- Streaming (callback, no big allocations)
6/13

Traversal:

- Parameter, arc-length, or timed
- Motion profiles: constant speed, trapezoidal, S-curve, custom
- 10 easing functions
- Wrap: clamp, loop, ping-pong
- Multi-curve traversal
7/13

Inspection:

Arc length, bounding box, closest point, tangent, normal, curvature, torsion, Frenet frame, inflection points, extrema, winding number, curvature comb, curve-curve intersection, self-intersection.
8/13

Operations:

Split, join, offset (2D with self-intersection cleanup), reverse, arc-length reparameterization.

Conversions: Hermite/CatmullRom to Bezier, Bezier to B-Spline, B-Spline to NURBS, degree elevation/reduction.
9/13

Import/Export:

- SVG path data
- Polyline export (uniform or curvature-weighted)
- Polyline import as Catmull-Rom or Trajectory
- B-spline fitting (least-squares)
10/13

Multi-backend: the same core headers compile as C, HLSL, GLSL, and Halide. Write your curve math once, run it on CPU and GPU.

Prepare functions pack coefficients for CPU-to-GPU upload.
11/13

Design:

- Zero deps (C11 stdlib only)
- Immutable + thread-safe after creation
- Opaque handles
- Status codes everywhere
- Custom allocators
- Stack-allocated curves for hot paths (no malloc, degree <= 7)
12/13

Tested on Linux, macOS, Windows in both f32 and f64. CI on every push.

MIT licensed.

github.com/soufianekhiat/qaws
13/13

@SoufianeKHIAT ooooh HYPE!!! 〽️ 🥳
This is super promising.
How long have you been working on it?
@iralmeida I think since the first video of @Acegikmo but it took about a month to have it "public ready", to be honest all the unit tests and the docs was assisted by AI.

@SoufianeKHIAT @Acegikmo ah shame for the generated documentation :(
I find that to be quite an important point of communication where to gauge quality & the character of a project.
But hey, I don't want to ruin the party :)

I have to admit that I have both the Freya splines video and the bezier curves still on my watchlist for... *checks notes* 3 years :|

@iralmeida let me know if their is something you don't like or could be improve in the doc.
@SoufianeKHIAT I've nicely bookmarked your project together with the videos 🫣
I totally will have some poking time on parametric curves one of these afternoons!
@SoufianeKHIAT whoa, this is excellent!
@aras it started as attempt to reproduce the work of @cem_yuksel with C2 class curve.