TinySpline  0.7.0
Spline Library for a Multitude of Programming Languages
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
89 extern "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
211 typedef float tsReal;
212 #else
213 typedef double tsReal;
214 #endif
425 typedef enum
426 {
429 
431  TS_MALLOC = -1,
432 
435 
438 
441 
444 
447 
450 
453 
456 
458  TS_IO_ERROR = -11,
459 
462 
465 
468 
470  TS_NUM_POINTS = -15
472 
476 typedef 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 }
641 typedef enum
642 {
645 
648 
653  TS_BEZIERS = 2
655 
664 typedef struct
665 {
667  tsReal position[3];
668 
670  tsReal tangent[3];
671 
673  tsReal normal[3];
674 
676  tsReal binormal[3];
677 } tsFrame;
717 typedef struct
718 {
720 } tsBSpline;
721 
730 size_t TINYSPLINE_API
731 ts_bspline_degree(const tsBSpline *spline);
732 
741 size_t TINYSPLINE_API
742 ts_bspline_order(const tsBSpline *spline);
743 
754 size_t TINYSPLINE_API
755 ts_bspline_dimension(const tsBSpline *spline);
756 
765 size_t TINYSPLINE_API
767 
776 size_t TINYSPLINE_API
778 
788 size_t TINYSPLINE_API
790 
806 const tsReal TINYSPLINE_API *
808 
824 tsError TINYSPLINE_API
826  tsReal **ctrlp,
827  tsStatus *status);
828 
851 tsError TINYSPLINE_API
853  size_t index,
854  const tsReal **ctrlp,
855  tsStatus *status);
856 
871 tsError TINYSPLINE_API
873  const tsReal *ctrlp,
874  tsStatus *status);
875 
895 tsError TINYSPLINE_API
897  size_t index,
898  const tsReal *ctrlp,
899  tsStatus *status);
900 
909 size_t TINYSPLINE_API
910 ts_bspline_num_knots(const tsBSpline *spline);
911 
921 size_t TINYSPLINE_API
922 ts_bspline_sof_knots(const tsBSpline *spline);
923 
939 const tsReal TINYSPLINE_API *
940 ts_bspline_knots_ptr(const tsBSpline *spline);
941 
957 tsError TINYSPLINE_API
958 ts_bspline_knots(const tsBSpline *spline,
959  tsReal **knots,
960  tsStatus *status);
961 
978 tsError TINYSPLINE_API
979 ts_bspline_knot_at(const tsBSpline *spline,
980  size_t index,
981  tsReal *knot,
982  tsStatus *status);
983 
1002 tsError TINYSPLINE_API
1004  const tsReal *knots,
1005  tsStatus *status);
1006 
1034 tsError TINYSPLINE_API
1036  tsStatus *status,
1037  tsReal knot0,
1038  double knot1,
1039  ...);
1040 
1062 tsError TINYSPLINE_API
1064  size_t index,
1065  tsReal knot,
1066  tsStatus *status);
1097 tsBSpline TINYSPLINE_API
1098 ts_bspline_init(void);
1099 
1127 tsError TINYSPLINE_API
1128 ts_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 
1171 tsError TINYSPLINE_API
1172 ts_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 
1199 tsError TINYSPLINE_API
1200 ts_bspline_copy(const tsBSpline *src,
1201  tsBSpline *dest,
1202  tsStatus *status);
1203 
1215 void TINYSPLINE_API
1217  tsBSpline *dest);
1218 
1226 void TINYSPLINE_API
1227 ts_bspline_free(tsBSpline *spline);
1307 typedef struct
1308 {
1310 } tsDeBoorNet;
1311 
1320 tsReal TINYSPLINE_API
1321 ts_deboornet_knot(const tsDeBoorNet *net);
1322 
1331 size_t TINYSPLINE_API
1332 ts_deboornet_index(const tsDeBoorNet *net);
1333 
1342 size_t TINYSPLINE_API
1344 
1355 size_t TINYSPLINE_API
1357 
1369 size_t TINYSPLINE_API
1371 
1380 size_t TINYSPLINE_API
1382 
1391 size_t TINYSPLINE_API
1393 
1403 size_t TINYSPLINE_API
1405 
1419 const tsReal TINYSPLINE_API *
1421 
1437 tsError TINYSPLINE_API
1438 ts_deboornet_points(const tsDeBoorNet *net,
1439  tsReal **points,
1440  tsStatus *status);
1441 
1450 size_t TINYSPLINE_API
1452 
1462 size_t TINYSPLINE_API
1464 
1474 size_t TINYSPLINE_API
1476 
1490 const tsReal TINYSPLINE_API *
1492 
1508 tsError TINYSPLINE_API
1509 ts_deboornet_result(const tsDeBoorNet *net,
1510  tsReal **result,
1511  tsStatus *status);
1542 tsDeBoorNet TINYSPLINE_API
1543 ts_deboornet_init(void);
1544 
1563 tsError TINYSPLINE_API
1564 ts_deboornet_copy(const tsDeBoorNet *src,
1565  tsDeBoorNet *dest,
1566  tsStatus *status);
1567 
1579 void TINYSPLINE_API
1581  tsDeBoorNet *dest);
1582 
1590 void TINYSPLINE_API
1646 tsError TINYSPLINE_API
1648  size_t num_points,
1649  size_t dimension,
1650  tsBSpline *spline,
1651  tsStatus *status);
1652 
1703 tsError 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);
1742 tsError TINYSPLINE_API
1743 ts_bspline_eval(const tsBSpline *spline,
1744  tsReal knot,
1745  tsDeBoorNet *net,
1746  tsStatus *status);
1747 
1778 tsError TINYSPLINE_API
1779 ts_bspline_eval_all(const tsBSpline *spline,
1780  const tsReal *knots,
1781  size_t num,
1782  tsReal **points,
1783  tsStatus *status);
1784 
1812 tsError TINYSPLINE_API
1813 ts_bspline_sample(const tsBSpline *spline,
1814  size_t num,
1815  tsReal **points,
1816  size_t *actual_num,
1817  tsStatus *status);
1818 
1874 tsError TINYSPLINE_API
1875 ts_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 
1895 void TINYSPLINE_API
1896 ts_bspline_domain(const tsBSpline *spline,
1897  tsReal *min,
1898  tsReal *max);
1899 
1918 tsError TINYSPLINE_API
1919 ts_bspline_is_closed(const tsBSpline *spline,
1920  tsReal epsilon,
1921  int *closed,
1922  tsStatus *status);
1923 
1999 tsError TINYSPLINE_API
2000 ts_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 
2038 tsError TINYSPLINE_API
2039 ts_bspline_chord_lengths(const tsBSpline *spline,
2040  const tsReal *knots,
2041  size_t num,
2042  tsReal *lengths,
2043  tsStatus *status);
2044 
2073 tsError TINYSPLINE_API
2074 ts_bspline_sub_spline(const tsBSpline *spline,
2075  tsReal knot0,
2076  tsReal knot1,
2077  tsBSpline *sub,
2078  tsStatus *status);
2079 
2091 void TINYSPLINE_API
2093  size_t num,
2094  tsReal *knots);
2095 
2120 tsError TINYSPLINE_API
2122  size_t num,
2123  tsReal *knots,
2124  size_t num_samples,
2125  tsStatus *status);
2229 tsError TINYSPLINE_API
2230 ts_bspline_derive(const tsBSpline *spline,
2231  size_t n,
2232  tsReal epsilon,
2233  tsBSpline *deriv,
2234  tsStatus *status);
2235 
2265 tsError TINYSPLINE_API
2266 ts_bspline_insert_knot(const tsBSpline *spline,
2267  tsReal knot, size_t num,
2268  tsBSpline *result,
2269  size_t *k,
2270  tsStatus *status);
2271 
2295 tsError TINYSPLINE_API
2296 ts_bspline_split(const tsBSpline *spline,
2297  tsReal knot,
2298  tsBSpline *split,
2299  size_t *k,
2300  tsStatus *status);
2301 
2364 tsError TINYSPLINE_API
2365 ts_bspline_tension(const tsBSpline *spline,
2366  tsReal beta,
2367  tsBSpline *out,
2368  tsStatus *status);
2369 
2387 tsError TINYSPLINE_API
2388 ts_bspline_to_beziers(const tsBSpline *spline,
2389  tsBSpline *beziers,
2390  tsStatus *status);
2391 
2419 tsError TINYSPLINE_API
2420 ts_bspline_elevate_degree(const tsBSpline *spline,
2421  size_t amount,
2422  tsReal epsilon,
2423  tsBSpline *elevated,
2424  tsStatus *status);
2425 
2455 tsError TINYSPLINE_API
2456 ts_bspline_align(const tsBSpline *s1,
2457  const tsBSpline *s2,
2458  tsReal epsilon,
2459  tsBSpline *s1_out,
2460  tsBSpline *s2_out,
2461  tsStatus *status);
2462 
2505 tsError TINYSPLINE_API
2506 ts_bspline_morph(const tsBSpline *origin,
2507  const tsBSpline *target,
2508  tsReal t,
2509  tsReal epsilon,
2510  tsBSpline *out,
2511  tsStatus *status);
2539 tsError TINYSPLINE_API
2540 ts_bspline_to_json(const tsBSpline *spline,
2541  char **json,
2542  tsStatus *status);
2543 
2573 tsError TINYSPLINE_API
2574 ts_bspline_parse_json(const char *json,
2575  tsBSpline *spline,
2576  tsStatus *status);
2577 
2594 tsError TINYSPLINE_API
2595 ts_bspline_save(const tsBSpline *spline,
2596  const char *path,
2597  tsStatus *status);
2598 
2630 tsError TINYSPLINE_API
2631 ts_bspline_load(const char *path,
2632  tsBSpline *spline,
2633  tsStatus *status);
2634 
2635 
2636 
2660 void TINYSPLINE_API
2661 ts_vec2_init(tsReal *out,
2662  tsReal x,
2663  tsReal y);
2664 
2679 void TINYSPLINE_API
2680 ts_vec3_init(tsReal *out,
2681  tsReal x,
2682  tsReal y,
2683  tsReal z);
2684 
2701 void TINYSPLINE_API
2702 ts_vec4_init(tsReal *out,
2703  tsReal x,
2704  tsReal y,
2705  tsReal z,
2706  tsReal w);
2707 
2723 void TINYSPLINE_API
2724 ts_vec2_set(tsReal *out,
2725  const tsReal *x,
2726  size_t dim);
2727 
2743 void TINYSPLINE_API
2744 ts_vec3_set(tsReal *out,
2745  const tsReal *x,
2746  size_t dim);
2747 
2763 void TINYSPLINE_API
2764 ts_vec4_set(tsReal *out,
2765  const tsReal *x,
2766  size_t dim);
2767 
2781 void TINYSPLINE_API
2782 ts_vec_add(const tsReal *x,
2783  const tsReal *y,
2784  size_t dim,
2785  tsReal *out);
2786 
2801 void TINYSPLINE_API
2802 ts_vec_sub(const tsReal *x,
2803  const tsReal *y,
2804  size_t dim,
2805  tsReal *out);
2806 
2822 tsReal TINYSPLINE_API
2823 ts_vec_dot(const tsReal *x,
2824  const tsReal *y,
2825  size_t dim);
2826 
2850 tsReal TINYSPLINE_API
2851 ts_vec_angle(const tsReal *x,
2852  const tsReal *y,
2853  tsReal *buf,
2854  size_t dim);
2855 
2869 void TINYSPLINE_API
2870 ts_vec3_cross(const tsReal *x,
2871  const tsReal *y,
2872  tsReal *out);
2873 
2888 void TINYSPLINE_API
2889 ts_vec_norm(const tsReal *x,
2890  size_t dim,
2891  tsReal *out);
2892 
2903 tsReal TINYSPLINE_API
2904 ts_vec_mag(const tsReal *x,
2905  size_t dim);
2906 
2921 void TINYSPLINE_API
2922 ts_vec_mul(const tsReal *x,
2923  size_t dim,
2924  tsReal val,
2925  tsReal *out);
2973 tsError TINYSPLINE_API
2975  const tsReal *lengths,
2976  size_t num,
2977  tsReal len,
2978  tsReal *knot,
2979  tsStatus *status);
2980 
3010 tsError TINYSPLINE_API
3011 ts_chord_lengths_t_to_knot(const tsReal *knots,
3012  const tsReal *lengths,
3013  size_t num,
3014  tsReal t,
3015  tsReal *knot,
3016  tsStatus *status);
3017 
3044 tsError TINYSPLINE_API
3046  const tsReal *lengths,
3047  size_t num,
3048  size_t num_knot_seq,
3049  tsReal *knot_seq,
3050  tsStatus *status);
3073 int TINYSPLINE_API
3075  tsReal y);
3076 
3087 void TINYSPLINE_API
3088 ts_arr_fill(tsReal *arr,
3089  size_t num,
3090  tsReal val);
3091 
3104 tsReal TINYSPLINE_API
3105 ts_distance(const tsReal *x,
3106  const tsReal *y,
3107  size_t dim);
3112 #ifdef __cplusplus
3113 }
3114 #endif
3115 
3116 #endif /* TINYSPLINE_H */
3117 
Definition: tinyspline.c:42
Definition: tinyspline.h:718
struct tsBSplineImpl * pImpl
Definition: tinyspline.h:719
Definition: tinyspline.c:53
size_t k
Definition: tinyspline.c:55
size_t dim
Definition: tinyspline.c:58
Definition: tinyspline.h:1308
struct tsDeBoorNetImpl * pImpl
Definition: tinyspline.h:1309
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:282
tsError TINYSPLINE_API ts_bspline_set_knots_varargs(tsBSpline *spline, tsStatus *status, tsReal knot0, double knot1,...)
Definition: tinyspline.c:338
size_t TINYSPLINE_API ts_deboornet_num_insertions(const tsDeBoorNet *net)
Definition: tinyspline.c:600
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:459
const tsReal TINYSPLINE_API * ts_bspline_knots_ptr(const tsBSpline *spline)
Definition: tinyspline.c:276
tsError TINYSPLINE_API ts_bspline_set_control_points(tsBSpline *spline, const tsReal *ctrlp, tsStatus *status)
Definition: tinyspline.c:237
size_t TINYSPLINE_API ts_bspline_sof_control_points(const tsBSpline *spline)
Definition: tinyspline.c:196
tsError TINYSPLINE_API ts_bspline_to_beziers(const tsBSpline *spline, tsBSpline *beziers, tsStatus *status)
Definition: tinyspline.c:2306
void TINYSPLINE_API ts_deboornet_move(tsDeBoorNet *src, tsDeBoorNet *dest)
Definition: tinyspline.c:752
void TINYSPLINE_API ts_vec3_cross(const tsReal *x, const tsReal *y, tsReal *out)
Definition: tinyspline.c:3278
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:511
tsError TINYSPLINE_API ts_deboornet_points(const tsDeBoorNet *net, tsReal **points, tsStatus *status)
Definition: tinyspline.c:637
void TINYSPLINE_API ts_bspline_uniform_knot_seq(const tsBSpline *spline, size_t num, tsReal *knots)
Definition: tinyspline.c:1876
size_t TINYSPLINE_API ts_deboornet_len_points(const tsDeBoorNet *net)
Definition: tinyspline.c:612
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:2630
size_t TINYSPLINE_API ts_deboornet_dimension(const tsDeBoorNet *net)
Definition: tinyspline.c:606
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:1537
tsError TINYSPLINE_API ts_bspline_copy(const tsBSpline *src, tsBSpline *dest, tsStatus *status)
Definition: tinyspline.c:544
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:3418
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:946
size_t TINYSPLINE_API ts_deboornet_num_points(const tsDeBoorNet *net)
Definition: tinyspline.c:619
tsBSpline TINYSPLINE_API ts_bspline_init(void)
Definition: tinyspline.c:401
tsError TINYSPLINE_API ts_bspline_knot_at(const tsBSpline *spline, size_t index, tsReal *knot, tsStatus *status)
Definition: tinyspline.c:294
tsError TINYSPLINE_API ts_deboornet_result(const tsDeBoorNet *net, tsReal **result, tsStatus *status)
Definition: tinyspline.c:674
void TINYSPLINE_API ts_vec_add(const tsReal *x, const tsReal *y, size_t dim, tsReal *out)
Definition: tinyspline.c:3214
void TINYSPLINE_API ts_deboornet_free(tsDeBoorNet *net)
Definition: tinyspline.c:730
tsError TINYSPLINE_API ts_bspline_set_knots(tsBSpline *spline, const tsReal *knots, tsStatus *status)
Definition: tinyspline.c:303
size_t TINYSPLINE_API ts_bspline_degree(const tsBSpline *spline)
Definition: tinyspline.c:165
void TINYSPLINE_API ts_arr_fill(tsReal *arr, size_t num, tsReal val)
Definition: tinyspline.c:3457
size_t TINYSPLINE_API ts_bspline_sof_knots(const tsBSpline *spline)
Definition: tinyspline.c:270
tsReal TINYSPLINE_API ts_deboornet_knot(const tsDeBoorNet *net)
Definition: tinyspline.c:582
size_t TINYSPLINE_API ts_deboornet_index(const tsDeBoorNet *net)
Definition: tinyspline.c:588
tsError TINYSPLINE_API ts_bspline_is_closed(const tsBSpline *spline, tsReal epsilon, int *closed, tsStatus *status)
Definition: tinyspline.c:1493
size_t TINYSPLINE_API ts_bspline_order(const tsBSpline *spline)
Definition: tinyspline.c:171
void TINYSPLINE_API ts_bspline_free(tsBSpline *spline)
Definition: tinyspline.c:568
tsError TINYSPLINE_API ts_bspline_elevate_degree(const tsBSpline *spline, size_t amount, tsReal epsilon, tsBSpline *elevated, tsStatus *status)
Definition: tinyspline.c:2377
size_t TINYSPLINE_API ts_bspline_num_knots(const tsBSpline *spline)
Definition: tinyspline.c:264
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:3181
void TINYSPLINE_API ts_bspline_domain(const tsBSpline *spline, tsReal *min, tsReal *max)
Definition: tinyspline.c:1482
void TINYSPLINE_API ts_vec_sub(const tsReal *x, const tsReal *y, size_t dim, tsReal *out)
Definition: tinyspline.c:3225
tsError TINYSPLINE_API ts_bspline_parse_json(const char *json, tsBSpline *spline, tsStatus *status)
Definition: tinyspline.c:3074
tsError TINYSPLINE_API ts_bspline_tension(const tsBSpline *spline, tsReal beta, tsBSpline *out, tsStatus *status)
Definition: tinyspline.c:2273
tsError TINYSPLINE_API ts_bspline_eval(const tsBSpline *spline, tsReal knot, tsDeBoorNet *net, tsStatus *status)
Definition: tinyspline.c:1338
void TINYSPLINE_API ts_vec4_set(tsReal *out, const tsReal *x, size_t dim)
Definition: tinyspline.c:3203
tsError TINYSPLINE_API ts_bspline_control_points(const tsBSpline *spline, tsReal **ctrlp, tsStatus *status)
Definition: tinyspline.c:208
tsError TINYSPLINE_API ts_bspline_load(const char *path, tsBSpline *spline, tsStatus *status)
Definition: tinyspline.c:3112
tsError TINYSPLINE_API ts_bspline_chord_lengths(const tsBSpline *spline, const tsReal *knots, size_t num, tsReal *lengths, tsStatus *status)
Definition: tinyspline.c:1691
const tsReal TINYSPLINE_API * ts_deboornet_points_ptr(const tsDeBoorNet *net)
Definition: tinyspline.c:631
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:3399
tsReal TINYSPLINE_API ts_vec_dot(const tsReal *x, const tsReal *y, size_t dim)
Definition: tinyspline.c:3241
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:1036
tsError TINYSPLINE_API ts_bspline_set_control_point_at(tsBSpline *spline, size_t index, const tsReal *ctrlp, tsStatus *status)
Definition: tinyspline.c:247
size_t TINYSPLINE_API ts_bspline_dimension(const tsBSpline *spline)
Definition: tinyspline.c:177
tsError TINYSPLINE_API ts_bspline_to_json(const tsBSpline *spline, char **json, tsStatus *status)
Definition: tinyspline.c:3058
double tsReal
Definition: tinyspline.h:213
void TINYSPLINE_API ts_vec2_init(tsReal *out, tsReal x, tsReal y)
Definition: tinyspline.c:3148
tsError TINYSPLINE_API ts_bspline_set_knot_at(tsBSpline *spline, size_t index, tsReal knot, tsStatus *status)
Definition: tinyspline.c:368
tsDeBoorNet TINYSPLINE_API ts_deboornet_init(void)
Definition: tinyspline.c:693
tsError TINYSPLINE_API ts_deboornet_copy(const tsDeBoorNet *src, tsDeBoorNet *dest, tsStatus *status)
Definition: tinyspline.c:737
void TINYSPLINE_API ts_bspline_move(tsBSpline *src, tsBSpline *dest)
Definition: tinyspline.c:559
int TINYSPLINE_API ts_knots_equal(tsReal x, tsReal y)
Definition: tinyspline.c:3451
tsBSplineType
Definition: tinyspline.h:642
@ TS_CLAMPED
Definition: tinyspline.h:647
@ TS_BEZIERS
Definition: tinyspline.h:653
@ TS_OPENED
Definition: tinyspline.h:644
size_t TINYSPLINE_API ts_bspline_len_control_points(const tsBSpline *spline)
Definition: tinyspline.c:183
const tsReal TINYSPLINE_API * ts_bspline_control_points_ptr(const tsBSpline *spline)
Definition: tinyspline.c:202
tsError TINYSPLINE_API ts_bspline_sample(const tsBSpline *spline, size_t num, tsReal **points, size_t *actual_num, tsStatus *status)
Definition: tinyspline.c:1393
tsError TINYSPLINE_API ts_bspline_sub_spline(const tsBSpline *spline, tsReal knot0, tsReal knot1, tsBSpline *sub, tsStatus *status)
Definition: tinyspline.c:1743
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:1419
void TINYSPLINE_API ts_vec3_init(tsReal *out, tsReal x, tsReal y, tsReal z)
Definition: tinyspline.c:3157
tsError TINYSPLINE_API ts_bspline_eval_all(const tsBSpline *spline, const tsReal *knots, size_t num, tsReal **points, tsStatus *status)
Definition: tinyspline.c:1356
size_t TINYSPLINE_API ts_deboornet_len_result(const tsDeBoorNet *net)
Definition: tinyspline.c:649
tsError TINYSPLINE_API ts_bspline_derive(const tsBSpline *spline, size_t n, tsReal epsilon, tsBSpline *deriv, tsStatus *status)
Definition: tinyspline.c:1988
size_t TINYSPLINE_API ts_deboornet_num_result(const tsDeBoorNet *net)
Definition: tinyspline.c:656
size_t TINYSPLINE_API ts_deboornet_sof_result(const tsDeBoorNet *net)
Definition: tinyspline.c:662
void TINYSPLINE_API ts_vec_mul(const tsReal *x, size_t dim, tsReal val, tsReal *out)
Definition: tinyspline.c:3318
tsError TINYSPLINE_API ts_bspline_morph(const tsBSpline *origin, const tsBSpline *target, tsReal t, tsReal epsilon, tsBSpline *out, tsStatus *status)
Definition: tinyspline.c:2730
tsError TINYSPLINE_API ts_bspline_split(const tsBSpline *spline, tsReal knot, tsBSpline *split, size_t *k, tsStatus *status)
Definition: tinyspline.c:2239
tsError TINYSPLINE_API ts_bspline_control_point_at_ptr(const tsBSpline *spline, size_t index, const tsReal **ctrlp, tsStatus *status)
Definition: tinyspline.c:220
tsReal TINYSPLINE_API ts_vec_angle(const tsReal *x, const tsReal *y, tsReal *buf, size_t dim)
Definition: tinyspline.c:3253
tsReal TINYSPLINE_API ts_vec_mag(const tsReal *x, size_t dim)
Definition: tinyspline.c:3307
void TINYSPLINE_API ts_vec3_set(tsReal *out, const tsReal *x, size_t dim)
Definition: tinyspline.c:3192
tsError TINYSPLINE_API ts_bspline_save(const tsBSpline *spline, const char *path, tsStatus *status)
Definition: tinyspline.c:3096
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:3336
size_t TINYSPLINE_API ts_deboornet_sof_points(const tsDeBoorNet *net)
Definition: tinyspline.c:625
tsReal TINYSPLINE_API ts_distance(const tsReal *x, const tsReal *y, size_t dim)
Definition: tinyspline.c:3466
void TINYSPLINE_API ts_vec4_init(tsReal *out, tsReal x, tsReal y, tsReal z, tsReal w)
Definition: tinyspline.c:3168
size_t TINYSPLINE_API ts_bspline_num_control_points(const tsBSpline *spline)
Definition: tinyspline.c:190
void TINYSPLINE_API ts_vec_norm(const tsReal *x, size_t dim, tsReal *out)
Definition: tinyspline.c:3292
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:1896
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:2211
const tsReal TINYSPLINE_API * ts_deboornet_result_ptr(const tsDeBoorNet *net)
Definition: tinyspline.c:668
size_t TINYSPLINE_API ts_deboornet_multiplicity(const tsDeBoorNet *net)
Definition: tinyspline.c:594