/* Polynomial splines defined on irregular dyadic grids */ /* Last edited on 2007-01-04 00:16:49 by stolfi */ #ifndef dg_spline_H #define dg_spline_H #include #include #include #include #include #include /* EXPLICIT BÉZIER REPRESENTATION The /explicit Bézier representation/ (/EBP/) of a spline consists of a {bz_patch_t} {b(C)} associated to each leaf face {C} of the underlying dyadic grid {G}. All the patches with same set of spanning axes must have the same degree vector. If the spline is continuous, it suffices to store the patches for the fully-dimensional cells of {G}. SEMI-EXPLICIT BÉZIER REPRESENTATION The /semi-explicit Bézier representation/ (/SEBP/) is similar except that a Bézier patch {b(C)} is associated to every cell of the grid, leaf or non-leaf. COMPUTER REPRESENTATION The patches are stored in the nodes of the binary tree representing the grid {G}. Only the {b.c} field of the {bz_patch_t} record {b} is stored, in the field {t.data} of the tree node. A {NULL} {t.data} field is interpreted as an array of zeros. EBP AND SEBP EVALUATION Given the EBP of a spline {s}, evaluating {s(x)} reduces to locating the leaf cell {C} of {G} that contains {x} and then evaluating {b(C)(z)} where {z} is the coordinate vector of {x} relative to {C}. To evaluate the spline given the SEBP, one proceeds as above for all grid cells {C} containing {x}, and adds the results. */ void dg_spline_alloc_bezier_patch ( bz_ddim_t m, bz_rdim_t n, bz_degrees_t gg, dg_node_t *t ); /* Allocates an array of the tree rooted at {root}, allocates a Bézier coeff array of domain dimension {d}, range domain 1, and degree vector {(g,.. g)}. The coeffs are all set to zero, and the address of the coeff array is stored in the node's data record. */ void dg_spline_free_bezier_patch(dg_node_t *t); /* Frees the data record {t.data} created by {dg_tent_alloc_explicit_rep}, and sets {t.data} to NULL. */ void dg_spline_push_patches ( dg_dim_t d, dg_cont_t c, dg_degree_t g, dg_tent_vec_t *tv, double_vec_t *a, dg_node_t *root ); /* Splits each tent {tv[i]} into its constituent patches, computes the Bézier coeff array of each patch, and adds it, multiplied by {a[i]}, to the Bézier coeff array that is assumed to be stored in the corresponding node of the tree rooted at {root} (see {dg_tent_alloc_explicit_rep}). { SUM {a[i]*tv[i] : i = 0..tv.ne-1} } and adds its explicit Bézier representation in the leaves of tree {root}. Assumes that the grid dimension is {d} and that the tents have degree {g} and continuity {c}. Assumes also that the data pointer of each node points to a Bézier control point array of degree {g} and dimension {d}. */ void dg_tent_flatten(dg_tent_vec_t *tv, double_vec_t *a, dg_node_t *root); /* Computes the dyadic spline which is the linear combination { SUM {a[i]*tv[i] : i = 0..tv.ne-1} } and adds its explicit Bézier representation in the leaves of tree {root}. Assumes that the grid dimension is {d} and that the tents have degree {g} and continuity {c}. Assumes also that the data pointer of each node points to a Bézier control point array of degree {g} and dimension {d}. */ #endif