#ifndef bz_patch_plot_2D_H #define bz_patch_plot_2D_H /* Plotting of a 2D Bézier patch with fixed resolution (for debugging) */ /* Last edited on 2011-10-12 13:34:54 by stolfilocal */ #include #include #include #include PSStream *bz_patch_plot_2D_init ( char *prefix, bool_t epsformat, char *paperSize, char *caption, double hSize, double vSize, interval_t BB[] ); /* Creates a Postscript stream. If {epsformat} is FALSE, the output will be a stand-alone Postscript document called "{prefix}doc.ps", with page dimensions defined by the {papersize} string ("letter", "a4", etc.). The {caption} will be printed under the figure. If {epsformat} is TRUE, the ouptut will be an EPS file called "{prefix}{NNNNNN}.eps", where {NNNNNN} is a six-digit sequential number starting from 0. Each figure will have a nominal size of {hSize} by {vSize} millimeters. In either case, the scale and clipping is set so that the visible range of client plotting coordinates is the rectangle {BB[0] × BB[1]}, which is mapped to fill most of the available space, with equal scales. */ void bz_patch_plot_2D_finish ( PSStream *ps ); /* Terminates a Postscript stream that was started with {bz_patch_plot_2D_init}. */ typedef void bz_patch_plot_2D_func_t ( bz_patch_ddim_t d, double x[], double_array_t *P, int nf, double f[] ); /* Type of a client-given function to be plotted. It should take a domain point {x[0..d-1]} and an array {P}, and compute values {f[0..nf-1]}. The array {P} is usually the value {P(x)} of some Bézier patch {P} evaluated at {x}. The array {P} may be NULL. */ void bz_patch_plot_2D_patch_and_func_plain ( PSStream *ps, interval_t B[], bz_patch_t *P, int nf, bz_patch_plot_2D_func_t *func, int nx, int ny, pswr_plot_2D_style_t *st, bool_t fill, bool_t draw ); /* Plots the values of {func(z,P(z))} where {z} is a point of {\RR^2} ranging over the rectangle {B[0]×B[1]}. The function {func} is assumed to return a result vector with {nf} reals, {f[0..nf-1]}. The first 2 components of the function's result {t[0..1]} are interpreted as plotting coordinates. The remaining coordinates {t[2..nt-1]} define colors and/or isolines. The domain rectangle {B} is subdivided into an array of {nx × ny} tiles, and the function {func} is plotted as if its values (shape and colors) were bilinear in that square. Namely each tile is divided into 4 triangles with a shared center vertex. For the meaning of the parameters {st,fill,draw}, see {pswr_plot_2D.h}. The Bézier patch {P} must have domain dimension {P.d == 2}. It is viewed as a function that, for any argument {z[0..1]}, returns some value {P(z)}. The value {P(z)} may be an arbitrary tensor (multi-index array), including a scalar, vector, or matrix). The patch is evaluated with {bz_patch_eval} on the argument vector {x[0..P.d-1]} where {x[i] = (z[i] - LO(B[i]))/(HI(B[i]) - LO(B[i]))}, for {i} in {0..P.d-1}. The function {func} is assumed to take the argument {z[0..1]}, the patch value {P(z)}, and If {P} is NULL, then a NULL pointer is passed to {func} instead of the array {P(z)}. If {func} is NULL, the function returns the first {nf} elements of the patch value {P(z)}, linarized in the The patch {P} is modified by the plotting routine. In particular, any face that is close enough to a multiaffine function is straightened to become one, before anything else. */ void bz_patch_plot_2D_patch_and_func ( PSStream *ps, interval_t B[], bz_patch_t *P, int nf, bz_patch_plot_2D_func_t *func, int minRank, int maxRank, double tol, int nx, int ny, pswr_plot_2D_style_t *st, bool_t fill, bool_t draw ); /* Plots the values of {func(z,P(z))} over the rectangle {B[0] × B[1]}. The Bézier patch {P} must have domain dimension {P.d} at most 2. It is viewed as a function that, for any argument {z[0..P.d-1]}, returns some value {P(z)}. The value {P(z)} may be an arbitrary tensor (multi-index array), including a scalar, vector, or matrix). The patch is evaluated with {bz_patch_eval} on the argument vector {x[0..P.d-1]} where {x[i] = (z[i] - LO(B[i]))/(HI(B[i]) - LO(B[i]))}, for {i} in {0..P.d-1}. If {P} is NULL, the procedure assumes that {P(z)} is the empty tensor. The function {func} is assumed to take the argument {z[0..1]}, the patch value {P(z)}, and return a result vector {func(z) = f[0..nf-1]} with {nf} reals. If {func} is NULL, then a NULL pointer is passed to {func} instead of the array {P(z)}. The first 2 components of the function's result {t[0..1]} are interpreted as plotting coordinates. The remaining coordinates {t[2..nt-1]} define colors and/or isolines. The domain rectangle {B[0..d-1]} and the patch {P} are subdivided recursively in half along alternating axes, at least {minRank} times. The subdivision continues until {maxRank} splits, or until the patch {P} deviates less than {tol} from the multiaffine patch with the same corners. At that point the domain {B} is divided into an array of {nx × ny} tiles, each tile is divided into 4 triangles with a shared center vertex, and the function {T} is plotted as if its values (shape and colors) were bilinear in that square. For the meaning of the parameters {st,fill,draw}, see {pswr_plot_2D.h} The patch {P} is modified by the plotting routine. In particular, any face that is close enough to a multiaffine function is straightened to become one, before anything else. */ #endif