#ifndef hedge_draw_H #define hedge_draw_H /* Copyright (C) 2023 Jorge Stolfi, UNICAMP */ /* Last edited on 2023-10-02 12:49:35 by stolfi */ #include #include #include #include /* DRAWING THE MESH ELEMENTS */ void hedge_draw_edge(epswr_figure_t *eps, hedge_arc_t *a); /* Draws the edge represented by {a} and its twin {b}. It {laba} and {labb} are {NULL}, and {nodes} is false, draws the unoriented edge from {a.org} to {a.dst}, displaced laterally by {(a.bend - b.bend)/2}. Uses the current pen settings. If laba} and {labb} are {NULL}, and {nodes} is true, draws instead the boxes representing the arc records, with the {twin}, {org}, and {left} pointers. The {twin} pointers are displaced laterally by {a.bend} and {b.bend} If {laba} or {labb} are not both {NULL}, the drawing of the edge and boxes is suppressed. Instead, if {laba} is not null, and {nodes} is false, draws an arrohead on the edge at about 1/3 of the way from {a.org} to {a.dst}, and writes the string {laba} nearby, to the left of the arc {a}, with the current label font and fill color. The label is placed near the arrowhead if {nodes} is false, or near the record box if {nodes} is true. Ditto for {labb}, if not {NULL}, but with respect to the twin arc {b}.*/ void hedge_draw_arc_arrow(epswr_figure_t *eps, hedge_arc_t *a); /* Draws an arrowhead on a Bézier curve, about 1/3 of the way. */ void hedge_draw_vert(epswr_figure_t *eps, hedge_vert_t *v); /* Draws the vertex {v} as a dot at {v.pos}. The drawing is suppressed if {v.show} is false. */ void hedge_draw_face(epswr_figure_t *eps, hedge_face_t *f); /* Draws the face {f}, as a dot at {f.ctr}. The drawing is suppressed if {v.show} is false. */ /* DRAWING THE DATA STRUCTURE */ void hedge_draw_arc_record(epswr_figure_t *eps, hedge_arc_t *a); /* Draws the box representing the {hedge_arc_t} record {a} (but not {a.twin}). The drawing is suppressed if {a.org.show} is false. */ void hedge_draw_vert_record(epswr_figure_t *eps, hedge_vert_t *v); /* Draws a circle representing the vertex record {v} at the position {v.pos}. The drawing is suppressed if {v.show} is false. */ void hedge_draw_face_record(epswr_figure_t *eps, hedge_face_t *f); /* Draws a circle representing the specified record {a} (but not {a.twin}). The drawing is suppressed if {a.org.show} is false. */ void hedge_draw_arc_twin_link(epswr_figure_t *eps, hedge_arc_t *a); /* Draws the link {a.twin}. */ void hedge_draw_arc_next_link(epswr_figure_t *eps, hedge_arc_t *a); /* Draws the link {a.next}. */ void hedge_draw_arc_org_link(epswr_figure_t *eps, hedge_arc_t *a); /* Draws the link {a.org}. */ void hedge_draw_arc_left_link(epswr_figure_t *eps, hedge_arc_t *a); /* Draws the link {a.left}. */ void hedge_draw_vert_out_link(epswr_figure_t *eps, hedge_vert_t *v); /* Draws the link {v.out}. */ void hedge_draw_face_side_link(epswr_figure_t *eps, hedge_face_t *f); /* Draws the link {f.side}. */ /* LABELING THINGS */ void hedge_draw_arc_label(epswr_figure_t *eps, hedge_arc_t *a, char *lab, double du, double dv); /* Draws the label {lab} of an arc {a}, near the position of the box or arrowhead. The ref point of the text will be displaced by {(du,dv)} from that point. The coordinates of {dsp} are interpreted in the system whose axes are the direction tangent to the edge and the left-pointing normal. */ void hedge_draw_vert_label(epswr_figure_t *eps, hedge_vert_t *v, char *lab, double dx, double dy); /* Draws the label {lab} of a vertex {v}, with the text's ref point displaced by {(dx,dy)} from its position. */ void hedge_draw_face_label(epswr_figure_t *eps, hedge_face_t *f, char *lab, double dx, double dy); /* Draws the label {lab} of a face {f}, with teh reference point displaced by {(dx,dy)} from its nominal center. */ /* GENERIC DRAWING COMMANDS */ void hedge_draw_label(epswr_figure_t *eps, r2_t *p, char *lab, double hAlign, double vAlign); /* Draws the label {lab} with the relative point {hAlign,vAlign} of the text at the position {p}. */ void hedge_draw_link(epswr_figure_t *eps, r2_t *p, r2_t *q, double bend); /* Draws a link arrow from {p} to {q} that bends {bend} mm to the left of the line from {p} to {q}. */ #endif