Curves in any dimension

The algorithms work in any dimension: on planar curves, on curves in 3D, and on curves with thousands of coordinates (traffic sensors, video frames). Low dimensions use static points, compiled for each dimension; high dimensions use Vector points, compiled once for all dimensions. For timings on real high-dimensional curves, against Fred, see High-dimensional curves: comparison with Fred.

Point types and high dimensions

Curves are BasicCompGeometry point sequences. Every algorithm takes either kind:

CurvePointsUse
PntSeq{D,Float64}static (Point{D,Float64})low dimensions (fastest up to D = 16)
GPntSeq{AnyDim,Float64,Vector{Float64}}Vector{Float64}high dimensions (faster from D = 128; compiles once for every D)
MatVecPntSeq(M)the columns of a matrixconverted on entry, see below

For timings on real curves in ℝ^963, ℝ^6000 and ℝ^19200, and a comparison with Fred, see High-dimensional curves: comparison with Fred.

Both curves of a call must have the same dimension and coordinate type (Float64). Results with Vector points agree with static points up to rounding, not bit for bit: a last-bit difference can select another optimal morphing, with the same leash.

A MatVecPntSeq (or a static curve paired with a Vector-point curve) is copied once, at the entry, into Vector points, since the algorithms create new points; the matrix is never written. Morphings returned for it have Vector points. Results share Vector points with the input curves (static points are copied by value): writing into a point, P[i][k] = x, changes it in both. BasicCompGeometry's setindex!, translate! and scale! replace points and are safe. The polygon hierarchy (ph_init) takes static points only. A sequence with Vector points must have the dimension parameter AnyDim: GPntSeq{3,Float64,Vector{Float64}} is rejected with an ArgumentError that says how to rewrap it without copying. Other point types (views, MVectors) are rejected too: the algorithms create points and push them into the curves.

Morphing{N,T} and EventPoint{N,T} take the point type as a third parameter (Morphing{2,Float64,Point2F}, Morphing2F). The two-parameter forms still dispatch, but are no longer concrete types: a field or array declared with them is abstractly typed.