extern void place_graph_label(Agraph_t *);
extern void place_portlabel(edge_t * e, boolean head_p);
extern void makePortLabels(edge_t * e);
+ extern pointf edgeMidpoint(graph_t* g, edge_t * e);
extern void addEdgeLabels(graph_t* g, edge_t * e, pointf rp, pointf rq);
extern void pop_obj_state(GVJ_t *job);
extern obj_state_t* push_obj_state(GVJ_t *job);
return mf;
}
+pointf
+edgeMidpoint (graph_t* g, edge_t * e)
+{
+ int et = EDGE_TYPE (g);
+ pointf d, spf, p, q;
+
+ endPoints(ED_spl(e), &p, &q);
+ if (APPROXEQPT(p, q, MILLIPOINT)) { /* degenerate spline */
+ spf = p;
+ }
+ else if (et == ET_SPLINE) {
+ d.x = (q.x + p.x) / 2.;
+ d.y = (p.y + q.y) / 2.;
+ spf = dotneato_closest(ED_spl(e), d);
+ }
+ else { /* ET_PLINE, ET_ORTHO or ET_LINE */
+ spf = polylineMidpoint (ED_spl(e), &p, &q);
+ }
+
+ return spf;
+}
+
#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)