Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell Diagrams double lined arrows

I'm working now on my library for Bachelor thesis and I need Your help for making new line type. Bellow there is code for single line, double head arrow: <-> . I would like to ask if there is ability to make from line (line = trailFromOffsets [unitX]) to doubleline, which looks like this: =, and arrow with it looks like this <=> ? If there is ability to make it I would be very thankful for an example! Thank You in advance!

line = trailFromOffsets [unitX]
doubleHeadArrow  = (with & arrowHead  .~ spike & headColor .~ black & headSize .~ 0.4
                         & arrowTail .~ spike' & tailColor  .~ black & tailSize .~ 0.4
                         & arrowShaft .~ line) 
like image 986
Darius Avatar asked Nov 10 '22 07:11

Darius


1 Answers

I think you need to create some kind of fake arrow. Taking a double headed arrow with an invisble shaft, with opacity of 0. And put two parallel lines to the invisible shaft, so the arrow, using sep.

import Data.Colour (withOpacity)

invisibleShaftArrow = arrowBetween' (with & arrowHead  .~ spike & headColor .~ black & headSize .~ 0.4
                     & arrowTail .~ spike' & tailColor  .~ black & tailSize .~ 0.4
                     & arrowShaft .~ line & shaftColor .~ anyColor `withOpacity` 0)

Edit: More correct, the lines function should do the trick:

line = trailFromOffsets [unitX]
lines = mconcat $ map strokeLocTrail [line, offsetTrail 0.1 line]

example = (with & arrowHead  .~ spike & headColor .~ black & headSize .~ 0.4
                & arrowTail .~ spike' & tailColor  .~ black & tailSize .~ 0.4
                & arrowShaft .~ lines)
like image 59
grwp Avatar answered Dec 23 '22 15:12

grwp