Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
splines.c File Reference

edge splines More...

#include <math.h>
#include <common/render.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/unreachable.h>
Include dependency graph for splines.c:

Go to the source code of this file.

Macros

#define FUDGE   2
 
#define HT2(n)   (ND_ht(n)/2)
 
#define LEFTOF(a, b, c)   (((a.y - b.y)*(c.x - b.x) - (c.y - b.y)*(a.x - b.x)) > 0)
 
#define MAXLABELWD   (POINTS_PER_INCH/2.0)
 
#define AGXGET(o, a)   agxget(o,a)
 

Functions

static void arrow_clip (edge_t *fe, node_t *hn, pointf *ps, size_t *startp, size_t *endp, bezier *spl, splineInfo *info)
 
void bezier_clip (inside_t *inside_context, bool(*inside)(inside_t *inside_context, pointf p), pointf *sp, bool left_inside)
 
static void shape_clip0 (inside_t *inside_context, node_t *n, pointf curve[4], bool left_inside)
 
void shape_clip (node_t *n, pointf curve[4])
 
beziernew_spline (edge_t *e, size_t sz)
 
void clip_and_install (edge_t *fe, node_t *hn, pointf *ps, size_t pn, splineInfo *info)
 
static double conc_slope (node_t *n)
 
void add_box (path *P, boxf b)
 
void beginpath (path *P, edge_t *e, int et, pathend_t *endp, bool merge)
 
void endpath (path *P, edge_t *e, int et, pathend_t *endp, bool merge)
 
static int convert_sides_to_points (int tail_side, int head_side)
 
static void selfBottom (edge_t *edges[], size_t ind, size_t cnt, double sizex, double stepy, splineInfo *sinfo)
 
static void selfTop (edge_t *edges[], size_t ind, size_t cnt, double sizex, double stepy, splineInfo *sinfo)
 
static void selfRight (edge_t *edges[], size_t ind, size_t cnt, double stepx, double sizey, splineInfo *sinfo)
 
static void selfLeft (edge_t *edges[], size_t ind, size_t cnt, double stepx, double sizey, splineInfo *sinfo)
 
double selfRightSpace (edge_t *e)
 
void makeSelfEdge (edge_t *edges[], size_t ind, size_t cnt, double sizex, double sizey, splineInfo *sinfo)
 
void makePortLabels (edge_t *e)
 
static void endPoints (splines *spl, pointf *p, pointf *q)
 
static pointf polylineMidpoint (splines *spl, pointf *pp, pointf *pq)
 
pointf edgeMidpoint (graph_t *g, edge_t *e)
 
void addEdgeLabels (edge_t *e)
 
int place_portlabel (edge_t *e, bool head_p)
 
splinesgetsplinepoints (edge_t *e)
 

Macro Definition Documentation

◆ AGXGET

#define AGXGET (   o,
 
)    agxget(o,a)

Definition at line 1332 of file splines.c.

◆ FUDGE

#define FUDGE   2

Definition at line 385 of file splines.c.

◆ HT2

#define HT2 (   n)    (ND_ht(n)/2)

Definition at line 386 of file splines.c.

◆ LEFTOF

#define LEFTOF (   a,
  b,
 
)    (((a.y - b.y)*(c.x - b.x) - (c.y - b.y)*(a.x - b.x)) > 0)

Definition at line 1320 of file splines.c.

◆ MAXLABELWD

#define MAXLABELWD   (POINTS_PER_INCH/2.0)

Definition at line 1321 of file splines.c.

Function Documentation

◆ add_box()

void add_box ( path P,
boxf  b 
)

Definition at line 348 of file splines.c.

References path::boxes, boxf::LL, path::nbox, boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by completeregularpath(), make_flat_bottom_edges(), make_flat_edge(), and make_flat_labeled_edge().

Here is the caller graph for this function:

◆ addEdgeLabels()

void addEdgeLabels ( edge_t e)

Definition at line 1328 of file splines.c.

References makePortLabels().

Referenced by attachOrthoEdges(), finishEdge(), makePolyline(), makeSpline(), makeStraightEdges(), and spline_edges_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ arrow_clip()

static void arrow_clip ( edge_t fe,
node_t hn,
pointf ps,
size_t *  startp,
size_t *  endp,
bezier spl,
splineInfo info 
)
static

Definition at line 61 of file splines.c.

References agtail, ARR_NONE, arrow_flags(), arrowEndClip(), arrowOrthoClip(), arrowStartClip(), ED_to_orig, and ps.

Referenced by clip_and_install().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ beginpath()

void beginpath ( path P,
edge_t e,
int  et,
pathend_t endp,
bool  merge 
)

Definition at line 389 of file splines.c.

