(pre-include-guard-begin sph-spline-path-h) (sc-comment "* spline-path creates discrete 2d paths interpolated between some given points * maps from one independent value to one dependent continuous value * only the dependent value is returned * kept minimal (only 2d, only selected generates, limited segment count) to be extremely fast * negative independent values are not supported * segments-count must be greater than zero * multidimensional interpolation could only be archieved with multiple configs and calls * a copy of segments is made internally and only the copy is used * uses points as structs because pre-defined size arrays can not be used in structs * segments must be a valid spline-path segment configuration * generates are called with path-relative start/end inside segment and with out positioned at offset for this start/end block * all segment types require a fixed number of given points. line: 1, bezier: 3, move: 1, constant: 0, path: 0 * segments start at the previous point or (0 0) * bezier interpolation assume that output array values are set to zero before use * segments draw from the start point inclusive to end point exclusive * both dimensions are float types for precision with internal calculations") (pre-include "inttypes.h") (sc-comment "spline-path-size-max must be a value that fits in spline-path-value-t and size-t") (pre-define-if-not-defined spline-path-value-t double spline-path-segment-count-t uint16-t spline-path-size-max (/ SIZE_MAX 2) spline-path-point-max 4) (declare spline-path-point-t (type (struct (x spline-path-value-t) (y spline-path-value-t))) spline-path-segment-t struct spline-path-segment-t (type (struct spline-path-segment-t (points-count uint8-t) (points (array spline-path-point-t spline-path-point-max)) (generate (function-pointer void size-t size-t (struct spline-path-segment-t*) spline-path-value-t*)) (prepare (function-pointer uint8-t (struct spline-path-segment-t*))) (free (function-pointer void void*)) (data void*))) spline-path-generate-t (type (function-pointer void size-t size-t spline-path-segment-t* spline-path-value-t*)) spline-path-prepare-t (type (function-pointer uint8-t spline-path-segment-t*)) spline-path-t (type (struct (segments-count spline-path-segment-count-t) (segments spline-path-segment-t*) (current-segment-index spline-path-segment-count-t) (previous-start size-t))) (spline-path-start path) (spline-path-point-t spline-path-t) (spline-path-end path) (spline-path-point-t spline-path-t) (spline-path-set path segments segments-count) (uint8-t spline-path-t* spline-path-segment-t* spline-path-segment-count-t) (spline-path-set-copy path segments segments-count) (uint8-t spline-path-t* spline-path-segment-t* spline-path-segment-count-t) (spline-path-segments-get segments segments-count start end out) (uint8-t spline-path-segment-t* spline-path-segment-count-t size-t size-t spline-path-value-t*) (spline-path-prepare-segments segments segments-count) (uint8-t spline-path-segment-t* spline-path-segment-count-t) (spline-path-size path) (size-t spline-path-t) (spline-path-free path) (void spline-path-t) (spline-path-perpendicular-point p1 p2 distance-factor) (spline-path-point-t spline-path-point-t spline-path-point-t spline-path-value-t) (spline-path-move x y) (spline-path-segment-t spline-path-value-t spline-path-value-t) (spline-path-line x y) (spline-path-segment-t spline-path-value-t spline-path-value-t) (spline-path-constant) (spline-path-segment-t) (spline-path-path path) (spline-path-segment-t spline-path-t) (spline-path-bezier1 x1 y1 x2 y2) (spline-path-segment-t spline-path-value-t spline-path-value-t spline-path-value-t spline-path-value-t) (spline-path-bezier2 x1 y1 x2 y2 x3 y3) (spline-path-segment-t spline-path-value-t spline-path-value-t spline-path-value-t spline-path-value-t spline-path-value-t spline-path-value-t)) (pre-include-guard-end)