Add bezierArrowShaft that can draw an arrow shaft with its ends at parameterized angles.

This commit is contained in:
Robbie Gleichman 2016-11-28 13:31:13 -08:00
parent 7e139e114b
commit b393acd949
2 changed files with 9 additions and 4 deletions

View File

@ -81,6 +81,12 @@ arg1ResT len _ = (alignR $ circle (len / 2), mempty)
arg1ResH :: (RealFloat n) => ArrowHT n
arg1ResH len _ = (alignL $ circle (len / 2), mempty)
bezierShaft angle1 angle2 = fromSegments [bezier3 c1 c2 x] where
scaleFactor = 0.5
x = r2 (1,0)
c1 = rotate angle1 (scale scaleFactor unitX)
c2 = rotate angle2 (scale scaleFactor unitX) ^+^ x
getArrowOpts :: (RealFloat n, Typeable n) => (EdgeEnd, EdgeEnd) -> [EdgeOption]-> ArrowOpts n
getArrowOpts (t, h) opts = arrowOptions
where

View File

@ -1,4 +1,6 @@
-- TODO Now --
-- Improve line routing. Draw curved lines with outgoing lines at fixed angles.
-- - connectPerim might be useful for this.
-- TODO Later --
-- Add documentation.
@ -7,7 +9,7 @@
Fix the arrowheads being too big for SyntaxGraph darwings.
-- Visual todos:
-- Put the function name in nested apply in a colored box.
-- Consider putting the function name in nested apply and pattern apply in a colored box.
-- Make an icon font/library with labeled ports. E.g. the apply icon would have text labels "function", "result", "arg 0", "arg 1", etc.
-- Fix rotation missing edges to nested diagrams.
-- Don't rotate text and nested icons, give them rectangualar bounding boxes in GraphViz. (Perhaps use a typeclass for isRotateAble)
@ -18,11 +20,8 @@ Fix the arrowheads being too big for SyntaxGraph darwings.
-- Let each bool, value pair in Guard icon be flipped to reduce line crossings. Do the same for case.
-- Let lines connect to ports in multiple locations (eg. case value, or guard result)
-- Rotate icons based on the outgoing line's difference from ideal angle, not line distance.
-- Improve line routing. Draw curved lines with outgoing lines at fixed angles.
-- - connectPerim might be useful for this.
-- For nested apply, cycle through different colors and line styles (eg. dashed, solid, wavy)
-- - for each nesting level. This will help distinguish what is an argument to which funciton.
-- Investigate arrows not being drawn
-- Translate todos:
Fix y = f (g y) embedding. See todo for findParentThatWillEmbed in GraphAlgorithms.