References add_pointf(), aghead, agraphof(), agtail, BOTTOM, pathend_t::boxes, pathend_t::boxn, conc_slope(), port::constrained, path::data, ED_edge_type, ED_head_port, ED_tail_port, ED_to_orig, FLATEDGE, FUDGE, GD_ranksep, HT2, LEFT, boxf::LL, MAX, merge(), MIN, pathend_t::nb, path::nbox, ND_coord, ND_lw, ND_node_type, ND_rw, ND_shape, NORMAL, pathend_t::np, NULL, port::p, REGULAREDGE, resolvePort(), RIGHT, SELFEDGE, pathend_t::sidemask, path::start, port::theta, TOP, boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by make_regular_edge(), makeBottomFlatEnd(), and makeFlatEnd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bezier_clip()

void bezier_clip ( inside_t inside_context,
bool(*)(inside_t *inside_context, pointf p)  inside,
pointf sp,
bool  left_inside 
)

Definition at line 106 of file splines.c.

References Bezier(), inside(), left, NULL, right, pointf_s::x, and pointf_s::y.

Referenced by arrowEndClip(), arrowStartClip(), compassPoint(), and shape_clip0().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clip_and_install()

void clip_and_install ( edge_t fe,
node_t hn,
pointf ps,
size_t  pn,
splineInfo info 
)

Definition at line 238 of file splines.c.

References agraphof(), agtail, APPROXEQPT, arrow_clip(), ED_edge_type, ED_head_port, ED_tail_port, ED_to_orig, GD_bb, bezier::list, MILLIPOINT, inside_t::n, ND_coord, ND_order, ND_rank, ND_shape, new_spline(), NORMAL, NULL, ps, inside_t::s, shape_clip0(), bezier::size, update_bb_bz(), pointf_s::x, and pointf_s::y.

Referenced by attachOrthoEdges(), finishEdge(), make_flat_bottom_edges(), make_flat_edge(), make_flat_labeled_edge(), make_regular_edge(), makePolyline(), makeSimpleFlat(), makeSimpleFlatLabels(), makeSpline(), makeStraightEdges(), selfBottom(), selfLeft(), selfRight(), and selfTop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ conc_slope()

static double conc_slope ( node_t n)
static

Definition at line 327 of file splines.c.

References aghead, agtail, ND_coord, ND_in, ND_out, pointf_s::x, and pointf_s::y.

Referenced by beginpath(), and endpath().

Here is the caller graph for this function:

◆ convert_sides_to_points()

static int convert_sides_to_points ( int  tail_side,
int  head_side 
)
static

Definition at line 785 of file splines.c.

Referenced by selfBottom(), selfLeft(), selfRight(), and selfTop().

Here is the caller graph for this function:

◆ edgeMidpoint()

pointf edgeMidpoint ( graph_t g,
edge_t e 
)

Definition at line 1299 of file splines.c.

References APPROXEQPT, dotneato_closest(), ED_spl, EDGE_TYPE, EDGETYPE_CURVED, EDGETYPE_SPLINE, endPoints(), MILLIPOINT, polylineMidpoint(), pointf_s::x, and pointf_s::y.

Referenced by addXLabels().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ endpath()

void endpath ( path P,
edge_t e,
int  et,
pathend_t endp,
bool  merge 
)

Definition at line 586 of file splines.c.

References add_pointf(), aghead, agraphof(), agtail, BOTTOM, pathend_t::boxes, pathend_t::boxn, conc_slope(), port::constrained, ED_edge_type, ED_head_port, ED_tail_port, ED_to_orig, path::end, FLATEDGE, FUDGE, GD_ranksep, HT2, LEFT, boxf::LL, M_PI, MAX, merge(), MIN, pathend_t::nb, ND_coord, ND_lw, ND_node_type, ND_rw, ND_shape, NORMAL, pathend_t::np, NULL, port::p, REGULAREDGE, resolvePort(), RIGHT, SELFEDGE, pathend_t::sidemask, path::start, port::theta, TOP, boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by make_regular_edge(), makeBottomFlatEnd(), and makeFlatEnd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ endPoints()

static void endPoints ( splines spl,
pointf p,
pointf q 
)
static

Definition at line 1238 of file splines.c.

References bezier::eflag, bezier::ep, bezier::list, splines::list, bezier::sflag, bezier::size, splines::size, and bezier::sp.

Referenced by edgeMidpoint().

Here is the caller graph for this function:

◆ getsplinepoints()

splines * getsplinepoints ( edge_t e)

Definition at line 1392 of file splines.c.

References agerrorf(), aghead, agnameof(), agtail, ED_edge_type, ED_spl, ED_to_orig, le, NORMAL, and NULL.

Referenced by completeregularpath(), edgeHeadpoint(), edgeTailpoint(), and place_portlabel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makePortLabels()

void makePortLabels ( edge_t e)

Definition at line 1217 of file splines.c.

References agraphof(), agtail, E_labelangle, E_labeldistance, ED_head_label, ED_tail_label, place_portlabel(), and updateBB().

Referenced by addEdgeLabels(), and makeSelfArcs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeSelfEdge()

void makeSelfEdge ( edge_t edges[],
size_t  ind,
size_t  cnt,
double  sizex,
double  sizey,
splineInfo sinfo 
)

Definition at line 1174 of file splines.c.

