Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Add arrows for TikZ diagrams #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danslocombe
Copy link

No description provided.

@@ -79,10 +81,18 @@ castpoint (x,y) = T.pointAtXY x y
radiansToDegrees :: Double -> Double
radiansToDegrees x = (180 * x) / pi

toTPoint :: Point -> T.TPoint
toTPoint = uncurry T.pointAtXY
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as castpoint.

figuretikz (Arrow (p:ps)) = T.path [T.Draw, T.Arrow] $ foldl (\y x -> y T.->- castpoint x) (T.Start $ castpoint p) ps
figuretikz (Curvy []) = emptytikz
--figuretikz (Curvy (p:ps)) = T.path [T.Draw, T.Smooth] $ foldl (\y x -> y T.->- castpoint x) (T.Start $ castpoint p) ps
figuretikz (Curvy (ps)) = T.Curvy (toTPoint <$> ps)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parenthesis in (ps) are not needed.

@Daniel-Diaz
Copy link
Owner

Thanks for working on this! Would you please add an example?

@@ -54,6 +54,8 @@ type Point = (Double,Double)
-- | A figure in the plane.
data Figure =
Line [Point] -- ^ Line along a list of points.
| Arrow [Point] -- ^ Line along a list of points with an arrowhead .
| Curvy [Point]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You explain Arrow, but not Curvy.

@Daniel-Diaz
Copy link
Owner

I have added some comments as well.

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

Successfully merging this pull request may close these issues.

2 participants