ellson / MOTHBALLED-graphviz

Moved to https://gitlab.com/graphviz/graphviz
Eclipse Public License 1.0
1.3k stars 256 forks source link

[Dot] still spline edges after setting attribute splines=false #806

Open GadgetSteve opened 8 years ago

GadgetSteve commented 8 years ago

Ported Issue from Mantis Original ID: 1487 Reported By: Stephan Hennig

SEVERITY: MINOR Submitted: 2008-11-18 05:00:00

OS: --*

VERSION: 2.20.3

DESCRIPTION



Symptom: Zooming into the output of the attached graph that sets attribute 'splines' to false, one can see that edges A->B and B->C are not drawn as plain line segments, but nearly straight Bézier curves. It looks like Graphviz tries to emulate line segments by "straight" Bézier curves, but numeric precision isn't good enough to obtain satisfying results. That is, control points are intended to lay on the ray between the endpoints, but they slightly diverge. The symptom can be observed with different output formats (GIF, PNG, JPG, EPS, PS, PS2, PDF).

Expected behaviour: According to documentation after setting graph attribute splines to false, edges are drawn as line segments, not Bézier curves. Graphviz should use true line segments:

(i) to avoid problems in numeric calculations during rendering,
(ii) to speed-up rendering of many edges in post-processing applications if output format is a vector format,
(iii) to yield smaller files (omitting unnecessary control points), if output format is a vector format.


STEPS TO REPRODUCE

digraph { graph[ splines = false, // dpi = 600, ]; A -> B; A -> C; B -> C; }

ADDITIONAL INFORMATION

[erg] I have entered your bug report as a modification request. At present, edges are represented internally as a collection of B-splines. Line segments from point p to point q are represented as the Bezier (p,p,q,q). This may be tweaked due to clipping to node boundaries and adding arrowheads, but the resulting Bezier should be indistinguishable at any reasonable scale from a line segment, especially since we now represent points as two doubles.

Allowing explicit polylines would offer the advantages you suggest, but it would take a fair amount of effort to add this, and there are other changes we feel would be of more importance to users.

kaimikael commented 7 years ago

Possibly to bump up the priority a bit: I ran into this same problem. I try to display a tree, where the edges between nodes should be straight line segments. I then want to show traversal of this tree, with (strongly) curved splines in a different colour. However, both "straight" and curved segments end up having the same curvature, completely failing the effect I was looking for.

magneticnorth commented 7 years ago

$ dot -Tpdf -Gsplines=curved tree.gv -o tree.pdf

This is what I get. I see gratuitously curved tree edges :-)

tree.pdf

kaimikael commented 7 years ago

Quite. In fact, it would be even better if one could specify that the fan-out was to be symmetrical around the parent node, but let's take one problem at at time.