References BOTTOM, cnt(), ED_head_port, ED_tail_port, LEFT, RIGHT, selfBottom(), selfLeft(), selfRight(), selfTop(), sinfo, and TOP.

Referenced by dot_splines_(), and makeSelfArcs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ new_spline()

bezier * new_spline ( edge_t e,
size_t  sz 
)

Definition at line 215 of file splines.c.

References ED_edge_type, ED_spl, ED_to_orig, bezier::eflag, bezier::ep, gv_alloc(), gv_calloc(), gv_recalloc(), bezier::list, NORMAL, NULL, bezier::sflag, bezier::size, bezier::sp, pointf_s::x, and pointf_s::y.

Referenced by clip_and_install(), make_flat_adj_edges(), and user_spline().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ place_portlabel()

int place_portlabel ( edge_t e,
bool  head_p 
)

Definition at line 1340 of file splines.c.

References AGXGET, Bezier(), dist(), E_labelangle, E_labeldistance, ED_edge_type, ED_head_label, ED_tail_label, bezier::eflag, bezier::ep, getsplinepoints(), IGNORED, late_double(), bezier::list, splines::list, NULL, PORT_LABEL_ANGLE, PORT_LABEL_DISTANCE, textlabel_t::pos, RADIANS, textlabel_t::set, bezier::sflag, bezier::size, splines::size, bezier::sp, pointf_s::x, and pointf_s::y.

Referenced by dot_splines_(), and makePortLabels().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ polylineMidpoint()

static pointf polylineMidpoint ( splines spl,
pointf pp,
pointf pq 
)
static

Definition at line 1263 of file splines.c.

References dist(), DIST, bezier::list, splines::list, bezier::size, splines::size, UNREACHABLE, pointf_s::x, and pointf_s::y.

Referenced by edgeMidpoint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selfBottom()

static void selfBottom ( edge_t edges[],
size_t  ind,
size_t  cnt,
double  sizex,
double  stepy,
splineInfo sinfo 
)
static

Definition at line 820 of file splines.c.

References aghead, agraphof(), agtail, clip_and_install(), cnt(), convert_sides_to_points(), dx, dy, ED_head_port, ED_label, ED_tail_port, GD_flip, ND_coord, ND_ht, points, sgn(), sinfo, pointf_s::x, and pointf_s::y.

Referenced by makeSelfEdge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selfLeft()

static void selfLeft ( edge_t edges[],
size_t  ind,
size_t  cnt,
double  stepx,
double  sizey,
splineInfo sinfo 
)
static

Definition at line 1065 of file splines.c.

References aghead, agraphof(), agtail, clip_and_install(), cnt(), convert_sides_to_points(), dx, dy, ED_head_port, ED_label, ED_tail_port, GD_flip, ND_coord, ND_lw, points, sgn(), sinfo, pointf_s::x, and pointf_s::y.

Referenced by makeSelfEdge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selfRight()

static void selfRight ( edge_t edges[],
size_t  ind,
size_t  cnt,
double  stepx,
double  sizey,
splineInfo sinfo 
)
static

Definition at line 995 of file splines.c.

References aghead, agraphof(), agtail, clip_and_install(), cnt(), convert_sides_to_points(), dx, dy, ED_head_port, ED_label, ED_tail_port, GD_flip, ND_coord, ND_rw, points, sgn(), sinfo, pointf_s::x, and pointf_s::y.

Referenced by makeSelfEdge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selfRightSpace()

double selfRightSpace ( edge_t e)

Definition at line 1148 of file splines.c.

References aghead, agraphof(), BOTTOM, textlabel_t::dimen, ED_head_port, ED_label, ED_tail_port, GD_flip, LEFT, SELF_EDGE_SIZE, TOP, pointf_s::x, and pointf_s::y.

Referenced by make_LR_constraints().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selfTop()

static void selfTop ( edge_t edges[],
size_t  ind,
size_t  cnt,
double  sizex,
double  stepy,
splineInfo sinfo 
)
static

Definition at line 889 of file splines.c.

References aghead, agraphof(), agtail, clip_and_install(), cnt(), convert_sides_to_points(), dx, dy, ED_head_port, ED_label, ED_tail_port, GD_flip, ND_coord, ND_ht, ND_lw, ND_rw, points, sgn(), sinfo, pointf_s::x, and pointf_s::y.

Referenced by makeSelfEdge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shape_clip()

void shape_clip ( node_t n,
pointf  curve[4] 
)

Definition at line 194 of file splines.c.

References inside_t::n, ND_coord, ND_rw, ND_shape, NULL, inside_t::s, shape_clip0(), pointf_s::x, and pointf_s::y.

Referenced by sameport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shape_clip0()

static void shape_clip0 ( inside_t inside_context,
node_t n,
pointf  curve[4],
bool  left_inside 
)
static

Definition at line 160 of file splines.c.

References bezier_clip(), ND_coord, ND_rw, ND_shape, pointf_s::x, and pointf_s::y.

Referenced by clip_and_install(), and shape_clip().

Here is the call graph for this function:
Here is the caller graph for this function: