39 ipp.
y = pp.
y + round((ipp.
x - ppx) * (ppy - cpy) / (ppx - cpx));
40 if (ipp.
y >= ll.
y && ipp.
y <= ur.
y)
45 ipp.
y = pp.
y + round((ipp.
x - ppx) * (ppy - cpy) / (ppx - cpx));
46 if (ipp.
y >= ll.
y && ipp.
y <= ur.
y)
51 ipp.
x = pp.
x + round((ipp.
y - ppy) * (ppx - cpx) / (ppy - cpy));
52 if (ipp.
x >= ll.
x && ipp.
x <= ur.
x)
57 ipp.
x = pp.
x + round((ipp.
y - ppy) * (ppx - cpx) / (ppy - cpy));
58 if (ipp.
x >= ll.
x && ipp.
x <= ur.
x)
64 "segment [(%.5g, %.5g),(%.5g,%.5g)] does not intersect box "
65 "ll=(%.5g,%.5g),ur=(%.5g,%.5g)\n", pp.
x, pp.
y, cp.
x, cp.
y, ll.
x, ll.
y,
84 if (!cluster_name || *cluster_name ==
'\0')
88 agwarningf(
"cluster named %s not found\n", cluster_name);
109 int num_crossings = 0;
114 for (i = 1; i <= 3; i++) {
117 if (
sign != old_sign && old_sign != 0)
120 return num_crossings;
130 int num_crossings = 0;
135 for (i = 1; i <= 3; i++) {
138 if (
sign != old_sign && old_sign != 0)
141 return num_crossings;
153 double xcoord,
double ymin,
double ymax)
168 if (no_cross == 1 && fabs(pts[3].x - xcoord) <= 0.005) {
169 if (
ymin <= pts[3].y && pts[3].y <=
ymax) {
176 Bezier(pts, 0.5, Left, Right);
194 double ycoord,
double xmin,
double xmax)
209 if (no_cross == 1 && fabs(pts[3].y - ycoord) <= 0.005) {
210 if (
xmin <= pts[3].x && pts[3].x <=
xmax) {
217 Bezier(pts, 0.5, Left, Right);
240 for (i = 0; i < 4; i++) {
245 if (t >= 0 && t < tmin) {
251 if (t >= 0 && t < tmin) {
257 if (t >= 0 && t < tmin) {
263 if (t >= 0 && t < tmin) {
281 size_t starti = 0, endi = 0;
291 if (
ED_spl(e)->size > 1) {
292 agwarningf(
"%s -> %s: spline size > 1 not supported\n",
297 const size_t size = bez->
size;
320 agwarningf(
"%s -> %s: head not inside head cluster %s\n",
331 "%s -> %s: tail is inside head cluster %s\n",
342 starti, 0, &nbez, bez->
eflag);
347 for (endi = 0; endi < size - 1; endi += 3) {
351 if (endi == size - 1) {
358 starti, endi, &nbez, bez->
eflag);
380 agwarningf(
"%s -> %s: tail not inside tail cluster %s\n",
391 "%s -> %s: head is inside tail cluster %s\n",
396 bez->
list[starti] = p;
402 endi - 3, &nbez, bez->
sflag);
406 for (starti = endi; starti > 0; starti -= 3) {
408 for (
size_t i = 0; i < 4; i++)
409 pts[i] = bez->
list[starti - i];
411 for (
size_t i = 0; i < 4; i++)
412 bez->
list[starti - i] = pts[i];
416 if (starti == 0 && bez->
sflag) {
418 }
else if (starti != 0) {
422 endi - 3, &nbez, bez->
sflag);
436 nbez.
size = endi - starti + 1;
438 for (
size_t i = 0, j = starti; i < nbez.
size; i++, j++)
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
size_t arrowStartClip(edge_t *e, pointf *ps, size_t startp, size_t endp, bezier *spl, uint32_t sflag)
size_t arrowEndClip(edge_t *e, pointf *ps, size_t startp, size_t endp, bezier *spl, uint32_t eflag)
CDT_API int dtclose(Dt_t *)
pointf Bezier(pointf *V, double t, pointf *Left, pointf *Right)
Dt_t * mkClustMap(Agraph_t *g)
Agraph_t * findCluster(Dt_t *map, char *name)
static pointf boxIntersectf(pointf pp, pointf cp, boxf *bp)
static int splineIntersectf(pointf *pts, boxf *bb)
static int countVertCross(pointf *pts, double xcoord)
static bool inBoxf(pointf p, boxf *bb)
returns true if p is on or in box bb
static graph_t * getCluster(char *cluster_name, Dt_t *map)
static void makeCompoundEdge(edge_t *e, Dt_t *clustMap)
static double findVertical(pointf *pts, double tmin, double tmax, double xcoord, double ymin, double ymax)
void dot_compoundEdges(graph_t *g)
static double findHorizontal(pointf *pts, double tmin, double tmax, double ycoord, double xmin, double xmax)
static int countHorzCross(pointf *pts, double ycoord)
static pointf mid_pointf(pointf p, pointf q)
char * agget(void *obj, char *name)
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
void agwarningf(const char *fmt,...)
void agerrorf(const char *fmt,...)
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Agnode_t * agfstnode(Agraph_t *g)
char * agnameof(void *)
returns a string descriptor for the object.
Arithmetic helper functions.
static int fcmp(double a, double b)
comparator for doubles
static int sign(double v)