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

Arrow misses target #126

Closed
jeffreyrosenbluth opened this issue Oct 10, 2013 · 5 comments · Fixed by #127
Closed

Arrow misses target #126

jeffreyrosenbluth opened this issue Oct 10, 2013 · 5 comments · Fixed by #127

Comments

@jeffreyrosenbluth
Copy link
Member

When using a large head size and curvy shaft the head does not point directly at the oriign.
arrowtest

Apparently this has to do with the shaftScale function

@byorgey
Copy link
Member

byorgey commented Oct 10, 2013

Hmm, yes, that is a bit off, isn't it? Can you post the code you used to generate this image?

@byorgey
Copy link
Member

byorgey commented Oct 10, 2013

Also, do you get the correct image if you use the iterative version of shaftScale?

@jeffreyrosenbluth
Copy link
Member Author

Yes I do get the correct image with the iterative version. Code is below.

@jeffreyrosenbluth
Copy link
Member Author

{-# LANGUAGE NoMonomorphismRestriction #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  Diagrams.TwoD.Arrowtest
-- Copyright   :  (c) 2013 diagrams-lib team (see LICENSE)
-- License     :  BSD-style (see LICENSE)
-- Maintainer  :  diagrams-discuss@googlegroups.com
--
-- Test module for Arrow.hs and Arrowheads.hs
--
-----------------------------------------------------------------------------

module Main where

import           Diagrams.Prelude
import           Diagrams.Backend.SVG
import           Diagrams.Backend.SVG.CmdLine
import           Control.Lens ((.~), (&), (%~))


-- | example 0 ------------------------------------------------------------
example = d # connect' (with & arrowHead .~ arrowheadSpike (7/16 :: Turn)
                             & arrowTail .~ noTail
                             & headSize .~ 2 & headStyle %~ fc green
                             & arrowShaft .~ s
                             & shaftStyle %~ lw 0.1 # fc blue)
                            "1" "2"

  where
    c = circle 1.5 # showOrigin # lw 0.02
    t = bezier3 (r2 (1,1)) (r2 (1,1)) (r2 (0,2))
    t' = reflectX t
    l = straight unitX
    l' = straight (unitX # rotateBy (1/6))
    s = trailFromSegments [t, l, t', l, t]
    x |-| y = x ||| strutX 2 ||| y
    row1 = (c # named "1") |-| (c # named "2")
    d = row1

main = defaultMain $ ( example # centerXY) # pad 1.1

@jeffreyrosenbluth
Copy link
Member Author

As far as I can tell from looking at the svg, some of the control points on the arrow shaft differ by almost 10%, e.g. 0.66 vs 0.60 between the algebraic and iterative versions.

byorgey pushed a commit that referenced this issue Oct 11, 2013
Fixes #126. I hope.

Also removes startTangent and endTangent in favor of the new machinery
in Diagrams.Tangent.
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