Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arrowFromLocatedTrail function #205

Closed
pnutus opened this issue Aug 6, 2014 · 2 comments · Fixed by #206
Closed

arrowFromLocatedTrail function #205

pnutus opened this issue Aug 6, 2014 · 2 comments · Fixed by #206

Comments

@pnutus
Copy link
Contributor

pnutus commented Aug 6, 2014

I want to annotate angles by using arcs with arrowheads on them. I would like to say

arrowFromLocatedTrail (arc fromAngle toAngle)

but there didn't seem to be a function that turned a trail into an arrow. So I wrote that function:

{-# LANGUAGE FlexibleContexts #-}

arrowFromLocatedTrail :: Renderable (Path R2) b => Located (Trail R2) -> Diagram b R2
arrowFromLocatedTrail = arrowFromLocatedTrail' with

arrowFromLocatedTrail' :: Renderable (Path R2) b 
                       => ArrowOpts -> Located (Trail R2) 
                       -> Diagram b R2
arrowFromLocatedTrail' opts trail = arrowBetween' opts' start end
  where opts' = opts & arrowShaft .~ unLoc trail
        start = atStart trail
        end   = atEnd trail

I think it might be useful to include in Diagrams.TwoD.Arrow.

@byorgey
Copy link
Member

byorgey commented Aug 6, 2014

Thanks, this looks useful indeed. Would you be willing to open a pull request? See here for some guidance if you are not sure how:

http://www.haskell.org/haskellwiki/Diagrams/Contributing

@pnutus
Copy link
Contributor Author

pnutus commented Aug 7, 2014

There is an issue with closed trails – they turn into no Arrow at all. It seems like Arrows starting and ending in the same place disappear (# scale 0?). Related to #151, perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants