Graphviz 13.0.0~dev.20241220.2304
|
#include <assert.h>
#include "config.h"
#include <limits.h>
#include <math.h>
#include <neatogen/neato.h>
#include <neatogen/adjust.h>
#include <pathplan/pathplan.h>
#include <pathplan/vispath.h>
#include <neatogen/multispline.h>
#include <stdbool.h>
#include <stddef.h>
#include <util/alloc.h>
#include <util/unreachable.h>
Go to the source code of this file.
Data Structures | |
struct | edgeinfo |
struct | edgeitem |
Macros | |
#define | BOUNDARY_PORT(e) ((ED_tail_port(e).side)||(ED_head_port(e).side)) |
Functions | |
static bool | spline_merge (node_t *n) |
static bool | swap_ends_p (edge_t *e) |
static void | make_barriers (Ppoly_t **poly, int npoly, int pp, int qp, Pedge_t **barriers, size_t *n_barriers) |
static Ppoint_t | genPt (double x, double y, pointf c) |
static Ppoint_t | recPt (double x, double y, pointf c, expand_t *m) |
static void * | newitem (void *p, Dtdisc_t *disc) |
static int | cmpitems (void *k1, void *k2) |
static edge_t * | equivEdge (Dt_t *map, edge_t *e) |
void | makeSelfArcs (edge_t *e, int stepx) |
static double | ellipse_tangent_slope (double a, double b, pointf p) |
static pointf | line_intersection (linef l0, linef l1) |
static pointf | circumscribed_polygon_corner_about_ellipse (double a, double b, size_t i, size_t nsides) |
Ppoly_t * | makeObstacle (node_t *n, expand_t *pmargin, bool isOrtho) |
Ppolyline_t | getPath (edge_t *e, vconfig_t *vconfig, bool chkPts) |
static void | makePolyline (edge_t *e) |
void | makeSpline (edge_t *e, Ppoly_t **obs, int npoly, bool chkPts) |
static int | spline_edges_ (graph_t *g, expand_t *pmargin, int edgetype) |
int | splineEdges (graph_t *g, int(*edgefn)(graph_t *, expand_t *, int), int edgetype) |
int | spline_edges1 (graph_t *g, int edgetype) |
void | spline_edges0 (graph_t *g, bool set_aspect) |
static void | shiftClusters (graph_t *g, pointf offset) |
void | spline_edges (graph_t *g) |
static void | scaleEdge (edge_t *e, double xf, double yf) |
static void | scaleBB (graph_t *g, double xf, double yf) |
static void | translateE (edge_t *e, pointf offset) |
static void | translateG (Agraph_t *g, pointf offset) |
void | neato_translate (Agraph_t *g) |
static bool | _neato_set_aspect (graph_t *g) |
bool | neato_set_aspect (graph_t *g) |
Variables | |
static splineInfo | sinfo |
Dtdisc_t | edgeItemDisc |
#define BOUNDARY_PORT | ( | e | ) | ((ED_tail_port(e).side)||(ED_head_port(e).side)) |
Definition at line 579 of file neatosplines.c.
|
static |
Definition at line 1025 of file neatosplines.c.
References agfstnode(), agfstout(), agnxtnode(), agnxtout(), ED_spl, exch_xyf(), GD_bb, GD_drawing, GD_flip, ND_pos, neato_translate(), Nop, R_EXPAND, R_FILL, R_VALUE, Agraph_s::root, scale(), scaleBB(), scaleEdge(), and pointf_s::y.
Referenced by neato_set_aspect().
|
static |
calculate a corner of a polygon circumscribed about an ellipse
a | Half the width of the ellipse, i.e., the maximum x value |
b | Half the height of the ellipse, i.e., the maximum y value |
i | Index of the polygon corner |
nsides | Number of sides of the polygon |
i
Definition at line 300 of file neatosplines.c.
References ellipse_tangent_slope(), line_intersection(), M_PI, pointf_s::x, and pointf_s::y.
Referenced by makeObstacle().
|
static |
Definition at line 121 of file neatosplines.c.
References edgeinfo::n1, edgeinfo::n2, edgeinfo::p1, edgeinfo::p2, pointf_s::x, and pointf_s::y.
|
static |
calculate the slope of the tangent of an ellipse
The equation for the slope m
of the tangent of an ellipse as a function of x
* is given by:
bx
m = ± ――――――――――
a √ a²- x²
or
m = ± (b * x) / (a * sqrt(a * a - x * x))
We know that the slope is negative in the first and third quadrant, i.e., when the signs of x and y are the same, so we use that to select the correct slope.
a | Half the width of the ellipse, i.e., the maximum x value |
b | Half the height of the ellipse, i.e., the maximum y value |
p | A point on the ellipse periphery in which to calculate the slope of the tangent |
p
Definition at line 270 of file neatosplines.c.
References pointf_s::x, and pointf_s::y.
Referenced by circumscribed_polygon_corner_about_ellipse().
Definition at line 168 of file neatosplines.c.
References aghead, agtail, dtinsert, edgeitem::e, ED_head_port, ED_tail_port, edgeitem::id, edgeinfo::n1, edgeinfo::n2, edgeinfo::p1, edgeinfo::p2, pointf_s::x, and pointf_s::y.
Referenced by splineEdges().
Definition at line 78 of file neatosplines.c.
References pointf_s::x, Pxy_t::x, pointf_s::y, and Pxy_t::y.
Referenced by makeObstacle().
Ppolyline_t getPath | ( | edge_t * | e, |
vconfig_t * | vconfig, | ||
bool | chkPts | ||
) |
Definition at line 502 of file neatosplines.c.
References add_pointf(), aghead, agtail, ED_head_port, ED_tail_port, ND_coord, ND_lim, Pobspath(), and POLYID_NONE.
Referenced by compoundEdges(), and spline_edges_().
calculate the intersection of two lines
l0 | First line |
l1 | Second line |
Definition at line 285 of file neatosplines.c.
References linef::m, linef::p, pointf_s::x, and pointf_s::y.
Referenced by circumscribed_polygon_corner_about_ellipse().
|
static |
Definition at line 45 of file neatosplines.c.
References Pedge_t::a, Pedge_t::b, and gv_calloc().
Referenced by makeSpline().
Definition at line 326 of file neatosplines.c.
References field_t::b, circumscribed_polygon_corner_about_ellipse(), expand_t::doAdd, genPt(), gv_alloc(), gv_calloc(), INCH2PS, late_double(), boxf::LL, N_penwidth, ND_coord, ND_ht, ND_lw, ND_outline_height, ND_outline_width, ND_rw, ND_shape_info, NULL, penwidth, Ppoly_t::pn, polyBB(), Ppoly_t::ps, recPt(), SH_EPSF, SH_POINT, SH_POLY, SH_RECORD, shapeOf(), UNREACHABLE, boxf::UR, pointf_s::x, expand_t::x, Pxy_t::x, pointf_s::y, expand_t::y, and Pxy_t::y.
Referenced by addGraphObjs(), and spline_edges_().
|
static |
Definition at line 520 of file neatosplines.c.
References addEdgeLabels(), aghead, agnameof(), agtail, clip_and_install(), ED_path, make_polyline(), Ppoly_t::pn, Ppoly_t::ps, sinfo, and Verbose.
Referenced by spline_edges_().
void makeSelfArcs | ( | edge_t * | e, |
int | stepx | ||
) |
Definition at line 217 of file neatosplines.c.
References agraphof(), agtail, cnt(), Concentrate, ED_count, ED_label, ED_to_virt, free(), gv_calloc(), makePortLabels(), makeSelfEdge(), sinfo, and updateBB().
Referenced by compoundEdges(), and spline_edges_().
Definition at line 540 of file neatosplines.c.
References addEdgeLabels(), agerrorf(), aghead, agnameof(), agtail, clip_and_install(), ED_path, free(), in_poly(), make_barriers(), Ppoly_t::pn, POLYID_NONE, Proutespline(), Ppoly_t::ps, sinfo, Verbose, Pxy_t::x, and Pxy_t::y.
Referenced by compoundEdges(), and spline_edges_().
bool neato_set_aspect | ( | graph_t * | g | ) |
Definition at line 1116 of file neatosplines.c.
References _neato_set_aspect(), agfstnode(), agnxtnode(), ND_coord, ND_pos, and POINTS_PER_INCH.
Referenced by fdp_layout(), init_nop(), and spline_edges0().
void neato_translate | ( | Agraph_t * | g | ) |
Definition at line 993 of file neatosplines.c.
References agfstnode(), agfstout(), agnxtnode(), agnxtout(), ED_spl, GD_bb, ND_pos, ND_xlabel, offset, PS2INCH, translateE(), translateG(), pointf_s::x, and pointf_s::y.
Referenced by _neato_set_aspect(), and init_nop().
|
static |
Definition at line 108 of file neatosplines.c.
References disc, edgeitem::e, ED_count, gv_alloc(), and edgeitem::id.
Definition at line 87 of file neatosplines.c.
References pointf_s::x, expand_t::x, Pxy_t::x, pointf_s::y, expand_t::y, and Pxy_t::y.
Referenced by makeObstacle().
|
static |
Definition at line 911 of file neatosplines.c.
References GD_bb, GD_clust, GD_label, GD_n_cluster, and scaleBB().
Referenced by _neato_set_aspect(), and scaleBB().
|
static |
Definition at line 854 of file neatosplines.c.
References aghead, agtail, ED_head_label, ED_label, ED_spl, ED_tail_label, bezier::eflag, bezier::ep, bezier::list, ND_pos, POINTS_PER_INCH, bezier::sflag, bezier::size, bezier::sp, pointf_s::x, and pointf_s::y.
Referenced by _neato_set_aspect().
Definition at line 815 of file neatosplines.c.
References GD_bb, GD_clust, GD_n_cluster, offset, and shiftClusters().
Referenced by shiftClusters(), and spline_edges().
void spline_edges | ( | graph_t * | g | ) |
Definition at line 833 of file neatosplines.c.
References agfstnode(), agnxtnode(), compute_bb(), GD_bb, ND_pos, offset, PS2INCH, shiftClusters(), and spline_edges0().
Referenced by circo_layout(), neato_layout(), sfdp_layout(), and twopi_layout().
void spline_edges0 | ( | graph_t * | g, |
bool | set_aspect | ||
) |
Definition at line 799 of file neatosplines.c.
References agwarningf(), EDGE_TYPE, EDGETYPE_NONE, EDGETYPE_ORTHO, EDGETYPE_PLINE, GD_flags, neato_set_aspect(), Agraph_s::root, set_aspect(), and spline_edges1().
Referenced by doEdges(), init_nop(), osage_layout(), and spline_edges().
int spline_edges1 | ( | graph_t * | g, |
int | edgetype | ||
) |
Definition at line 780 of file neatosplines.c.
References spline_edges_(), and splineEdges().
Referenced by fdpSplines(), osage_layout(), and spline_edges0().
Definition at line 590 of file neatosplines.c.
References add_pointf(), addEdgeLabels(), agfstnode(), agfstout(), aghead, agnnodes(), agnxtnode(), agnxtout(), agwarningf(), BOUNDARY_PORT, cnt(), Concentrate, ED_count, ED_head_port, ED_path, ED_spl, ED_tail_port, ED_to_virt, EDGETYPE_ORTHO, EDGETYPE_PLINE, EDGETYPE_SPLINE, free(), freeRouter(), GD_nodesep, getPath(), gv_calloc(), head, makeMultiSpline(), makeObstacle(), makePolyline(), makeSelfArcs(), makeSpline(), makeStraightEdge(), mkRouter(), ND_coord, ND_lim, Nop, orthoEdges(), Plegal_arrangement(), Pobsclose(), Pobsopen(), POLYID_NONE, ps, Agraph_s::root, sinfo, Verbose, expand_t::x, and expand_t::y.
Referenced by spline_edges1().
|
static |
Definition at line 30 of file neatosplines.c.
Definition at line 732 of file neatosplines.c.
References agfstnode(), agfstout(), agnxtnode(), agnxtout(), dtclose(), dtopen(), Dtoset, ED_count, ED_spl, ED_to_virt, edgeItemDisc, equivEdge(), esepFactor(), GVSPLINES, Nop, resolvePorts(), and State.
Referenced by fdpSplines(), and spline_edges1().
|
static |
Definition at line 36 of file neatosplines.c.
Definition at line 933 of file neatosplines.c.
References ED_head_label, ED_label, ED_spl, ED_tail_label, ED_xlabel, bezier::eflag, bezier::ep, bezier::list, offset, bezier::sflag, bezier::size, bezier::sp, pointf_s::x, and pointf_s::y.
Referenced by neato_translate().
Definition at line 975 of file neatosplines.c.
References GD_bb, GD_clust, GD_label, GD_n_cluster, offset, and translateG().
Referenced by neato_translate(), and translateG().
Dtdisc_t edgeItemDisc |
Definition at line 152 of file neatosplines.c.
Referenced by splineEdges().
|
static |
Definition at line 42 of file neatosplines.c.
Referenced by makePolyline(), makeSelfArcs(), makeSpline(), and spline_edges_().