/* Routines that generate the 2d plot for the Vanderbit 2003 paper. */ /* Last edited on 2009-08-21 15:35:26 by stolfilocal */ #ifndef plot2d_H #define plot2d_H #include #include #include #include #include #include "affirm.h" #include "indexing.h" #include "pswr.h" #include "pswr_iso.h" #include "pswr_color.h" #include "mdg_grid.h" #include "dg_tree.h" #include "udg_pulse.h" #include "dg_tent.h" #include "dg_tent_basis.h" #include "dg_plot.h" #include "dg_makegrid.h" #include "dg_locus.h" #include "figtools.h" //#include "plot1d.h" #include "figtools.h" /* PLOT DEPTH ESTIMATION */ double compute_2d_plot_depth ( interval_t rootCell[], /* The root cell (client units). */ double scale, /* Plot scale (mm per client unit). */ double meshSize /* Nominal plot step (mm). */ ); /* Computes the subdivision depth to be used for 2d plotting, from the size of the root cell {rootCell}, the plot scale {scale}, and the nominal plot step {meshSize}. */ /* PLOTTING TOOLS */ void plot_2d_tree_leaves ( PSStream *ps, PlotOptions *o, dg_tree_node_t *sub, interval_t rootCell[] ); /* Plots the leaves of the subtree rooted at {sub} assuming the given {rootCell} geometry. */ void plot_2d_bezier_array ( PSStream *ps, PlotOptions *o, interval_t cell[], dg_degree_t g, double mag ); /* Plots the array of Bézier nodes for a tensor polynomial of degree {g} in the given {cell}. The dots are scaled by {mag} from the size adequate for a 1-inch figure. */ void plot_2d_bezier_linkages ( PSStream *ps, PlotOptions *o, interval_t cell[], dg_cont_t c, dg_degree_t g ); /* Plots the order-c continuity linkages between the degree-{g} Bézier nodes of the given {cell} and its neighbor cells. */ void plot_2d_locus_star ( PSStream *ps, PlotOptions *o, dg_locus_t E, dg_tree_node_t *G, interval_t rootCell[], double hstep ); /* Plots the star {K(E)} of locus {E}, assumed to be part of a finite dyadic grid {G,rootCell}. The cells of {K(E)} are paintes with the current fill color and hatched with line spacing {hstep} in client units. */ void plot_2d_locus ( PSStream *ps, PlotOptions *o, dg_locus_t E, dg_tree_node_t *G, interval_t rootCell[] ); /* Plots the locus {E}, assumed to be part of a finite dyadic grid {G,rootCell}. If {E} is a vertex, it is marked with a dot; if it is an edge, it is drawn with a hick pen; and if it is a cell, it is painted with dimmed {o->fill} and outlined. */ void plot_2d_tent ( PSStream *ps, PlotOptions *o, udg_pulse_kind_t pkind[], dg_cont_t c[], dg_degree_t g[], dg_tent_t t, dg_tree_node_t *G, interval_t rootCell[], mdg_rank_t rank, mdg_rank_t plotDepth, double fStart, /* Synchronize isolines with this level. */ double fStep, /* Isoline spacing. */ int kMin, /* Minimum isoline index. */ int kMax, /* Maximum isoline index. */ double *cR, double *cG, double *cB ); /* Plots the 2-dimensional tent function {t}, degree {g} and continuity {c} assumed to be part of the subgrid of the dyadic grid {G,rootCell}, which should belong to level {rank}. Any nodes at level {plotDepth} are assumed to be leaves. Each leaf cell of rank less than {plotDepth} is further split into sub-cells as needed until depth {plotDepth}. Each resulting (sub)cell is then painted with {plot_2d_function_in_cell}. The cell outlines are draw over the plot, with the current pen settings. */ void plot_2d_spline ( PSStream *ps, PlotOptions *o, udg_pulse_kind_t kind, dg_cont_t c, dg_degree_t g, dg_tent_vec_t tv, double_vec_t coef, dg_tree_node_t *G, interval_t rootCell[], mdg_rank_t rank, mdg_rank_t plotDepth, double fStart, /* Synchronize isolines with this level. */ double fStep, /* Isoline spacing. */ int kMin, /* Minimum isoline index. */ int kMax, /* Maximum isoline index. */ double *cR, double *cG, double *cB ); /* Plots the 2-dimensional spline that is a linear combination of the tents {tv} with coefficients {coef}. Assumes that the tents have the given {kind}, degree {g} and continuity {c}, and are part of the subgrid of the dyadic grid {G,rootCell}, which should belong to level {rank}. Any nodes at level {plotDepth} are assumed to be leaves. Each leaf cell of rank less than {plotDepth} is further split into sub-cells as needed until depth {plotDepth}. Each resulting (sub)cell is then painted with {plot_2d_function_in_cell}. The cell outlines are draw over the plot, with the current pen settings. */ void plot_2d_function ( PSStream *ps, PlotOptions *o, Field func, dg_tree_node_t *G, interval_t rootCell[], mdg_rank_t rank, mdg_rank_t plotDepth, double fStart, /* Synchronize isolines with this level. */ double fStep, /* Isoline spacing. */ int kMin, /* Minimum isoline index. */ int kMax, /* Maximum isoline index. */ double *cR, double *cG, double *cB ); /* Plots the function {eval(x)} over the subgrid of the dyadic grid {G,rootCell}, which should belong to level {rank}. Any nodes at level {plotDepth} are assumed to be leaves. Each leaf cell of rank less than {plotDepth} is further split into sub-cells as needed until depth {plotDepth}. Each resulting (sub)cell is then painted with {plot_2d_function_in_cell}. The cell outlines are draw over the plot, with the current pen settings. */ void plot_2d_mother_vertex_tent ( PSStream *ps, PlotOptions *o, udg_pulse_kind_t kind, dg_cont_t c, dg_degree_t g, dg_tent_mother_index_t tix, /* Index of tent in set. */ mdg_grid_size_t sz[], /* X- and Y-domain periods (number of grid intervals). */ interval_t fr[], /* X-, Y-, and function ranges of interest. */ mdg_rank_t plotDepth, double fStart, /* Synchronize isolines with this level. */ double fStep, /* Isoline spacing. */ int kMin, /* Minimum isoline index. */ int kMax, /* Maximum isoline index. */ double *cR, double *cG, double *cB ); /* Plots the fundamental mother spline (tent) of degree {g}, continuity {c}, and index {tix} associated with a vertex. For each axis {ax=0,1}, assumes that the grid has {gsz[ax]} cells of size 1, and that the plot interval is {fr[ax]}. The tent is folded over itself if {gsz[ax] = 1}. Each cell is recusively subdivided to depth {plotDepth} and painted with {plot_2d_function_in_cell}. The cell outlines are draw over the plot, with the current pen settings.*/ void plot_2d_function_in_cell ( PSStream *ps, PlotOptions *o, interval_t cell[], /* Cell where to plot. */ mdg_rank_t rank, /* Cell rank in grid. */ Field eval, /* Function to plot. */ int plotDepth, /* Subdivision depth for plotting. */ double fStart, /* Synchronize isolines with this level. */ double fStep, /* Isoline spacing. */ int kMin, /* Minimum isoline index. */ int kMax, /* Maximum isoline index. */ double *cR, double *cG, double *cB ); /* Paints the values of {eval(x)} inside a cell of a 2D finite multigrid {G}, with shades and isolines. The face is broken into {4^plotDepth} sub-patches, then each sub-patch is broken into 4 triangles. The function is linearly interpolated within each triangle. */ #endif