OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
tinyspline.h
Go to the documentation of this file.
1
3#ifndef TINYSPLINE_H
4#define TINYSPLINE_H
5
6#include <stddef.h>
7
8
9
17#if defined(__GNUC__) || defined(__clang__)
18#define TS_DEPRECATED __attribute__((deprecated))
19#elif defined(_MSC_VER)
20#define TS_DEPRECATED __declspec(deprecated)
21#elif defined(SWIG)
22#define TS_DEPRECATED
23#else
24#warning "WARNING: TS_DEPRECATED is not supported by the compiler"
25#define TS_DEPRECATED
26#endif
65#if !defined(TINYSPLINE_API)
66#if defined(_WIN32) || defined(__CYGWIN__)
67#define TINYSPLINE_SHARED_EXPORT __declspec(dllexport)
68#define TINYSPLINE_SHARED_IMPORT __declspec(dllimport)
69#elif defined(__ELF__) || defined(__MACH__)
70#define TINYSPLINE_SHARED_EXPORT __attribute__ ((visibility ("default")))
71#define TINYSPLINE_SHARED_IMPORT
72#else
73#define TINYSPLINE_SHARED_EXPORT
74#define TINYSPLINE_SHARED_IMPORT
75#endif
76
77#ifdef TINYSPLINE_SHARED
78#ifdef TINYSPLINE_EXPORT
79#define TINYSPLINE_API TINYSPLINE_SHARED_EXPORT
80#else
81#define TINYSPLINE_API TINYSPLINE_SHARED_IMPORT
82#endif
83#else
84#define TINYSPLINE_API
85#endif
86#endif
87
88#ifdef __cplusplus
89extern "C" {
90#endif
108#define TS_PI 3.14159265358979323846
109
121#define TS_MAX_NUM_KNOTS 10000
122
128#define TS_DOMAIN_DEFAULT_MIN 0.0f
129
135#define TS_DOMAIN_DEFAULT_MAX 1.0f
136
156#define TS_KNOT_EPSILON 1e-4f
157
166#ifdef TINYSPLINE_FLOAT_PRECISION
167#define TS_POINT_EPSILON 1e-3f
168#else
169#define TS_POINT_EPSILON 1e-5f
170#endif
171
176#ifdef TINYSPLINE_FLOAT_PRECISION
177#define TS_LENGTH_ZERO 1e-3f
178#else
179#define TS_LENGTH_ZERO 1e-4f
180#endif
210#ifdef TINYSPLINE_FLOAT_PRECISION
211typedef float tsReal;
212#else
213typedef double tsReal;
214#endif
425typedef enum
426{
429
432
435
438
441
444
447
450
453
456
459
462
465
468
470 TS_NUM_POINTS = -15
472
476typedef struct
477{
480
486 char message[100];
487} tsStatus;
488
489#define TS_TRY(label, error, status) \
490{ \
491 (error) = TS_SUCCESS; \
492 if ((status) != NULL) { \
493 (status)->code = TS_SUCCESS; \
494 (status)->message[0] = '\0'; \
495 } \
496 __ ## label ## __: \
497 if (!(error)) {
498
499#define TS_CALL(label, error, call) \
500 (error) = (call); \
501 if ((error)) goto __ ## label ## __;
502
503#define TS_CATCH(error) \
504 } if ((error)) {
505
506#define TS_FINALLY \
507 } {
508
509#define TS_END_TRY \
510 } \
511}
512
513#define TS_END_TRY_RETURN(error) \
514 TS_END_TRY return (error);
515
516#define TS_END_TRY_ROE(error) \
517 TS_END_TRY if ((error)) return error;
518
519#define TS_CALL_ROE(error, call) \
520{ \
521 (error) = (call); \
522 if ((error)) return error; \
523}
524
525#define TS_RETURN_SUCCESS(status) \
526{ \
527 if ((status) != NULL) { \
528 (status)->code = TS_SUCCESS; \
529 (status)->message[0] = '\0'; \
530 } \
531 return TS_SUCCESS; \
532}
533
534#define TS_RETURN_0(status, error, msg) \
535{ \
536 if ((status) != NULL) { \
537 (status)->code = error; \
538 sprintf((status)->message, msg); \
539 } \
540 return error; \
541}
542
543#define TS_RETURN_1(status, error, msg, arg1) \
544{ \
545 if ((status) != NULL) { \
546 (status)->code = error; \
547 sprintf((status)->message, msg, arg1); \
548 } \
549 return error; \
550}
551
552#define TS_RETURN_2(status, error, msg, arg1, arg2) \
553{ \
554 if ((status) != NULL) { \
555 (status)->code = error; \
556 sprintf((status)->message, msg, arg1, arg2); \
557 } \
558 return error; \
559}
560
561#define TS_RETURN_3(status, error, msg, arg1, arg2, arg3) \
562{ \
563 if ((status) != NULL) { \
564 (status)->code = error; \
565 sprintf((status)->message, msg, arg1, arg2, arg3); \
566 } \
567 return error; \
568}
569
570#define TS_RETURN_4(status, error, msg, arg1, arg2, arg3, arg4) \
571{ \
572 if ((status) != NULL) { \
573 (status)->code = error; \
574 sprintf((status)->message, msg, arg1, arg2, arg3, arg4); \
575 } \
576 return error; \
577}
578
579#define TS_THROW_0(label, error, status, val, msg) \
580{ \
581 (error) = val; \
582 if ((status) != NULL) { \
583 (status)->code = val; \
584 sprintf((status)->message, msg); \
585 } \
586 goto __ ## label ## __; \
587}
588
589#define TS_THROW_1(label, error, status, val, msg, arg1) \
590{ \
591 (error) = val; \
592 if ((status) != NULL) { \
593 (status)->code = val; \
594 sprintf((status)->message, msg, arg1); \
595 } \
596 goto __ ## label ## __; \
597}
598
599#define TS_THROW_2(label, error, status, val, msg, arg1, arg2) \
600{ \
601 (error) = val; \
602 if ((status) != NULL) { \
603 (status)->code = val; \
604 sprintf((status)->message, msg, arg1, arg2); \
605 } \
606 goto __ ## label ## __; \
607}
608
609#define TS_THROW_3(label, error, status, val, msg, arg1, arg2, arg3) \
610{ \
611 (error) = val; \
612 if ((status) != NULL) { \
613 (status)->code = val; \
614 sprintf((status)->message, msg, arg1, arg2, arg3); \
615 } \
616 goto __ ## label ## __; \
617}
618
619#define TS_THROW_4(label, error, status, val, msg, arg1, arg2, arg3, arg4) \
620{ \
621 (error) = val; \
622 if ((status) != NULL) { \
623 (status)->code = val; \
624 sprintf((status)->message, msg, arg1, arg2, arg3, arg4); \
625 } \
626 goto __ ## label ## __; \
627}
641typedef enum
642{
645
648
653 TS_BEZIERS = 2
655
664typedef struct
665{
667 tsReal position[3];
668
670 tsReal tangent[3];
671
673 tsReal normal[3];
674
676 tsReal binormal[3];
677} tsFrame;
717typedef struct
718{
720} tsBSpline;
721
730size_t TINYSPLINE_API
731ts_bspline_degree(const tsBSpline *spline);
732
741size_t TINYSPLINE_API
742ts_bspline_order(const tsBSpline *spline);
743
754size_t TINYSPLINE_API
755ts_bspline_dimension(const tsBSpline *spline);
756
765size_t TINYSPLINE_API
767
776size_t TINYSPLINE_API
778
788size_t TINYSPLINE_API
790
806const tsReal TINYSPLINE_API *
808
824tsError TINYSPLINE_API
826 tsReal **ctrlp,
827 tsStatus *status);
828
851tsError TINYSPLINE_API
853 size_t index,
854 const tsReal **ctrlp,
855 tsStatus *status);
856
871tsError TINYSPLINE_API
873 const tsReal *ctrlp,
874 tsStatus *status);
875
895tsError TINYSPLINE_API
897 size_t index,
898 const tsReal *ctrlp,
899 tsStatus *status);
900
909size_t TINYSPLINE_API
910ts_bspline_num_knots(const tsBSpline *spline);
911
921size_t TINYSPLINE_API
922ts_bspline_sof_knots(const tsBSpline *spline);
923
939const tsReal TINYSPLINE_API *
940ts_bspline_knots_ptr(const tsBSpline *spline);
941
957tsError TINYSPLINE_API
958ts_bspline_knots(const tsBSpline *spline,
959 tsReal **knots,
960 tsStatus *status);
961
978tsError TINYSPLINE_API
979ts_bspline_knot_at(const tsBSpline *spline,
980 size_t index,
981 tsReal *knot,
982 tsStatus *status);
983
1002tsError TINYSPLINE_API
1004 const tsReal *knots,
1005 tsStatus *status);
1006
1034tsError TINYSPLINE_API
1036 tsStatus *status,
1037 tsReal knot0,
1038 double knot1,
1039 ...);
1040
1062tsError TINYSPLINE_API
1064 size_t index,
1065 tsReal knot,
1066 tsStatus *status);
1097tsBSpline TINYSPLINE_API
1098ts_bspline_init(void);
1099
1127tsError TINYSPLINE_API
1128ts_bspline_new(size_t num_control_points,
1129 size_t dimension,
1130 size_t degree,
1131 tsBSplineType type,
1132 tsBSpline *spline,
1133 tsStatus *status);
1134
1171tsError TINYSPLINE_API
1172ts_bspline_new_with_control_points(size_t num_control_points,
1173 size_t dimension,
1174 size_t degree,
1175 tsBSplineType type,
1176 tsBSpline *spline,
1177 tsStatus *status,
1178 double first,
1179 ...);
1180
1199tsError TINYSPLINE_API
1200ts_bspline_copy(const tsBSpline *src,
1201 tsBSpline *dest,
1202 tsStatus *status);
1203
1215void TINYSPLINE_API
1217 tsBSpline *dest);
1218
1226void TINYSPLINE_API
1227ts_bspline_free(tsBSpline *spline);
1307typedef struct
1308{
1310} tsDeBoorNet;
1311
1320tsReal TINYSPLINE_API
1321ts_deboornet_knot(const tsDeBoorNet *net);
1322
1331size_t TINYSPLINE_API
1333
1342size_t TINYSPLINE_API
1344
1355size_t TINYSPLINE_API
1357
1369size_t TINYSPLINE_API
1371
1380size_t TINYSPLINE_API
1382
1391size_t TINYSPLINE_API
1393
1403size_t TINYSPLINE_API
1405
1419const tsReal TINYSPLINE_API *
1421
1437tsError TINYSPLINE_API
1439 tsReal **points,
1440 tsStatus *status);
1441
1450size_t TINYSPLINE_API
1452
1462size_t TINYSPLINE_API
1464
1474size_t TINYSPLINE_API
1476
1490const tsReal TINYSPLINE_API *
1492
1508tsError TINYSPLINE_API
1510 tsReal **result,
1511 tsStatus *status);
1542tsDeBoorNet TINYSPLINE_API
1543ts_deboornet_init(void);
1544
1563tsError TINYSPLINE_API
1565 tsDeBoorNet *dest,
1566 tsStatus *status);
1567
1579void TINYSPLINE_API
1581 tsDeBoorNet *dest);
1582
1590void TINYSPLINE_API
1646tsError TINYSPLINE_API
1648 size_t num_points,
1649 size_t dimension,
1650 tsBSpline *spline,
1651 tsStatus *status);
1652
1703tsError TINYSPLINE_API
1705 size_t num_points,
1706 size_t dimension,
1707 tsReal alpha,
1708 const tsReal *first,
1709 const tsReal *last,
1710 tsReal epsilon,
1711 tsBSpline *spline,
1712 tsStatus *status);
1742tsError TINYSPLINE_API
1743ts_bspline_eval(const tsBSpline *spline,
1744 tsReal knot,
1745 tsDeBoorNet *net,
1746 tsStatus *status);
1747
1778tsError TINYSPLINE_API
1779ts_bspline_eval_all(const tsBSpline *spline,
1780 const tsReal *knots,
1781 size_t num,
1782 tsReal **points,
1783 tsStatus *status);
1784
1812tsError TINYSPLINE_API
1813ts_bspline_sample(const tsBSpline *spline,
1814 size_t num,
1815 tsReal **points,
1816 size_t *actual_num,
1817 tsStatus *status);
1818
1874tsError TINYSPLINE_API
1875ts_bspline_bisect(const tsBSpline *spline,
1876 tsReal value,
1877 tsReal epsilon,
1878 int persnickety,
1879 size_t index,
1880 int ascending,
1881 size_t max_iter,
1882 tsDeBoorNet *net,
1883 tsStatus *status);
1884
1895void TINYSPLINE_API
1896ts_bspline_domain(const tsBSpline *spline,
1897 tsReal *min,
1898 tsReal *max);
1899
1918tsError TINYSPLINE_API
1919ts_bspline_is_closed(const tsBSpline *spline,
1920 tsReal epsilon,
1921 int *closed,
1922 tsStatus *status);
1923
1999tsError TINYSPLINE_API
2000ts_bspline_compute_rmf(const tsBSpline *spline,
2001 const tsReal *knots,
2002 size_t num,
2003 int has_first_normal,
2004 tsFrame *frames,
2005 tsStatus *status);
2006
2038tsError TINYSPLINE_API
2040 const tsReal *knots,
2041 size_t num,
2042 tsReal *lengths,
2043 tsStatus *status);
2044
2073tsError TINYSPLINE_API
2074ts_bspline_sub_spline(const tsBSpline *spline,
2075 tsReal knot0,
2076 tsReal knot1,
2077 tsBSpline *sub,
2078 tsStatus *status);
2079
2091void TINYSPLINE_API
2093 size_t num,
2094 tsReal *knots);
2095
2120tsError TINYSPLINE_API
2122 size_t num,
2123 tsReal *knots,
2124 size_t num_samples,
2125 tsStatus *status);
2229tsError TINYSPLINE_API
2230ts_bspline_derive(const tsBSpline *spline,
2231 size_t n,
2232 tsReal epsilon,
2233 tsBSpline *deriv,
2234 tsStatus *status);
2235
2265tsError TINYSPLINE_API
2266ts_bspline_insert_knot(const tsBSpline *spline,
2267 tsReal knot, size_t num,
2268 tsBSpline *result,
2269 size_t *k,
2270 tsStatus *status);
2271
2295tsError TINYSPLINE_API
2296ts_bspline_split(const tsBSpline *spline,
2297 tsReal knot,
2298 tsBSpline *split,
2299 size_t *k,
2300 tsStatus *status);
2301
2364tsError TINYSPLINE_API
2365ts_bspline_tension(const tsBSpline *spline,
2366 tsReal beta,
2367 tsBSpline *out,
2368 tsStatus *status);
2369
2387tsError TINYSPLINE_API
2388ts_bspline_to_beziers(const tsBSpline *spline,
2389 tsBSpline *beziers,
2390 tsStatus *status);
2391
2419tsError TINYSPLINE_API
2421 size_t amount,
2422 tsReal epsilon,
2423 tsBSpline *elevated,
2424 tsStatus *status);
2425
2455tsError TINYSPLINE_API
2456ts_bspline_align(const tsBSpline *s1,
2457 const tsBSpline *s2,
2458 tsReal epsilon,
2459 tsBSpline *s1_out,
2460 tsBSpline *s2_out,
2461 tsStatus *status);
2462
2505tsError TINYSPLINE_API
2506ts_bspline_morph(const tsBSpline *origin,
2507 const tsBSpline *target,
2508 tsReal t,
2509 tsReal epsilon,
2510 tsBSpline *out,
2511 tsStatus *status);
2516#if !defined(TINYSPLINE_NO_SERIALIZATION)
2540tsError TINYSPLINE_API
2541ts_bspline_to_json(const tsBSpline *spline,
2542 char **json,
2543 tsStatus *status);
2544
2574tsError TINYSPLINE_API
2575ts_bspline_parse_json(const char *json,
2576 tsBSpline *spline,
2577 tsStatus *status);
2578
2595tsError TINYSPLINE_API
2596ts_bspline_save(const tsBSpline *spline,
2597 const char *path,
2598 tsStatus *status);
2599
2631tsError TINYSPLINE_API
2632ts_bspline_load(const char *path,
2633 tsBSpline *spline,
2634 tsStatus *status);
2635#endif
2636
2637
2661void TINYSPLINE_API
2662ts_vec2_init(tsReal *out,
2663 tsReal x,
2664 tsReal y);
2665
2680void TINYSPLINE_API
2681ts_vec3_init(tsReal *out,
2682 tsReal x,
2683 tsReal y,
2684 tsReal z);
2685
2702void TINYSPLINE_API
2703ts_vec4_init(tsReal *out,
2704 tsReal x,
2705 tsReal y,
2706 tsReal z,
2707 tsReal w);
2708
2724void TINYSPLINE_API
2725ts_vec2_set(tsReal *out,
2726 const tsReal *x,
2727 size_t dim);
2728
2744void TINYSPLINE_API
2745ts_vec3_set(tsReal *out,
2746 const tsReal *x,
2747 size_t dim);
2748
2764void TINYSPLINE_API
2765ts_vec4_set(tsReal *out,
2766 const tsReal *x,
2767 size_t dim);
2768
2782void TINYSPLINE_API
2783ts_vec_add(const tsReal *x,
2784 const tsReal *y,
2785 size_t dim,
2786 tsReal *out);
2787
2802void TINYSPLINE_API
2803ts_vec_sub(const tsReal *x,
2804 const tsReal *y,
2805 size_t dim,
2806 tsReal *out);
2807
2823tsReal TINYSPLINE_API
2824ts_vec_dot(const tsReal *x,
2825 const tsReal *y,
2826 size_t dim);
2827
2851tsReal TINYSPLINE_API
2852ts_vec_angle(const tsReal *x,
2853 const tsReal *y,
2854 tsReal *buf,
2855 size_t dim);
2856
2870void TINYSPLINE_API
2871ts_vec3_cross(const tsReal *x,
2872 const tsReal *y,
2873 tsReal *out);
2874
2889void TINYSPLINE_API
2890ts_vec_norm(const tsReal *x,
2891 size_t dim,
2892 tsReal *out);
2893
2904tsReal TINYSPLINE_API
2905ts_vec_mag(const tsReal *x,
2906 size_t dim);
2907
2922void TINYSPLINE_API
2923ts_vec_mul(const tsReal *x,
2924 size_t dim,
2925 tsReal val,
2926 tsReal *out);
2974tsError TINYSPLINE_API
2976 const tsReal *lengths,
2977 size_t num,
2978 tsReal len,
2979 tsReal *knot,
2980 tsStatus *status);
2981
3011tsError TINYSPLINE_API
3013 const tsReal *lengths,
3014 size_t num,
3015 tsReal t,
3016 tsReal *knot,
3017 tsStatus *status);
3018
3045tsError TINYSPLINE_API
3047 const tsReal *lengths,
3048 size_t num,
3049 size_t num_knot_seq,
3050 tsReal *knot_seq,
3051 tsStatus *status);
3074int TINYSPLINE_API
3076 tsReal y);
3077
3088void TINYSPLINE_API
3089ts_arr_fill(tsReal *arr,
3090 size_t num,
3091 tsReal val);
3092
3105tsReal TINYSPLINE_API
3106ts_distance(const tsReal *x,
3107 const tsReal *y,
3108 size_t dim);
3113#ifdef __cplusplus
3114}
3115#endif
3116
3117#endif /* TINYSPLINE_H */
3118
Definition tinyspline.h:718
struct tsBSplineImpl * pImpl
Definition tinyspline.h:719
Definition tinyspline.c:45
Definition tinyspline.h:1308
struct tsDeBoorNetImpl * pImpl
Definition tinyspline.h:1309
Definition tinyspline.c:57
size_t k
Definition tinyspline.c:59
size_t dim
Definition tinyspline.c:62
Definition tinyspline.h:665
Definition tinyspline.h:477
tsError code
Definition tinyspline.h:479
tsError TINYSPLINE_API ts_bspline_knots(const tsBSpline *spline, tsReal **knots, tsStatus *status)
Definition tinyspline.c:287
tsError TINYSPLINE_API ts_bspline_set_knots_varargs(tsBSpline *spline, tsStatus *status, tsReal knot0, double knot1,...)
Definition tinyspline.c:343
size_t TINYSPLINE_API ts_deboornet_num_insertions(const tsDeBoorNet *net)
Definition tinyspline.c:605
tsError TINYSPLINE_API ts_bspline_new(size_t num_control_points, size_t dimension, size_t degree, tsBSplineType type, tsBSpline *spline, tsStatus *status)
Definition tinyspline.c:464
tsError TINYSPLINE_API ts_bspline_set_control_points(tsBSpline *spline, const tsReal *ctrlp, tsStatus *status)
Definition tinyspline.c:242
size_t TINYSPLINE_API ts_bspline_sof_control_points(const tsBSpline *spline)
Definition tinyspline.c:201
tsError TINYSPLINE_API ts_bspline_to_beziers(const tsBSpline *spline, tsBSpline *beziers, tsStatus *status)
Definition tinyspline.c:2311
void TINYSPLINE_API ts_deboornet_move(tsDeBoorNet *src, tsDeBoorNet *dest)
Definition tinyspline.c:757
void TINYSPLINE_API ts_vec3_cross(const tsReal *x, const tsReal *y, tsReal *out)
Definition tinyspline.c:3283
tsError TINYSPLINE_API ts_bspline_new_with_control_points(size_t num_control_points, size_t dimension, size_t degree, tsBSplineType type, tsBSpline *spline, tsStatus *status, double first,...)
Definition tinyspline.c:516
tsError TINYSPLINE_API ts_deboornet_points(const tsDeBoorNet *net, tsReal **points, tsStatus *status)
Definition tinyspline.c:642
void TINYSPLINE_API ts_bspline_uniform_knot_seq(const tsBSpline *spline, size_t num, tsReal *knots)
Definition tinyspline.c:1881
size_t TINYSPLINE_API ts_deboornet_len_points(const tsDeBoorNet *net)
Definition tinyspline.c:617
tsError TINYSPLINE_API ts_bspline_align(const tsBSpline *s1, const tsBSpline *s2, tsReal epsilon, tsBSpline *s1_out, tsBSpline *s2_out, tsStatus *status)
Definition tinyspline.c:2635
size_t TINYSPLINE_API ts_deboornet_dimension(const tsDeBoorNet *net)
Definition tinyspline.c:611
tsError TINYSPLINE_API ts_bspline_compute_rmf(const tsBSpline *spline, const tsReal *knots, size_t num, int has_first_normal, tsFrame *frames, tsStatus *status)
Definition tinyspline.c:1542
tsError TINYSPLINE_API ts_bspline_copy(const tsBSpline *src, tsBSpline *dest, tsStatus *status)
Definition tinyspline.c:549
tsError TINYSPLINE_API ts_chord_lengths_equidistant_knot_seq(const tsReal *knots, const tsReal *lengths, size_t num, size_t num_knot_seq, tsReal *knot_seq, tsStatus *status)
Definition tinyspline.c:3423
tsError TINYSPLINE_API ts_bspline_interpolate_cubic_natural(const tsReal *points, size_t num_points, size_t dimension, tsBSpline *spline, tsStatus *status)
Definition tinyspline.c:951
size_t TINYSPLINE_API ts_deboornet_num_points(const tsDeBoorNet *net)
Definition tinyspline.c:624
tsBSpline TINYSPLINE_API ts_bspline_init(void)
Definition tinyspline.c:406
tsError TINYSPLINE_API ts_bspline_knot_at(const tsBSpline *spline, size_t index, tsReal *knot, tsStatus *status)
Definition tinyspline.c:299
tsError TINYSPLINE_API ts_deboornet_result(const tsDeBoorNet *net, tsReal **result, tsStatus *status)
Definition tinyspline.c:679
void TINYSPLINE_API ts_vec_add(const tsReal *x, const tsReal *y, size_t dim, tsReal *out)
Definition tinyspline.c:3219
void TINYSPLINE_API ts_deboornet_free(tsDeBoorNet *net)
Definition tinyspline.c:735
tsError TINYSPLINE_API ts_bspline_set_knots(tsBSpline *spline, const tsReal *knots, tsStatus *status)
Definition tinyspline.c:308
size_t TINYSPLINE_API ts_bspline_degree(const tsBSpline *spline)
Definition tinyspline.c:170
void TINYSPLINE_API ts_arr_fill(tsReal *arr, size_t num, tsReal val)
Definition tinyspline.c:3462
size_t TINYSPLINE_API ts_bspline_sof_knots(const tsBSpline *spline)
Definition tinyspline.c:275
tsReal TINYSPLINE_API ts_deboornet_knot(const tsDeBoorNet *net)
Definition tinyspline.c:587
const tsReal TINYSPLINE_API * ts_deboornet_result_ptr(const tsDeBoorNet *net)
Definition tinyspline.c:673
size_t TINYSPLINE_API ts_deboornet_index(const tsDeBoorNet *net)
Definition tinyspline.c:593
tsError TINYSPLINE_API ts_bspline_is_closed(const tsBSpline *spline, tsReal epsilon, int *closed, tsStatus *status)
Definition tinyspline.c:1498
size_t TINYSPLINE_API ts_bspline_order(const tsBSpline *spline)
Definition tinyspline.c:176
void TINYSPLINE_API ts_bspline_free(tsBSpline *spline)
Definition tinyspline.c:573
tsError TINYSPLINE_API ts_bspline_elevate_degree(const tsBSpline *spline, size_t amount, tsReal epsilon, tsBSpline *elevated, tsStatus *status)
Definition tinyspline.c:2382
size_t TINYSPLINE_API ts_bspline_num_knots(const tsBSpline *spline)
Definition tinyspline.c:269
tsError
Definition tinyspline.h:426
@ TS_DEG_GE_NCTRLP
Definition tinyspline.h:437
@ TS_NO_RESULT
Definition tinyspline.h:467
@ TS_MULTIPLICITY
Definition tinyspline.h:443
@ TS_UNDERIVABLE
Definition tinyspline.h:452
@ TS_KNOTS_DECR
Definition tinyspline.h:446
@ TS_IO_ERROR
Definition tinyspline.h:458
@ TS_SUCCESS
Definition tinyspline.h:428
@ TS_DIM_ZERO
Definition tinyspline.h:434
@ TS_NUM_KNOTS
Definition tinyspline.h:449
@ TS_NUM_POINTS
Definition tinyspline.h:470
@ TS_LCTRLP_DIM_MISMATCH
Definition tinyspline.h:455
@ TS_U_UNDEFINED
Definition tinyspline.h:440
@ TS_PARSE_ERROR
Definition tinyspline.h:461
@ TS_MALLOC
Definition tinyspline.h:431
@ TS_INDEX_ERROR
Definition tinyspline.h:464
void TINYSPLINE_API ts_vec2_set(tsReal *out, const tsReal *x, size_t dim)
Definition tinyspline.c:3186
void TINYSPLINE_API ts_bspline_domain(const tsBSpline *spline, tsReal *min, tsReal *max)
Definition tinyspline.c:1487
void TINYSPLINE_API ts_vec_sub(const tsReal *x, const tsReal *y, size_t dim, tsReal *out)
Definition tinyspline.c:3230
tsError TINYSPLINE_API ts_bspline_parse_json(const char *json, tsBSpline *spline, tsStatus *status)
Definition tinyspline.c:3079
tsError TINYSPLINE_API ts_bspline_tension(const tsBSpline *spline, tsReal beta, tsBSpline *out, tsStatus *status)
Definition tinyspline.c:2278
tsError TINYSPLINE_API ts_bspline_eval(const tsBSpline *spline, tsReal knot, tsDeBoorNet *net, tsStatus *status)
Definition tinyspline.c:1343
void TINYSPLINE_API ts_vec4_set(tsReal *out, const tsReal *x, size_t dim)
Definition tinyspline.c:3208
tsError TINYSPLINE_API ts_bspline_control_points(const tsBSpline *spline, tsReal **ctrlp, tsStatus *status)
Definition tinyspline.c:213
tsError TINYSPLINE_API ts_bspline_load(const char *path, tsBSpline *spline, tsStatus *status)
Definition tinyspline.c:3117
tsError TINYSPLINE_API ts_bspline_chord_lengths(const tsBSpline *spline, const tsReal *knots, size_t num, tsReal *lengths, tsStatus *status)
Definition tinyspline.c:1696
tsError TINYSPLINE_API ts_chord_lengths_t_to_knot(const tsReal *knots, const tsReal *lengths, size_t num, tsReal t, tsReal *knot, tsStatus *status)
Definition tinyspline.c:3404
tsReal TINYSPLINE_API ts_vec_dot(const tsReal *x, const tsReal *y, size_t dim)
Definition tinyspline.c:3246
tsError TINYSPLINE_API ts_bspline_interpolate_catmull_rom(const tsReal *points, size_t num_points, size_t dimension, tsReal alpha, const tsReal *first, const tsReal *last, tsReal epsilon, tsBSpline *spline, tsStatus *status)
Definition tinyspline.c:1041
tsError TINYSPLINE_API ts_bspline_set_control_point_at(tsBSpline *spline, size_t index, const tsReal *ctrlp, tsStatus *status)
Definition tinyspline.c:252
size_t TINYSPLINE_API ts_bspline_dimension(const tsBSpline *spline)
Definition tinyspline.c:182
tsError TINYSPLINE_API ts_bspline_to_json(const tsBSpline *spline, char **json, tsStatus *status)
Definition tinyspline.c:3063
double tsReal
Definition tinyspline.h:213
void TINYSPLINE_API ts_vec2_init(tsReal *out, tsReal x, tsReal y)
Definition tinyspline.c:3153
const tsReal TINYSPLINE_API * ts_deboornet_points_ptr(const tsDeBoorNet *net)
Definition tinyspline.c:636
tsError TINYSPLINE_API ts_bspline_set_knot_at(tsBSpline *spline, size_t index, tsReal knot, tsStatus *status)
Definition tinyspline.c:373
tsDeBoorNet TINYSPLINE_API ts_deboornet_init(void)
Definition tinyspline.c:698
tsError TINYSPLINE_API ts_deboornet_copy(const tsDeBoorNet *src, tsDeBoorNet *dest, tsStatus *status)
Definition tinyspline.c:742
void TINYSPLINE_API ts_bspline_move(tsBSpline *src, tsBSpline *dest)
Definition tinyspline.c:564
int TINYSPLINE_API ts_knots_equal(tsReal x, tsReal y)
Definition tinyspline.c:3456
tsBSplineType
Definition tinyspline.h:642
@ TS_CLAMPED
Definition tinyspline.h:647
@ TS_BEZIERS
Definition tinyspline.h:653
@ TS_OPENED
Definition tinyspline.h:644
const tsReal TINYSPLINE_API * ts_bspline_control_points_ptr(const tsBSpline *spline)
Definition tinyspline.c:207
size_t TINYSPLINE_API ts_bspline_len_control_points(const tsBSpline *spline)
Definition tinyspline.c:188
tsError TINYSPLINE_API ts_bspline_sample(const tsBSpline *spline, size_t num, tsReal **points, size_t *actual_num, tsStatus *status)
Definition tinyspline.c:1398
tsError TINYSPLINE_API ts_bspline_sub_spline(const tsBSpline *spline, tsReal knot0, tsReal knot1, tsBSpline *sub, tsStatus *status)
Definition tinyspline.c:1748
tsError TINYSPLINE_API ts_bspline_bisect(const tsBSpline *spline, tsReal value, tsReal epsilon, int persnickety, size_t index, int ascending, size_t max_iter, tsDeBoorNet *net, tsStatus *status)
Definition tinyspline.c:1424
void TINYSPLINE_API ts_vec3_init(tsReal *out, tsReal x, tsReal y, tsReal z)
Definition tinyspline.c:3162
tsError TINYSPLINE_API ts_bspline_eval_all(const tsBSpline *spline, const tsReal *knots, size_t num, tsReal **points, tsStatus *status)
Definition tinyspline.c:1361
size_t TINYSPLINE_API ts_deboornet_len_result(const tsDeBoorNet *net)
Definition tinyspline.c:654
tsError TINYSPLINE_API ts_bspline_derive(const tsBSpline *spline, size_t n, tsReal epsilon, tsBSpline *deriv, tsStatus *status)
Definition tinyspline.c:1993
size_t TINYSPLINE_API ts_deboornet_num_result(const tsDeBoorNet *net)
Definition tinyspline.c:661
size_t TINYSPLINE_API ts_deboornet_sof_result(const tsDeBoorNet *net)
Definition tinyspline.c:667
void TINYSPLINE_API ts_vec_mul(const tsReal *x, size_t dim, tsReal val, tsReal *out)
Definition tinyspline.c:3323
const tsReal TINYSPLINE_API * ts_bspline_knots_ptr(const tsBSpline *spline)
Definition tinyspline.c:281
tsError TINYSPLINE_API ts_bspline_morph(const tsBSpline *origin, const tsBSpline *target, tsReal t, tsReal epsilon, tsBSpline *out, tsStatus *status)
Definition tinyspline.c:2735
tsError TINYSPLINE_API ts_bspline_split(const tsBSpline *spline, tsReal knot, tsBSpline *split, size_t *k, tsStatus *status)
Definition tinyspline.c:2244
tsError TINYSPLINE_API ts_bspline_control_point_at_ptr(const tsBSpline *spline, size_t index, const tsReal **ctrlp, tsStatus *status)
Definition tinyspline.c:225
tsReal TINYSPLINE_API ts_vec_angle(const tsReal *x, const tsReal *y, tsReal *buf, size_t dim)
Definition tinyspline.c:3258
tsReal TINYSPLINE_API ts_vec_mag(const tsReal *x, size_t dim)
Definition tinyspline.c:3312
void TINYSPLINE_API ts_vec3_set(tsReal *out, const tsReal *x, size_t dim)
Definition tinyspline.c:3197
tsError TINYSPLINE_API ts_bspline_save(const tsBSpline *spline, const char *path, tsStatus *status)
Definition tinyspline.c:3101
tsError TINYSPLINE_API ts_chord_lengths_length_to_knot(const tsReal *knots, const tsReal *lengths, size_t num, tsReal len, tsReal *knot, tsStatus *status)
Definition tinyspline.c:3341
size_t TINYSPLINE_API ts_deboornet_sof_points(const tsDeBoorNet *net)
Definition tinyspline.c:630
tsReal TINYSPLINE_API ts_distance(const tsReal *x, const tsReal *y, size_t dim)
Definition tinyspline.c:3471
void TINYSPLINE_API ts_vec4_init(tsReal *out, tsReal x, tsReal y, tsReal z, tsReal w)
Definition tinyspline.c:3173
size_t TINYSPLINE_API ts_bspline_num_control_points(const tsBSpline *spline)
Definition tinyspline.c:195
void TINYSPLINE_API ts_vec_norm(const tsReal *x, size_t dim, tsReal *out)
Definition tinyspline.c:3297
tsError TINYSPLINE_API ts_bspline_equidistant_knot_seq(const tsBSpline *spline, size_t num, tsReal *knots, size_t num_samples, tsStatus *status)
Definition tinyspline.c:1901
tsError TINYSPLINE_API ts_bspline_insert_knot(const tsBSpline *spline, tsReal knot, size_t num, tsBSpline *result, size_t *k, tsStatus *status)
Definition tinyspline.c:2216
size_t TINYSPLINE_API ts_deboornet_multiplicity(const tsDeBoorNet *net)
Definition tinyspline.c:599