| 1 |
|
| 2 |
|
| 3 |
#ifndef SPLINE_H |
| 4 |
#define SPLINE_H |
| 5 |
|
| 6 |
#include <stdio.h> |
| 7 |
|
| 8 |
#include "point.h" |
| 9 |
#include "autotrace.h" |
| 10 |
|
| 11 |
typedef at_polynomial_degree polynomial_degree; |
| 12 |
typedef at_spline_type spline_type; |
| 13 |
|
| 14 |
#define LINEARTYPE AT_LINEARTYPE |
| 15 |
#define QUADRATICTYPE AT_QUADRATICTYPE |
| 16 |
#define CUBICTYPE AT_CUBICTYPE |
| 17 |
#define PARALLELELLIPSETYPE AT_PARALLELELLIPSETYPE |
| 18 |
#define ELLIPSETYPE AT_ELLIPSETYPE |
| 19 |
#define CIRCLETYPE AT_CIRCLETYPE |
| 20 |
|
| 21 |
#define BEG_POINT(spl) ((spl).v[0]) |
| 22 |
#define CONTROL1(spl) ((spl).v[1]) |
| 23 |
#define CONTROL2(spl) ((spl).v[2]) |
| 24 |
#define END_POINT(spl) ((spl).v[3]) |
| 25 |
#define SPLINE_DEGREE(spl) ((spl).degree) |
| 26 |
#define SPLINE_LINEARITY(spl) ((spl).linearity) |
| 27 |
|
| 28 |
#ifndef _IMPORTING |
| 29 |
|
| 30 |
void print_spline (FILE *, spline_type); |
| 31 |
|
| 32 |
|
| 33 |
Point evaluate_spline (spline_type spline, float t); |
| 34 |
#endif |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
typedef at_spline_list_type spline_list_type; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
#define SPLINE_LIST_LENGTH(spll) ((spll).length) |
| 43 |
|
| 44 |
|
| 45 |
#define SPLINE_LIST_DATA(spll) ((spll).data) |
| 46 |
|
| 47 |
|
| 48 |
#define SPLINE_LIST_ELT(spll, index) ((spll).data[index]) |
| 49 |
|
| 50 |
|
| 51 |
#define LAST_SPLINE_LIST_ELT(s_l) \ |
| 52 |
(SPLINE_LIST_DATA (s_l)[SPLINE_LIST_LENGTH (s_l) - 1]) |
| 53 |
|
| 54 |
|
| 55 |
#define NEXT_SPLINE_LIST_ELT(s_l, index) \ |
| 56 |
SPLINE_LIST_ELT (s_l, ((index) + 1) % SPLINE_LIST_LENGTH (s_l)) |
| 57 |
#define PREV_SPLINE_LIST_ELT(s_l, index) \ |
| 58 |
SPLINE_LIST_ELT (s_l, index == 0 \ |
| 59 |
? SPLINE_LIST_LENGTH (s_l) - 1 \ |
| 60 |
: index - 1) |
| 61 |
|
| 62 |
#ifndef _IMPORTING |
| 63 |
|
| 64 |
extern spline_list_type *new_spline_list (void); |
| 65 |
extern spline_list_type empty_spline_list (void); |
| 66 |
extern spline_list_type *new_spline_list_with_spline (spline_type); |
| 67 |
extern void free_spline_list (spline_list_type); |
| 68 |
|
| 69 |
|
| 70 |
extern void append_spline (spline_list_type *s_list, spline_type s); |
| 71 |
|
| 72 |
|
| 73 |
extern void concat_spline_lists (spline_list_type *s1, spline_list_type s2); |
| 74 |
#endif |
| 75 |
|
| 76 |
typedef at_spline_list_array_type spline_list_array_type; |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
#define SPLINE_LIST_ARRAY_LENGTH(spll) ((spll).length) |
| 81 |
#define SPLINE_LIST_ARRAY_DATA SPLINE_LIST_DATA |
| 82 |
#define SPLINE_LIST_ARRAY_ELT(spll, index) ((spll).data[index]) |
| 83 |
#define LAST_SPLINE_LIST_ARRAY_ELT LAST_SPLINE_LIST_ELT |
| 84 |
|
| 85 |
extern spline_list_array_type new_spline_list_array (void); |
| 86 |
extern void append_spline_list (spline_list_array_type *, spline_list_type); |
| 87 |
extern void free_spline_list_array (spline_list_array_type *); |
| 88 |
|
| 89 |
#endif |
| 90 |
|