Hylograph.Flow.Render.Measures
- Package
- purescript-hylograph-flow-render
- Repository
- afcondon/purescript-hylograph-flow-render
Measures of a drawn graph, whoever laid it out: the scoreboard of an earlier layout trial, here so that every engine is scored by one rule.
Every measure is a function of a Drawn and nothing else: node boxes,
each edge as the straight pieces it is drawn along, and the boxes of
the open groups' outlines with their members. drawnOf makes a Drawn
of any Layout, each route by Hylograph.Flow.Render.Route.flatten: a
straight piece is its two ends, a cubic curve is curveSteps (12)
straight pieces. So a ribbon, a dog-leg and a spline are measured by
one rule, and no engine's own counts are used. A Drawn can also be
made by hand, which is how the measures are held to figures worked out
on paper. (The trial read each edge back from its SVG path; the pieces
are the same, so its figures stand.)
THE MEASURES, exactly, as the trial stated them.
crossings: the number of points at which a piece of one edge's line properly crosses a piece of another edge's: each piece's two ends strictly on opposite sides of the other piece. Touching does not count: two edges that leave one point, an edge that turns exactly on another, and two edges that run along one line (a shared trunk) cross nowhere. Two edges that cross twice count twice.edgeLength: the sum of the lengths of every edge's line, pixels.bends: total turning, in right angles: the sum over every interior point of every line of the angle turned there, divided by 90 degrees. An orthogonal route scores one for each corner; a curve scores by how far it swings (an S that reaches 45 degrees and comes back scores one), and a straight line nothing.extent: the box round every node, outline and edge point;areais its width times its height, in pixels squared, andaspectits width over its height.nodeOverlaps: the pairs of node boxes with more than a touch in common (more thanskin, 1 pixel, each way).edgesThroughNodes: the pairs of an edge and a node that is neither of its ends, where the edge's line enters the node's box drawn in byskinon every side.outlineTrespasses: the pairs of an edge and an outline where neither end of the edge is a member of the outline's group and the edge's line enters the outline's box drawn in byskin. (An edge with an end inside must cross the outline, and is not counted.)strangersIn: the pairs of an outline and a node that is no member of it and is in its box or partly in it: the general law (Hylograph.Flow.Render.Laws.strangers), counted.unrouted: the edges with no line (fewer than two points). No route of aLayoutis such (Routecannot be), so of a layout this is 0 unless a route's points are all one point; it is here for aDrawnmade otherwise. An edge an engine left out altogether is the laws' to report (Placed), andunplacedcounts them.
Time to lay out is not here: it is measured by whoever runs the layout.
#edgeLength Source
edgeLength :: Drawn -> Number#nodeOverlaps Source
nodeOverlaps :: Drawn -> Int#edgesThroughNodes Source
edgesThroughNodes :: Drawn -> Int#outlineTrespasses Source
outlineTrespasses :: Drawn -> Int#strangersIn Source
strangersIn :: Drawn -> IntThe pairs of an outline and a node that is no member of it and is in
its box or partly in it, to a millionth of a pixel: the count of what
Hylograph.Flow.Render.Laws.strangers lists.